Skip to content

Commit

Permalink
Adds example that analysis math.h
Browse files Browse the repository at this point in the history
  • Loading branch information
joaobispo committed Apr 4, 2024
1 parent 5746605 commit 21b66fe
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall -O3 -mcmodel=medium")

set(SOURCE_FILES
example.c
C://msys64//clang64//include//math.h
)


Expand All @@ -25,4 +26,5 @@ find_package(Clava REQUIRED)

# Call AutoPar
#clava_weave(example SeparateFunctions.mjs)
clava_weave(example ExtractSymbols.mjs)
#clava_weave(example ExtractSymbols.mjs)
clava_weave(example ExtractHeaderInfo.mjs FLAGS -pi -ist 0)
13 changes: 13 additions & 0 deletions cmake_example/ExtractHeaderInfo.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
laraImport("weaver.Query");

for (const f of Query.search("file", "math.h").search("function", n => !n.startsWith("_"))) {

console.log(f.name + " -> " + f.type + "\n");
const functionType = f.functionType;
// console.log("F TYPE: " + functionType.joinPointType)
console.log("Params: \n");
for(const p of functionType.paramTypes) {
console.log(p.code + "\n");
}
console.log("Return: " + functionType.returnType.code + "\n");
}
2 changes: 2 additions & 0 deletions cmake_example/example.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "math.h"

static int global = 0;

struct s {
Expand Down
239 changes: 239 additions & 0 deletions cmake_example/test.clava
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
<SimpleDataStore>
<name>LaraI Options</name>
<values>
<entry>
<string>workspace</string>
<FileList>
<fileList>
<file>example.c</file>
<file>C:\msys64\clang64\include\math.h</file>
</fileList>
</FileList>
</entry>
<entry>
<string>library includes</string>
<FileList>
<fileList/>
</FileList>
</entry>
<entry>
<string>main</string>
<string></string>
</entry>
<entry>
<string>output</string>
<file></file>
</entry>
<entry>
<string>parsingNumThreads</string>
<int>0</int>
</entry>
<entry>
<string>libcCxxMode</string>
<pt.up.fe.specs.clang.LibcMode>SYSTEM</pt.up.fe.specs.clang.LibcMode>
</entry>
<entry>
<string>cudaGpuArch</string>
<string>sm_30</string>
</entry>
<entry>
<string>parseIncludes</string>
<boolean>true</boolean>
</entry>
<entry>
<string>javascript</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Disable Remote Dependencies</string>
<boolean>false</boolean>
</entry>
<entry>
<string>joptions_current_folder_path</string>
<java.util.Optional isPresent="false"/>
</entry>
<entry>
<string>Generate Modified Code Only</string>
<boolean>false</boolean>
</entry>
<entry>
<string>parallelParsing</string>
<boolean>true</boolean>
</entry>
<entry>
<string>api_autoload</string>
<boolean>true</boolean>
</entry>
<entry>
<string>continueOnParsingErrors</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Weaved code foldername</string>
<string>woven_code</string>
</entry>
<entry>
<string>external_dependencies</string>
<StringList>
<stringList/>
</StringList>
</entry>
<entry>
<string>Disable Weaving</string>
<boolean>false</boolean>
</entry>
<entry>
<string>metrics</string>
<OptionalFile>
<file></file>
<used>false</used>
</OptionalFile>
</entry>
<entry>
<string>C/C++ Standard</string>
<pt.up.fe.specs.clava.language.Standard>GNUXX11</pt.up.fe.specs.clava.language.Standard>
</entry>
<entry>
<string>workspace_extra</string>
<map/>
</entry>
<entry>
<string>Clava Custom Resources</string>
<boolean>false</boolean>
</entry>
<entry>
<string>restrict mode</string>
<boolean>false</boolean>
</entry>
<entry>
<string>loc</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Disable Code Generation</string>
<boolean>true</boolean>
</entry>
<entry>
<string>log</string>
<OptionalFile>
<file></file>
<used>false</used>
</OptionalFile>
</entry>
<entry>
<string>autoimportjs</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Clean intermediate files</string>
<boolean>true</boolean>
</entry>
<entry>
<string>systemIncludesThreshold</string>
<int>2</int>
</entry>
<entry>
<string>argv</string>
<string></string>
</entry>
<entry>
<string>tools</string>
<OptionalFile>
<file></file>
<used>false</used>
</OptionalFile>
</entry>
<entry>
<string>jsEngine</string>
<pt.up.fe.specs.jsengine.JsEngineType>GRAALVM_COMPAT</pt.up.fe.specs.jsengine.JsEngineType>
</entry>
<entry>
<string>flatOutputFolder</string>
<boolean>false</boolean>
</entry>
<entry>
<string>bundle_tags</string>
<string></string>
</entry>
<entry>
<string>customClangAstDumperExe</string>
<file></file>
</entry>
<entry>
<string>Compiler Flags</string>
<string></string>
</entry>
<entry>
<string>Compiler Flags in list format</string>
<StringList>
<stringList>
<string>-Wno-narrowing</string>
<string>-Wno-deprecated-register</string>
<string>-Wno-unused-value</string>
</stringList>
</StringList>
</entry>
<entry>
<string>Check C/CXX Syntax</string>
<boolean>false</boolean>
</entry>
<entry>
<string>aspect</string>
<file>ExtractHeaderInfo.mjs</file>
</entry>
<entry>
<string>ignoreHeaderIncludes</string>
<StringList>
<stringList/>
</StringList>
</entry>
<entry>
<string>cudaPath</string>
<string></string>
</entry>
<entry>
<string>stack trace</string>
<boolean>true</boolean>
</entry>
<entry>
<string>include</string>
<FileList>
<fileList/>
</FileList>
</entry>
<entry>
<string>debug</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Disable Clava Info</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Copy files in sources</string>
<boolean>false</boolean>
</entry>
<entry>
<string>Generate CMake Integration Helper Files</string>
<boolean>false</boolean>
</entry>
<entry>
<string>verbose</string>
<org.lara.interpreter.joptions.config.interpreter.VerboseLevel>warnings</org.lara.interpreter.joptions.config.interpreter.VerboseLevel>
</entry>
<entry>
<string>header includes</string>
<FileList>
<fileList/>
</FileList>
</entry>
<entry>
<string>report</string>
<OptionalFile>
<file></file>
<used>false</used>
</OptionalFile>
</entry>
</values>
<strict>false</strict>
</SimpleDataStore>

0 comments on commit 21b66fe

Please sign in to comment.