diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..4c5139427c --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,100 @@ +# Copilot Instructions for the Clava Repository + +## Project Overview + +Clava is a modular source-to-source compiler for C, C++, CUDA, and OpenCL, supporting advanced code analysis and transformation. It is implemented using a combination of TypeScript/JavaScript (Node.js), Java, and C++. Clava is designed for composability and reusability, and integrates with the LARA DSL for custom code transformations. + +## Development Environment & Setup + +- **Node.js Version:** 20 or 22 (required for Clava-JS) +- **Java Version:** 17+ (required for Java components) +- **Build System:** Gradle for Java modules, npm for TypeScript/JavaScript +- **IDE:** VSCode is recommended for development + +## Architecture + +- **Frontend (C++):** + The `ClangAstDumper` component extracts AST information from Clang-based codebases. +- **Middle-end (Java):** + Components like `ClangAstParser` and `ClavaWeaver` process ASTs and apply transformations. +- **API Layer (TypeScript/JavaScript):** + The `Clava-JS` module provides the main user-facing API and runtime, exposing Clava's features to Node.js environments. +- **Build Integration:** + The `CMake` package enables integration with CMake-based build systems. + +### Related Projects +- **lara-framework**: Core framework providing weaver infrastructure and JavaScript APIs +- **specs-java-libs**: Java utility libraries used throughout the project + +## Key Directories + +- `Clava-JS/`: TypeScript/JavaScript API and runtime. +- `ClavaWeaver/`: Java-based weaving engine. +- `ClangAstDumper/`: C++ AST dumper using Clang. +- `ClangAstParser/`: Java AST parser. +- `ClavaAst/`, `ClavaHls/`, `ClavaLaraApi/`, `AntarexClavaApi/`: Supporting modules for AST, HLS, LARA API, and Antarex integration. +- `CMake/`: CMake integration scripts and utilities. +- `docs/`: Documentation, tutorials, and common issues. + +## Build and Development + +- **Java Components:** Use Gradle (`gradle installDist`) to build Java modules (e.g., ClavaWeaver). +- **TypeScript/JavaScript:** Use npm scripts (`npm install`, `npm run build`) in `Clava-JS`. +- **C++ Components:** Use CMake for building and integrating the Clang AST dumper. +- **Integration:** Copy built Java binaries into `Clava-JS/java-binaries` for full functionality. + +## Usage + +- **NPM Package:** + Install globally or as a project dependency: + `npm install -g @specs-feup/clava` +- **CLI:** + Run transformations via `npx clava classic -p ""` +- **CMake Integration:** + Use the `clava_weave` CMake command to apply LARA scripts to targets. + +## Code Patterns and Conventions + +- **Visitor Patterns:** + Used extensively in AST processing (see `ClangAstDumper.h`). +- **TypeScript API:** + Modular, with clear separation between API (`src-api/`) and code (`src-code/`). +- **Java:** + Follows standard Gradle project structure. +- **C++:** + Integrates with Clang/LLVM for AST extraction. + +## Common Development Tasks + +- Add new AST node support in `ClangAstDumper` and propagate through Java and JS layers. +- Extend the TypeScript API in `Clava-JS/src-api/`. +- Create new code transformations as LARA scripts or TypeScript modules. +- Use provided test scripts and npm/Gradle test commands. + +## Dependencies + +- **Node.js 20 or 22** and **Java 17+** required. +- **Clang/LLVM** for AST extraction. +- **NPM** for JS/TS dependencies. +- **Gradle** for Java builds. +- **CMake** for build system integration. + +## Troubleshooting + +- See `docs/common_issues.md` for frequently encountered problems. +- Use the GitHub issue tracker for unresolved issues. + +## References + +- [Clava Documentation](https://specs-feup.github.io/modules/_specs_feup_clava.html) +- [Clava Project Template](https://github.com/specs-feup/clava-project-template) +- [Online Demo](https://specs.fe.up.pt/tools/clava/) +- [Main Repository](https://github.com/specs-feup/clava) + +--- + +**For LLMs:** +- Respect the modular structure and language boundaries. +- When adding features, ensure changes propagate through C++, Java, and JS layers as needed. +- Follow existing patterns for AST traversal and transformation. +- Use the provided build and test scripts for validation. diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000000..c7b566c0a6 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,106 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed +# Allows for streamlined validation, +# and allow manual testing through the repository's "Actions" tab + +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +env: + CLAVA_BRANCH: ${{ github.head_ref || github.ref_name }} + +jobs: + # The job MUST be called `copilot-setup-steps` + # otherwise it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + + # Permissions set just for the setup steps + # Copilot has permissions to its branch + + permissions: + # To allow us to clone the repo for setup + contents: read + + # The setup steps - install our dependencies + steps: + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: current + dependency-graph: generate-and-submit + + - name: Checkout clava + uses: actions/checkout@v4 + with: + path: clava + + - name: Determine repository refs + id: repo-refs + shell: bash + env: + BRANCH_NAME: ${{ env.CLAVA_BRANCH }} + run: | + set -euo pipefail + + determine_ref() { + local prefix=$1 + local repo=$2 + local url="https://github.com/${repo}.git" + + local default_branch + default_branch=$(git ls-remote --symref "$url" HEAD | awk '/^ref:/ {print $2}' | sed 's@refs/heads/@@') + echo "${prefix}_default=${default_branch}" >> "$GITHUB_OUTPUT" + echo "Default branch for ${repo} is '${default_branch}'" + + if git ls-remote --heads "$url" "refs/heads/${BRANCH_NAME}" >/dev/null; then + echo "${prefix}_match=true" >> "$GITHUB_OUTPUT" + echo "${prefix}_ref=${BRANCH_NAME}" >> "$GITHUB_OUTPUT" + echo "Branch '${BRANCH_NAME}' exists in ${repo}" + else + echo "${prefix}_match=false" >> "$GITHUB_OUTPUT" + echo "${prefix}_ref=${default_branch}" >> "$GITHUB_OUTPUT" + echo "Branch '${BRANCH_NAME}' not found in ${repo}. Falling back to '${default_branch}'." + fi + } + + determine_ref "lara" "specs-feup/lara-framework" + determine_ref "specs" "specs-feup/specs-java-libs" + + - name: Echo checks + run: | + echo "Clava branch: ${{ env.CLAVA_BRANCH }}" + echo "Matching branch found (lara-framework): ${{ steps.repo-refs.outputs.lara_match }}" + echo "Matching branch found (specs-java-libs): ${{ steps.repo-refs.outputs.specs_match }}" + echo "Lara framework ref: ${{ steps.repo-refs.outputs.lara_ref }}" + echo "Specs-java-libs ref: ${{ steps.repo-refs.outputs.specs_ref }}" + echo "Lara framework default fallback: ${{ steps.repo-refs.outputs.lara_default }}" + echo "Specs-java-libs default fallback: ${{ steps.repo-refs.outputs.specs_default }}" + echo "Pull request base_ref (if any): ${{ github.base_ref }}" + + - name: Checkout lara-framework + uses: actions/checkout@v4 + with: + repository: specs-feup/lara-framework + path: lara-framework + ref: ${{ steps.repo-refs.outputs.lara_ref }} + + - name: Checkout specs-java-libs + uses: actions/checkout@v4 + with: + repository: specs-feup/specs-java-libs + path: specs-java-libs + ref: ${{ steps.repo-refs.outputs.specs_ref }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 29d98f7d11..6058930d5f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -7,7 +7,6 @@ name: nightly on: push: - pull_request: # Daily at midnight schedule: @@ -81,8 +80,7 @@ jobs: with: repository: specs-feup/specs-java-libs path: specs-java-libs - # This is causing problems in PRs, for now it will always be the default branch - #ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} + ref: ${{ steps.Branch-specs-java-libs.outputs.value == '1' && env.BRANCH_NAME || env.DEFAULT_BRANCH }} - name: Build with Gradle run: | @@ -92,13 +90,11 @@ jobs: - name: Test ClangAstParser run: | cd clava/ClangAstParser - #touch debug gradle test - name: Test ClavaWeaver run: | cd clava/ClavaWeaver - #touch debug gradle test env: GITHUB_DEPENDENCY_GRAPH_ENABLED: false @@ -123,10 +119,10 @@ jobs: strategy: fail-fast: false matrix: - #node-version: ['latest', '20.x', '18.x'] - node-version: ['22.x', '20.x'] + #node-version: ['latest', '22.x', '20.x'] + node-version: ['22.x', '20.x'] os: [ubuntu-latest, windows-latest, macos-latest] - + runs-on: ${{ matrix.os }} steps: @@ -142,6 +138,15 @@ jobs: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org/' + # Install Xcode Command-Line Tools and GCC on macOS + - name: Install C SDK and GCC + if: matrix.os == 'macos-latest' + run: | + sudo xcode-select --install || true + sudo xcode-select -s /Library/Developer/CommandLineTools + brew install gcc + echo 'export PATH="$(brew --prefix gcc)/bin:$PATH"' >> $GITHUB_ENV + - name: Checkout Clava uses: actions/checkout@v4 with: @@ -175,25 +180,6 @@ jobs: name: java-binaries path: clava/Clava-JS/java-binaries - - name: Diagnostic info - working-directory: clava/Clava-JS - run: | - echo "=== Node and npm ===" - node -v - npm -v - echo "=== System Info ===" - uname -a - echo "=== Environment ===" - printenv | sort - echo "=== TypeScript Config ===" - npx tsc --showConfig - echo "=== Installed Packages ===" - npm ls --depth=0 - - - name: Debug Jest - working-directory: clava/Clava-JS - run: npx jest --showConfig - - name: Test JS run: | cd clava/Clava-JS @@ -223,4 +209,4 @@ jobs: echo "Not a push event, skipping publish." fi env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index f2f42334c0..ae347c6cd8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,6 @@ RemoteSystemsTempFiles/ ################## .vscode -deps/temp -**/.settings/org.eclipse.buildship.core.prefs tomJava/ .svn/ @@ -29,6 +27,9 @@ sf.eclipse.javacc.prefs MatisseOptions.lara Matisse.lara +# Eclipse settings folder +**/.settings/** + #output/ .idea/ .gradle/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..2956839129 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,13 @@ +{ + "recommendations": [ + "sonarsource.sonarlint-vscode", + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "orta.vscode-jest", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "redhat.java", + "vscjava.vscode-gradle", + "vscjava.vscode-java-debug" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..7a3fdc687b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "cmake.ignoreCMakeListsMissing": true, + "java.compile.nullAnalysis.mode": "automatic", + "java.configuration.updateBuildConfiguration": "automatic", + "jest.runMode": { + "type": "on-demand" + }, +} \ No newline at end of file diff --git a/AntarexClavaApi/.classpath b/AntarexClavaApi/.classpath deleted file mode 100644 index 58b9a0ab04..0000000000 --- a/AntarexClavaApi/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AntarexClavaApi/.project b/AntarexClavaApi/.project deleted file mode 100644 index 848054f95d..0000000000 --- a/AntarexClavaApi/.project +++ /dev/null @@ -1,34 +0,0 @@ - - - AntarexClavaApi - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598926 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/AntarexClavaApi/.settings/org.eclipse.jdt.core.prefs b/AntarexClavaApi/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 626e0e1d5c..0000000000 --- a/AntarexClavaApi/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 -org.eclipse.jdt.core.compiler.compliance=17 -org.eclipse.jdt.core.compiler.source=17 diff --git a/AntarexClavaApi/build.gradle b/AntarexClavaApi/build.gradle index 8ee035cbe9..59553a92a4 100644 --- a/AntarexClavaApi/build.gradle +++ b/AntarexClavaApi/build.gradle @@ -1,43 +1,35 @@ plugins { - id 'distribution' + id 'distribution' + id 'java' } -// Java project -apply plugin: 'java' - java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - // Repositories providers repositories { mavenCentral() } dependencies { - testImplementation "junit:junit:4.13.1" - implementation ':SpecsUtils' - implementation ':LaraUtils' + implementation ':SpecsUtils' + implementation ':LaraUtils' } -java { - withSourcesJar() -} - - // Project sources sourceSets { - main { - java { - srcDir 'src-java' - } - - resources { - srcDir 'src-lara' - srcDir 'src-js' - } - } - + main { + java { + srcDir 'src-java' + } + + resources { + srcDir 'src-lara' + srcDir 'src-js' + } + } } diff --git a/AntarexClavaApi/settings.gradle b/AntarexClavaApi/settings.gradle index aee3283847..ef4f6c3b76 100644 --- a/AntarexClavaApi/settings.gradle +++ b/AntarexClavaApi/settings.gradle @@ -1,5 +1,8 @@ rootProject.name = 'AntarexClavaApi' -includeBuild("../../specs-java-libs/SpecsUtils") +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' +def laraFrameworkRoot = System.getenv('LARA_FRAMEWORK_HOME') ?: '../../lara-framework' -includeBuild("../../lara-framework/LaraUtils") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") + +includeBuild("${laraFrameworkRoot}/LaraUtils") diff --git a/AntarexClavaApi/src-java/pt/up/fe/specs/antarex/clava/LaraAntarexApiResource.java b/AntarexClavaApi/src-java/pt/up/fe/specs/antarex/clava/LaraAntarexApiResource.java index 209846b02d..e4433c031f 100644 --- a/AntarexClavaApi/src-java/pt/up/fe/specs/antarex/clava/LaraAntarexApiResource.java +++ b/AntarexClavaApi/src-java/pt/up/fe/specs/antarex/clava/LaraAntarexApiResource.java @@ -60,18 +60,6 @@ public enum LaraAntarexApiResource implements LaraResourceProvider { // mARGOt Helpers ENUM("margot/Enum.js"), - // Memoi - MEMOIZATION("memoi/Memoization.lara"), - MEMOIZATION_AUTO_ASPECTS("memoi/MemoizationAutoAspects.lara"), - MEMOIZATION_AUTO_FUNCS("memoi/MemoizationAutoFuncs.lara"), - MEMOIZATION_C("memoi/MemoizationC.lara"), - MEMOIZATION_CXX("memoi/MemoizationCXX.lara"), - MEMOIZATION_LIB_FUNCS("memoi/MemoizationLibFuncs.lara"), - MEMOIZATION_MATH("memoi/MemoizationMath.lara"), - - // Memoi Helpers - LARA_OBJECT("memoi/LaraObject.js"), - // MultiVersioning MULTI_POINTERS("multi/MultiVersionPointers.lara"), MULTI_POINTERS_ASPECTS("multi/MultiVersionPointersAspects.lara"), diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/LaraObject.js b/AntarexClavaApi/src-lara/clava/antarex/memoi/LaraObject.js deleted file mode 100644 index b3ca916ba3..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/LaraObject.js +++ /dev/null @@ -1,331 +0,0 @@ -/** - * This is a utility class that provides a few useful containers to be - * used with LARA aspects. The idea behind this, is to use tuples captured - * with SELECTS, such as or , and use them - * as identifiers to store information. -* - * This class has the following methods: - * getId - * set - * get - * inc - * push - * - * The methods getId() and push(), should not be used with any other - * methods. The methods get(), set() and inc() can be used together to - * store and retrieve information of a particular tuple. - * - * Examples: - * ... - * ... - * ... - * ... - */ - - - /** - * Syntax: - * var obj = new LaraObject(); - * - * - * Description: - * - * This is the LaraObject constructor. - * - * getTotal() and newId() are previliged methods, they are public but - * they can access and modify private variables. They are not enumerable. - */ -function LaraObject(start){ - - var init = start || 0; - /* The counter used to assign unique IDs to tuples. */ - var uid_counter = 0; - - /* The previliged methods. */ - this.getTotal = function () { - - return uid_counter.toString(); - }; - Object.defineProperty(this, "getTotal", {enumerable: false}); - - this.newId = function () { - var ret = init + uid_counter; - uid_counter++; - return ret.toString(); - }; - Object.defineProperty(this, "newId", {enumerable: false}); -}; - - -/** - * Syntax: - * var id = obj.getId(tuple); - * - * Parameters: - * tuple: any object tuple - * - * Description: - * - * Gets an ID for the provided tuple. - * - * If the tuple was already inserted, the ID will be retrieved. If - * this is the first time we insert the tuple, a new ID will be - * created. This is transparent to the user. - */ -LaraObject.prototype.getId = function (){ - - if(arguments.length == 0) { - return undefined; - } - - var lastProperty = this; - - for(var i = 0; i< arguments.length-1; i++){ - - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - - lastProperty[currentProperty] = {}; - } - - lastProperty = lastProperty[currentProperty]; - } - - var currentProperty = arguments[arguments.length-1]; - - if(lastProperty[currentProperty] == undefined) { - - lastProperty[currentProperty] = this.newId(); - } - - return lastProperty[currentProperty]; -}; -Object.defineProperty(LaraObject.prototype, "getId", {enumerable: false}); - -/** - * Syntax: - * obj.set(tuple, value); - * - * Parameters: - * tuple: any object tuple - * value: the value of the tuple - * - * Description: - * - * Sets the value for the provided tuple. - * - * If the tuple was already inserted, it will be updated. If this is - * the first time we insert the tuple, it will be created. This is - * transparent to the user. The first N-1 arguments are the tuple, the Nth - * argument is the element to be pushed. - */ -LaraObject.prototype.set = function (){ - - if(arguments.length == 0) { - return; - } - - var lastProperty = this; - - for(var i = 0; i< arguments.length-2; i++){ - - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = {}; - } - lastProperty = lastProperty[currentProperty]; - } - - var currentProperty = arguments[arguments.length-2]; - - lastProperty[currentProperty] = arguments[arguments.length-1]; -}; -Object.defineProperty(LaraObject.prototype, "set", {enumerable: false}); - - -/** - * Syntax: - * obj.sum(tuple, value); - * - * Parameters: - * tuple: any object tuple - * value: the value of the tuple - * - * Description: - * - * Adds the value for the provided tuple to the current stored value. - * - * If the tuple was already inserted, it will be updated. If this is - * the first time we insert the tuple, it will be created with the given value. - * This is ransparent to the user. The first N-1 arguments are the tuple, the - * Nth argument is the element to be pushed. - */ -LaraObject.prototype.sum = function (){ - - if(arguments.length == 0) { - return; - } - - var lastProperty = this; - - for(var i = 0; i< arguments.length-2; i++){ - - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = {}; - } - lastProperty = lastProperty[currentProperty]; - } - - var currentProperty = arguments[arguments.length-2]; - - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = 0; - } - lastProperty[currentProperty] += arguments[arguments.length-1]; -}; -Object.defineProperty(LaraObject.prototype, "sum", {enumerable: false}); - -/** - * Syntax: - * var value = obj.get(tuple); - * - * Parameters: - * tuple: any object tuple - * - * Description: - * - * Gets the value for the provided tuple. - * - * If the tuple is not present, an empty object will be returned. - */ -LaraObject.prototype.get = function (){ - - if(arguments.length == 0) { - return; - } - - var lastProperty = this; - - for(var i = 0; i< arguments.length; i++){ - - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = {}; - } - lastProperty = lastProperty[currentProperty]; - } - - return lastProperty; -}; -Object.defineProperty(LaraObject.prototype, "get", {enumerable: false}); - -/** - * Syntax: - * var value = obj.getOrElseZero(tuple); - * - * Parameters: - * tuple: any object tuple - * - * Description: - * - * Gets the value for the provided tuple. - * - * If the tuple is not present, returns zero. - */ - /* -LaraObject.prototype.getOrZero = function (){ - return this.get(arguments) || 0; - - //var result = this.get(arguments); - - //if(result === undefined) { - // return 0; - //} - - //return result; - -} -Object.defineProperty(LaraObject.prototype, "getOrZero", {enumerable: false}); -*/ - -/** - * Syntax: - * obj.inc(tuple); - * - * Parameters: - * tuple: any object tuple - * - * Description: - * - * Increments the value of the provided tuple. - * - * If the tuple was already inserted, its value will be incremented. - * If this is the first time we increment the tuple, its value will be 1. - * This is transparent to the user. - */ -LaraObject.prototype.inc = function (){ - - - if(arguments.length == 0) - return; - var lastProperty = this; - for(var i = 0; i< arguments.length-1; i++){ - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = {}; - } - lastProperty = lastProperty[currentProperty]; - } - var currentProperty = arguments[arguments.length-1]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = 1; - }else{ - lastProperty[currentProperty]++; - } -}; -Object.defineProperty(LaraObject.prototype, "inc", {enumerable: false}); - -/** - * Syntax: - * obj.push(tuple, element); - * - * Parameters: - * tuple: any object tuple - * element: the element to be pushed - * - * Description: - * - * Pushes and element to an array on the provided tuple. - * - * The first N-1 arguments are the tuple, the Nth argument is the - * element to be pushed. If this is the first time the tuple is being - * used, a new array will be created. This is transparent to the user. - */ -LaraObject.prototype.push = function (){ - - if(arguments.length <= 1) { - return; - } - - var lastProperty = this; - - for(var i = 0; i< arguments.length-2; i++){ - var currentProperty = arguments[i]; - if(lastProperty[currentProperty] == undefined) { - lastProperty[currentProperty] = {}; - } - lastProperty = lastProperty[currentProperty]; - } - - var currentProperty = arguments[arguments.length-2]; - - if(lastProperty[currentProperty] == undefined) { - - lastProperty[currentProperty] = []; - } - - lastProperty[currentProperty].push(arguments[arguments.length-1]); -}; -Object.defineProperty(LaraObject.prototype, "push", {enumerable: false}); - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/Memoization.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/Memoization.lara deleted file mode 100644 index c52e678d2d..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/Memoization.lara +++ /dev/null @@ -1,103 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ - -/* This package defines the memoizing functions/methods for C, C++ language. - * Restrictions: - * - function/method with n input arguments (n in [1,4]) and one returned value. - * - the type of the input arguments and the returned value are equal and restricted to int, float, double. - * - * @example - * Example of a memoizatino session: - * aspectdef Launcher - // Initialize - call Memoize_Initialize( ); - - // memoize the log math function, with default parameters. - call Memoize_MathFunction('log'); - - // memoize the method method3 of the class Test2, with default parameters. - call Memoize_Method ('Test2', 'method3'); - - // memoize the method method1 of the class Test, with user parameters. - call Memoize_Method_ARGS ('Test', 'method1', 'none', 'no', 'o1.data', 'yes', 0, 2048); - - // memoize the method method1 of the class Test, this method has one float parameter (overloading). - call Memoize_Method_overloading('Test2', 'method1', "float",1); - - // Finalize - call Memoize_Finalize( ); - end - * */ - -import antarex.utils.messages; -import antarex.utils.mangling; -import antarex.utils.lowLevelFuncs; -import antarex.utils.sysfile; -import antarex.memoi.MemoizationC; -import antarex.memoi.MemoizationMath; -import antarex.memoi.MemoizationCXX; -import antarex.memoi.MemoizationLibFuncs; - -var filepath = ""; -var FIRST_MEMOI_C = true; -var FIRST_MEMOIZATION = true; -var DEFAULT_TABSIZE = 65536; // how to declare a constant ? - -var memoizableTypes = ['float', 'double', 'int']; - -// This name must be the same than the name used in the INRIA memoization package. -var varExposedToMARGOT = "_Memoize_"; - -// Generated file for the memoization: functions/methods to be memoized -var $newFileJp_MEMOI_DEFS; -var FILENAME_MEMOI_DEFS="funs-static.def"; - -// Generated file for wrappers management: declaration of the wrappers (C code) -var $newFileJp_MEMOI_wrappers; -var FILENAME_MEMOI_WRAPPERS="memoizing_wrappers.h"; - -// Generated file for connection with mARGOt: declaration of the variable exposed to mARGOt -var $newFileJp_MEMOI_MARGOT; -var FILENAME_EXPOSED_VARS="memoizing_exposedVars.h"; -var CodeLanguages = [ "MF", "CPP", "C"]; // MF : Math functions - -// Set of exposed variables. -var ExposedVariables = []; - -/** - * Initializing the memoization - * */ -aspectdef Memoize_Initialize - TRACE(" BEGIN Memoize_Initialize"); - setManglingForC(false); - FIRST_MEMOI_C = true; - FIRST_MEMOIZATION = true; -end - -/** - * Finalizing the memoization. - * It adds also some define in the memoizing_wrappers.h file for C specs. - * */ -aspectdef Memoize_Finalize - TRACE(" BEGIN Memoize_Finalize"); - if (! FIRST_MEMOI_C) genExternSpec($newFileJp_MEMOI_wrappers); - // adding declaration for mARGOt - select file.function{'main'}.body end - apply - if (! FIRST_MEMOIZATION || ! FIRST_MEMOI_C) - { - genExposedVariables($newFileJp_MEMOI_MARGOT, ExposedVariables); - $file.exec addInclude( FILENAME_EXPOSED_VARS, false); - insert before( "INRIA_memoInit(1);"); - } - end - -end - - - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoAspects.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoAspects.lara deleted file mode 100644 index ee5e68626a..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoAspects.lara +++ /dev/null @@ -1,161 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ -import antarex.utils.messages; -import antarex.memoi.Memoization; -import antarex.memoi.MemoizationAutoFuncs; -import antarex.memoi.LaraObject; - -var stackCall=[]; -var callGraph=new LaraObject(); -var memoiFunctions={ }; -var STATE={NO:0, YES:1, VISITED:2, UNDEF:3}; -var STRSTATE=["NOT_MEMOIZABLE", "MEMOIZABLE", "RECURSIVE", "UNDEFINED"]; -var SomePredefinedPureFunctions =["isnan"]; - -/** - * Returns in memoizableFunctions the detected memoizable functions (excluding the math functions). - * @param {string[]} memoizableFunctions, the set of the detected - * memoizable functions encoded by Filename%Line. - * */ -aspectdef findMemoizables -output - memoizableFunctions=[] -end - call BuildStaticCallGraph(); - printCallGraph(callGraph); - // init - select file.function.body end - apply - currentfunction = getidfunction($file, $function); - if (memoiFunctions[currentfunction] === undefined) memoiFunctions[currentfunction] = STATE.UNDEF; - TRACE(" MemoiFunctions at initial value for " + currentfunction + " = " + STRSTATE[ memoiFunctions[currentfunction]]); - end - - // Fix point computation. - var nbPrev = -1; - var nb = getNbMemoizable(); - while (nb > nbPrev) { - nbPrev = nb; - call findmemoizable_fpstep(); - nb = getNbMemoizable(); - }; - - // Export the results in memoizableFunctions - for (f in memoiFunctions) { - var code = memoiFunctions[f]; - TRACE(" memoiFunctions [" + f + '] = ' + STRSTATE[code] ); - if ( code === STATE.YES) memoizableFunctions.push(f); - } -end - -/** Search the memoizable functions of the application. - * The status of a function for the memoization is stored in a global array ( memoiFunctions ). - * For a function F of a file FILENAME, memoiFunctions[getidfunction( F, FILENAME)] = V, - * where getidfunction(x,y) is a function that guarantees the of the reference. - * - V =STATE.YES => F is memoizable - * - V =STATE.NO => F is not memoizable - * - V =STATE.UNDEF => the status of F is undefined - * - V =STATE.VISITED => internal used (for recursivity detection). - * The inline function are ignored. - * */ -aspectdef findmemoizable_fpstep - TRACE( " =================> STARTING FIX POINT STEP"); - select file.function.body end - apply - currentfunction = getidfunction($file, $function); - if ($function.isInline) - MESSAGE("", " The Inline function " + $function.name + " is ignored", ""); - else - memoiFunctions[currentfunction] = findmemoizable($file, $function, $body); - end -end - - -/** - * It builts the Static Call Graph of the application in a global variable callGraph. - * And in case of a reference to a known pure function, the information is stored in the - * global variable memoiFunctions["pure finction"] = STATE.YES that expresses - * that the pure fonction is memoizable. - * */ -aspectdef BuildStaticCallGraph - - TRACE_BEGIN_OP(" StaticCallGraph "); - select file.function.stmt.call end - apply - TRACE("StaticCallGraph for " + $call.name ); - source = getidfunction($file, $function); - var $def = $call.definition; - if ($def !== undefined) { - if (! $def.isInline) - { - target = getIdId($def.getAncestor("file").name, $def.line); - callGraph.inc(source, target); - } - } - else - if (! declaredAsPure($call.name)) - memoiFunctions[ source ]= STATE.NO; - end - TRACE_END_OP( "StaticCallGraph "); -end - - -/** - * Prints the detected memoizable functions/methods, elements of the input parameter. - * @param {string[]} memoiFuncs. An element is a string Filename%Line. - * */ -aspectdef printMemoizables -input - memoiFuncs -end - console.log( '\n \n Memoizable functions { ' ); - select file.function end - apply - currentfunction = getidfunction($file, $function); - if (memoiFuncs.indexOf(currentfunction) >=0) - { - var T = currentfunction.split('%'); - if ($function.astName === 'CXXMethodDecl') mf = "method" ; else mf="function"; - console.log( "\t * The " + mf + ' ' + $function.name + " at line " + T[1] + " of the file " + T[0]); - } - end - console.log( '}\n \n'); -end - -/** - * Memoizes the elements of the array memoiFuncs with the default parameters. - * @param {string[]} memoiFuncs. An element is a string Filename%Line. - * */ -aspectdef MemoizeElements -input - memoiFuncs -end - select file.function end - apply - currentfunction = getidfunction($file, $function); - if (memoiFuncs.indexOf(currentfunction) >=0) - { - // Perhaps add a test "if public" : $function.isPublic. - if ($function.astName === 'CXXMethodDecl') { - - var nbparams = checkHeaderMemoizableMethod($function); - var functionType = $function.functionType; - var tt_return = functionType.returnType; - var aClass = $function.record.name; - var aMethod = $function.name; - var vtype = getMemoType(tt_return); - GenCode_CPP_Memoization(aClass, aMethod, vtype, nbparams, 'none', 'no', 'none', 'no', 0, DEFAULT_TABSIZE); - call CPP_UpdateCallMemoization(aClass, aMethod, vtype, nbparams); - } - else // Function - call Memoize_Function($function.name); - } - end -end - - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara deleted file mode 100644 index 059b6eca0b..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara +++ /dev/null @@ -1,152 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ - -import antarex.utils.IdentReferences; - -/** A function/method is memoizable iff - * 1) The header "vtype func(parameters)" satisfies : - * - for all p of parameters type(p)=vtype and 1 <= |parameters| <=3 - * - returns a vtype value. - * 2) It refers only local variables and constants (pure functions), and no pointers. - */ -function findmemoizable($file, $function, $body){ - currentfunction = getidfunction($file, $function); - var v = memoiFunctions[currentfunction]; - if (v === STATE.NO) return v; - if (v === STATE.YES) return v; - if (v === STATE.VISITED) - { - TRACE(" >>>>> CYCLIC GRAPH DETECTED"); - return STATE.NO; // cyclic graph - } - - var nbparams = checkHeaderMemoizable($function); - if ( nbparams < 0 ) { - MESSAGE( " >>>>> ", currentfunction + " is NOT MEMOIZABLE: unexpected interface.", ""); - v = STATE.NO; - } - else { - TRACE( " STATE.VISITED for " + currentfunction); - memoiFunctions[currentfunction] = STATE.VISITED; - v = checkBodyMemoizable($file, $function, $body); - if (v === STATE.NO) - MESSAGE( " >>>>> ", currentfunction + " is NOT MEMOIZABLE: unexpected references in the body.", ""); - } - memoiFunctions[currentfunction] = v; - return v; -} - -/** - * @return true if $name is declared as a pure function, false otherwise. - * Currently, restricted to the pure functions of math.h and those declared in SomePredefinedPureFunctions. - */ -function declaredAsPure ($name) -{ - // predefined memoizable function - if (MathMemoizableFuncs.indexOf($name) >=0) return true; - if (SomePredefinedPureFunctions.indexOf($name) >=0) return true; - return false; -} - -/** - * @return the current number of memoizable functions. - * */ -function getNbMemoizable(){ - var n = 0; - for (f in memoiFunctions) { - var code = memoiFunctions[f]; - if ( code === STATE.YES) n++; - } - return n; -} - - -/** - * @return the string $id%$suff - * */ -function getIdId( $id, $suff) { - return $id + '%' + $suff; -} - -function getidfunction( $file, $function) { - return getIdId($file.name, $function.line); -} - -/** - * @return - * - STATE.YES if the successors of id are memoizable. - * - STATE.NO if one of the sucessors is not memoizable, or in case of circuit. - * - STATE.UNDEF if the status of one of the successors is undefined (ie not yet fixed). -*/ -function successorsAreMemoizable(id) -{ - for (idSucc in callGraph[id]) { - var code = memoiFunctions[ idSucc ]; - TRACE ( " °°°°°°° successorsAreMemoizable ( " + id + ") = " + idSucc ); - if ( code === STATE.NO) return code; - if ( code === STATE.VISITED) return STATE.NO; // circuit. - if ( code === STATE.UNDEF) return code; - } - return STATE.YES; -} - -/** - * @return STATE.YES if the method/function $function defined in the file $file - * is memoizable, STATE.NO or STATE.UNDEF otherwise. - * A function/method is memoizable: - * - if the referenced functions/methods are memoizable - * - and the $body of $function refers only local variables and constants (pure functions). - * */ -function checkBodyMemoizable($file, $function, $body) -{ - currentfunction = getidfunction($file, $function); - var code = successorsAreMemoizable(currentfunction); - TRACE( " CheckBodyMemoizable:: successorsAreMemoizable for " + currentfunction + " returns " + STRSTATE[code]); - if (code === STATE.YES) { - // If all referenced functions are memoizable, it must reference only local variables/constants - if (! BodyReferencesLocalsOrConstants($function, $body)) { - TRACE("checkBodyMemoizable::BodyReferencesLocalsOrConstants return false for " + currentfunction); - code =STATE.NO; - } - } - return code; -} - - -/** - * @return "true" if $body of $function references only local variables or constant objects, "false" otherwise. - * */ -function BodyReferencesLocalsOrConstants($function, $body) -{ - var $FunctionDecls=[]; - var $varDecls=[]; - var $externDecls = []; - getRefVarsInStmt($body, $varDecls, $FunctionDecls); - for (var $aDecl of $varDecls) { - if (isOutsideDeclaration($aDecl, $function)) - if (! isAConstantDecl($aDecl)) return false; - } - return true; -} - - -/** - * Debug. Prints the gathered information of a graph ( callGraph) to the console. - * */ -function printCallGraph(callGraph) { - if ( is_mode_trace_on()) { - console.log('Static call graph {\n'); - for (f in callGraph) { - for (c in callGraph[f]) { - console.log('\t' + f + '->' + c + ' [label="' + callGraph[f][c] + '"];'); - } - } - console.log('}'); - } -} - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara_save b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara_save deleted file mode 100644 index 7503efb4bf..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationAutoFuncs.lara_save +++ /dev/null @@ -1,299 +0,0 @@ - -import antarex.utils.IdentReferences; - -/** A function/method is memoizable iff - * 1) The header "vtype func(parameters)" satisfies : - * - for all p of parameters type(p)=vtype and 1 <= |parameters| <=3 - * - returns a vtype value. - * 2) It refers only local variables and constants (pure functions), and no pointers. - */ -function findmemoizable($file, $function, $body){ - currentfunction = getidfunction($file, $function); - var v = memoiFunctions[currentfunction]; - if (v === STATE.NO) return v; - if (v === STATE.YES) return v; - if (v === STATE.VISITED) - { - TRACE(" >>>>> CYCLIC GRAPH DETECTED"); - return STATE.NO; // cyclic graph - } - - var nbparams = checkHeaderMemoizable($function); - if ( nbparams < 0 ) { - MESSAGE( " >>>>> ", currentfunction + " is NOT MEMOIZABLE: unexpected interface.", ""); - v = STATE.NO; - } - else { - TRACE( " STATE.VISITED for " + currentfunction); - memoiFunctions[currentfunction] = STATE.VISITED; - v = checkBodyMemoizable($file, $function, $body); - if (v === STATE.NO) - MESSAGE( " >>>>> ", currentfunction + " is NOT MEMOIZABLE: unexpected references in the body.", ""); - } - memoiFunctions[currentfunction] = v; - return v; -} - -/** - * @return true if $name is declared as a pure function, false otherwise. - * Currently, restricted to the pure functions of math.h and those declared in SomePredefinedPureFunctions. - */ -function declaredAsPure ($name) -{ - // predefined memoizable function - if (MathMemoizableFuncs.indexOf($name) >=0) return true; - if (SomePredefinedPureFunctions.indexOf($name) >=0) return true; - return false; -} - -/** - * @return the current number of memoizable functions. - * */ -function getNbMemoizable(){ - var n = 0; - for (f in memoiFunctions) { - var code = memoiFunctions[f]; - if ( code === STATE.YES) n++; - } - return n; -} - - -/** - * @return the string $id%$suff - * */ -function getIdId( $id, $suff) { - return $id + '%' + $suff; -} - -function getidfunction( $file, $function) { - return getIdId($file.name, $function.line); -} - -/** - * @return - * - STATE.YES if the successors of id are memoizable. - * - STATE.NO if one of the sucessors is not memoizable, or in case of circuit. - * - STATE.UNDEF if the status of one of the successors is undefined (ie not yet fixed). -*/ -function successorsAreMemoizable(id) -{ - for (idSucc in callGraph[id]) { - var code = memoiFunctions[ idSucc ]; - TRACE ( " °°°°°°° successorsAreMemoizable ( " + id + ") = " + idSucc ); - if ( code === STATE.NO) return code; - if ( code === STATE.VISITED) return STATE.NO; // circuit. - if ( code === STATE.UNDEF) return code; - } - return STATE.YES; -} - -/** - * @return STATE.YES if the method/function $function defined in the file $file - * is memoizable, STATE.NO or STATE.UNDEF otherwise. - * A function/method is memoizable: - * - if the referenced functions/methods are memoizable - * - and the $body of $function refers only local variables and constants (pure functions). - * */ -function checkBodyMemoizable($file, $function, $body) -{ - currentfunction = getidfunction($file, $function); - var code = successorsAreMemoizable(currentfunction); - TRACE( " CheckBodyMemoizable:: successorsAreMemoizable for " + currentfunction + " returns " + STRSTATE[code]); - if (code === STATE.YES) { - // If all referenced functions are memoizable, it must reference only local variables/constants - if (! BodyReferencesLocalsOrConstants($function, $body)) { - TRACE("checkBodyMemoizable::BodyReferencesLocalsOrConstants return false for " + currentfunction); - code =STATE.NO; - } - } - return code; -} - - -/** - * @return "true" if $body of $function references only local variables or constant objects, "false" otherwise. - * */ -function BodyReferencesLocalsOrConstants($function, $body) -{ - var $varDecls=[]; - var $externDecls = []; - getRefVarsInStmt($body, $varDecls); - for (var $aDecl of $varDecls) { - if (isOutsideDeclaration($aDecl, $function)) - if (! isAConstantDecl($aDecl)) return false; - } - return true; -} - - -/** - * @return "true" if $body of $function references only local variables or constant objects, "false" otherwise. - * */ -function BodyReferencesLocalsOrConstants__OLD($function, $body) -{ - for (var x = 0; x < $body.astNumChildren ; x++) { - var $stmt = $body.astChild(x); - if ( ! StatementReferencesLocalsOrConstants( $stmt, $function)) return false; - } - return true; -} - -/** - * @return "true" if a $statement references only local variables of the function $function or - * constant objects, "false" otherwise. - * */ -function StatementReferencesLocalsOrConstants($statement, $function) { - var $astname = $statement.astName; - switch ($astname) { - case 'NullStmt': - case 'NullDecl': - return true; - - case 'ExprStmt': - case 'ReturnStmt': - return exprReferencesLocalsOrConstants($statement.astChild(0), $function); - - case 'IfStmt': - var $e = $statement.astChild(0); // condition - if ( ! exprReferencesLocalsOrConstants($e, $function)) return false; - for ( var i = 1; i < $statement.astNumChildren; i++) - { - var $e = $statement.astChild(i); - TRACE( $astname + ", Decl [ " + i + " ] = " + $e.code + ", joinpointType =" + $e.joinPointType); - if ( ! StatementReferencesLocalsOrConstants($e, $function)) return false; - } - return true; - - case 'DeclStmt': - for ( var i = 0; i < $statement.astNumChildren; i++) - { - var $e = $statement.astChild(i); - TRACE( $astname + ", Decl [ " + i + " ] = " + $e.code + ", joinpointType =" + $e.joinPointType); - if ( ! exprReferencesLocalsOrConstants($e, $function)) return false; - } - return true; - - case 'CompoundStmt': - case 'ForStmt': - case 'WhileStmt': - case 'CXXForRangeStmt': // for(auto edgeId : Pred[w]) { } - for ( var i = 0; i < $statement.astNumChildren; i++) { - var $e = $statement.astChild(i); - TRACE( $astname + ", child [ " + i + ' ] = ' + $e.astName); - if (! StatementReferencesLocalsOrConstants($e, $function)) return false; - } - return true; - - case 'WrapperStmt': // comment. - case 'CXXOperatorCallExpr': - return true; - - default: - NYI(" StatementReferencesLocalsOrConstants:: " + $astname); - } - return false; -} - -/** - * @return "true" if an expression $expr references only local variables of $function, or constant objects, - * "false" otherwise. - * */ -function exprReferencesLocalsOrConstants($expr, $function) { - // binaryOp unaryOp varref call arrayAccess expression memberAccess - // vardecl memberCall stmCall childExpr - var $jpt = $expr.joinPointType; - TRACE(" exprReferencesLocalsOrConstants = " + $expr.code + "; joinPointType = " + $jpt); - switch ($jpt) { - case 'binaryOp': - var $e1 = $expr.left; - TRACE (" binaryOp e1 joinPointType = " + $e1.joinPointType ); - if (! exprReferencesLocalsOrConstants($e1, $function)) return false; - var $e2 = $expr.right; - TRACE (" binaryOp e2 joinPointType = " + $e2.joinPointType ); - return exprReferencesLocalsOrConstants($e2, $function); - - case 'unaryOp': - var $e1 = $expr.operand; - TRACE(" unaryOp operand joinPointType = " + $e1.joinPointType ); - return exprReferencesLocalsOrConstants($e1, $function); - - - case 'arrayAccess': - case 'expression': - for (var i = 0; i < $expr.astNumChildren; i++){ - if ( ! exprReferencesLocalsOrConstants($expr.astChild(i), $function)) return false; - } - return true; - - case 'call': - for (var i = 1; i < $expr.astNumChildren; i++) { - if ( ! exprReferencesLocalsOrConstants($expr.astChild(i), $function)) return false; - } - return true; - - case 'varref': - var $decl = $expr.vardecl; - if (isConstantDeclaration($decl)) { - TRACE(" isConstantDeclaration return true for " + $decl.code); - return true; - } - var $ancestorFile = $decl.ancestor("function"); - if ( $ancestorFile === undefined ) $ancestorFile = $decl.ancestor("method"); - if ( $ancestorFile === undefined ) return false; // a global. - return ($ancestorFile.location === $function.location); - - case 'memberCall': // obj.m - var $e = $expr.base; - TRACE(" case memberCall " + $e.code); - if ( $e.code === 'this') return false; - return exprReferencesLocalsOrConstants($e , $function); - - case 'memberAccess': // obj-> m - var $e = $expr.base; - TRACE( " case memberAccess. base = " + $e.code); - if ( $e.code === 'this') return false; - return exprReferencesLocalsOrConstants($e , $function); - - case 'vardecl': - TRACE(" case vardecl = " + $expr.code); - if ( $expr.init === undefined ) return true; - return exprReferencesLocalsOrConstants($expr.init, $function); - - case 'deleteExpr': - case 'newExpr': - return false; - - default: - NYI(" exprReferencesLocalsOrConstants::" + ", joinPointType = " + $jpt + ", code = " + $expr.code); - } - return false; -} - -/** - * @return "true" if $decl is a declaration of a constant, "false" otherwise. - * */ -function isConstantDeclaration($decl) -{ - var $vardeclType = $decl.type; - // console.log(" isConstantDeclaration :: vtype = " + $vardeclType.code); - return ($vardeclType.astIsInstance("QualType")); - //return ( $vardeclType.kind === "QualType"); -} - - -/** - * Debug. Prints the gathered information of a graph ( callGraph) to the console. - * */ -function printCallGraph(callGraph) { - if ( is_mode_trace_on()) { - console.log('Static call graph {\n'); - for (f in callGraph) { - for (c in callGraph[f]) { - console.log('\t' + f + '->' + c + ' [label="' + callGraph[f][c] + '"];'); - } - } - console.log('}'); - } -} - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationC.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationC.lara deleted file mode 100644 index 739715ac9f..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationC.lara +++ /dev/null @@ -1,96 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ -import antarex.utils.messages; - -/** Memoizes a C user function with default arguments. - * @param (func) the name of the C function to memoize - * It calls Memoize_Function_ARGS(cfunc, 'none', 'no', 'none','no', 0, DEFAULT_TABSIZE); - * For more details, see Memoize_Function_ARGS. - * For a function of math.h, use Memoize_MathFunction. - * */ -aspectdef Memoize_Function -input - cfunc -end - call Memoize_Function_ARGS(cfunc, 'none', 'no', 'none','no', 0, DEFAULT_TABSIZE); -end - -/** - * Memoizes a C function with arguments. - * @param {string} cfunc: the name of the function to memoize. - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} AlwaysReplace: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - - * First, it searches the existence of such a function in the application. - * In case of success, it controls that parameters and the type of the arguments are conformed with the - * INRIA memoization library. Then, it adds (function GenCode_C_Memoization) the informations, - * required for generating the memoization library, in a file called "funs-static.def". - * Finally, it updates the user code by replacing a reference to the memoized - * method by a reference to the wrapper function. - * */ -aspectdef Memoize_Function_ARGS -input - cfunc, // C function to memoize. - fileToLoad, // name of the file to load for init the table OR none - FullOffLine, // yes|no yes : full off lime memoization (requires a fileToLoad) - FileToSave, // name of the file to save the data of the table OR none - AlwaysReplace, //yes|no , in case of collisions, the table is updated. - precision, // number of bit to delete (float/double), 0 for int - tsize // size of the table. -end - TRACE_BEGIN_OP(" >>> Memoize_Function_ARGS: " + cfunc); - var found = false; - var memoizable = false; - // selecting the body to exclude the header declaration. - select function{cfunc}.body end - apply - found = true; - var vtype = getMemoType($function.type); - nbparams = checkHeaderMemoizableFunction($function); - memoizable = nbparams>0; - end - - if (! found) { - WARNING("the function " + cfunc + " does not exist !"); - } - else if (! memoizable) { - WARNING("the function " + cfunc + " is not memoizable !"); - } - else { - TRACE(" The function " + cfunc + " is memoizable !"); - GenCode_C_Memoization(cfunc, vtype, nbparams, fileToLoad, FullOffLine, FileToSave, - AlwaysReplace, precision, tsize); - call C_UpdateCallMemoization(cfunc); - } -end - - -/** - * This aspect adds the declaration of the header of the wrapper - * in the files of the applications that reference a memoized function (cfunc). - * @param {string} cfunc: name of a memoized function. - * */ -aspectdef C_UpdateCallMemoization -input - cfunc -end - select function.call end - apply - if ($call.name === cfunc) { - $function.exec setName(getFuncWrapperName(cfunc)); - var $file = $call.getAncestor('file'); - $file.exec addInclude(FILENAME_MEMOI_WRAPPERS, false); - } - end -end - - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationCXX.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationCXX.lara deleted file mode 100644 index 0711e6dbf3..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationCXX.lara +++ /dev/null @@ -1,232 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ - -/** Memoizes a method of a class with default parameters. - * @param {string} aClass: the name of a class. - * @param {string} aMethod: the name of a method. - * It calls - * Memoize_Method_ARGS(aClass, aMethod, 'none', 'no', 'none','no', 0, DEFAULT_TABSIZE)). - * @see{Memoize_Method_ARGS()}. - * */ -aspectdef Memoize_Method -input - aClass, // name of a class - aMethod // name of a method of the class aClass -end - call Memoize_Method_ARGS(aClass, aMethod, 'none', 'no', 'none','no', 0, DEFAULT_TABSIZE); -end - -/** - * Memoizes a method of a class with given parameters. - * @param {string} aClass: the name of a class. - * @param {string} aMethod: the name of a method. - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} AlwaysReplace: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - * - * First, it searches the existence of such a method in the application. - * In case of success, it controls that parameters and the type of the arguments are conformed for the - * INRIA memoization library. Then, it adds (see GenCode_CPP_Memoization()) the informations, - * required for generating the memoization library, in a file called "funs-static.def". - * Finally, it updates the user code by replacing a reference to the memoized method by a reference - * to the wrapper function. The wrapper is declared as a new method in the class. - * */ -aspectdef Memoize_Method_ARGS -input - aClass, // name of a class - aMethod, // name of a method of the class aClass - fileToLoad, // name of the file to load for init the table OR none - FullOffLine, // yes for a fully offline (pre-load table and no update) - FileToSave, // name of the file to save the data of the table OR none - updateTableOnCollision, // = none , in case of collisions, the table is not updated. - precision, // number of bits to delete for approximation. - tsize // size of the internal table. -end - call gm: getMethods(aClass, aMethod); - var tmethods = gm.tabOfMethods; - var nb= tmethods.length; - if (nb == 0) { - WARNING("The method " + aMethod + " does not exist in the class" + aClass); - return; - } - if (nb > 1) - { - WARNING("Several methods called " + aMethod + " in the class " + aClass ); - WARNING("Details: ------------------------- "); - for (var i=0; i< nb; i++) { - println ( "\t \t" + tmethods[i].getDeclaration(true) ); // functionType.code); - } - WARNING(" *** Please use the Memoize_Method_overloading aspect to be more precise"); - return; - } - TRACE_BEGIN_OP(" >>> Memoize_Function++, method " + aMethod + " of the class " + aClass); - var memoizable = false, nbparams; - - select class{aClass}.method{aMethod} end - apply - TRACE(" name of the class is = " + getClassNameMethod($method)); - nbparams = checkHeaderMemoizableMethod($method); - memoizable = (nbparams>0); - TRACE ( "NB PARAMS = " + nbparams); - var functionType = $method.functionType; - var tt_return = functionType.returnType; - var vtype = getMemoType(tt_return); - end - if (! memoizable) - WARNING("the method " + aMethod + " is not memoizable !"); - else { - TRACE(" The method " + aMethod + " is memoizable !"); - var vtype = tt_return.code; - GenCode_CPP_Memoization(aClass, aMethod, vtype, nbparams, fileToLoad, FullOffLine, FileToSave, updateTableOnCollision, precision, tsize); - call CPP_UpdateCallMemoization(aClass, aMethod, vtype, nbparams); - } -end - -/** - * Memoizes a method of a class giving the type and the number of inputs parameters, - * required for solving the overloading of C++. - * @param {string} aClass: the name of a class. - * @param {string} aMethod: the name of a method. - * @param {string} pType: the type of the arguments and returned value of the method. - * @param {int} nbArgs: number of input arguments. - * It calls Memoize_Method_overloading_ARGS with default arguments: - Memoize_Method_overloading_ARGS(aClass, aMethod, pType, nbArgs, - 'none', 'no', 'none', 'no',0, DEFAULT_TABSIZE); - @see{Memoize_Method_overloading_ARGS} - */ -aspectdef Memoize_Method_overloading -input - aClass, // name of a class - aMethod, // name of a method of the class aClass - pType, // The name of the selected type (required when overloading) - nbArgs // the number of parameters of the method (required when overloading). -end - -call Memoize_Method_overloading_ARGS(aClass, aMethod, pType, nbArgs, 'none', 'no', 'none', 'no',0, DEFAULT_TABSIZE); -end - -/** - * Memoizes a method of a class giving the type and the number of inputs parameters, - * required for solving the overloading of C++. - * @param {string} aClass: the name of a class. - * @param {string} aMethod: the name of a method. - * @param {string} pType: the type of the arguments and returned value of the method. - * @param {int} nbArgs: number of input arguments. - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} AlwaysReplace: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - - -*/ -aspectdef Memoize_Method_overloading_ARGS -input - aClass, // name of a class - aMethod, // name of a method of the class aClass - pType, // The name of the selected type (required when overloading) - nbArgs, // the number of parameters of the method (required when overloading). - fileToLoad, // name of the file to load for init the table OR none - FullOffLine, // yes for a fully offline (pre-load table and no update) - FileToSave, // name of the file to save the data of the table OR none - updateTableOnCollision, // = none , in case of collisions, the table is not updated. - precision, // number of bits to delete for approximation. - tsize // size of the internal table. -end - // Control on the parameters of the aspect. - if ((nbArgs < 0) || (nbArgs >3)) { - WARNING("Unexpected value " + nbArgs + " for the number of arguments. It must be in [1,3]"); - return; - } - - var MethodToMemoize, found=false; - select class{aClass}.method{aMethod} end - apply - if (! found) { - TRACE(" name of the class is = " + getClassNameMethod($method)); - found = isTheSelectedMethod($method, nbArgs, pType); - if (found) MethodToMemoize=$method; - } - end - - if (!found) { - WARNING("Memoize_Method_overloading: The method " + aMethod + " of the class " + aClass + - " with " + nbArgs + " arguments" + " of type "+ pType + " does not exist!"); - } - else { - - TRACE(" Memoize_Method_overloading: The method " + aMethod + " is memoizable !"); - GenCode_CPP_Memoization(aClass, aMethod, pType, nbArgs, fileToLoad, FullOffLine, FileToSave, updateTableOnCollision, precision, tsize); - call CPP_UpdateCallMemoization(aClass, aMethod, pType, nbArgs); - } -end - -aspectdef getMethods -input - aClass, // name of a class - aMethod // name of a method of the class aClass -end -output - tabOfMethods=[] -end - select class{aClass}.method{aMethod} end - apply - tabOfMethods.push($method); - end -end - - -aspectdef CPP_UpdateCallMemoization - input aClass, aMethod, vtype, nbparams end - - var alreadyDeclared = false; - var wrapper = getFuncWrapperName(aMethod); - - select class{aClass}.method{wrapper} end - apply - if (!alreadyDeclared) - alreadyDeclared = isTheSelectedMethod($method, nbparams, vtype); - end - if ( alreadyDeclared ) return; - var done = false; - var locationOfTheselectedMethod; - select class{aClass}.method{aMethod} end - apply - if (!done) - if (isTheSelectedMethod($method, nbparams, vtype)) - { - locationOfTheselectedMethod = $method.location; - done = true; - vparam = getDeclParameters(vtype, nbparams); - var newDecl = vtype + ' ' + wrapper + " ( " + vparam + " ); "; - $method.insert before(newDecl); - } - end - - select call{aMethod} end - apply - if ($call.isMemberAccess) { - // console.log("MemberAccess is = " + $call.code + " $call.definition=" + $call.definition + " --- Call declaration:" + $call.declaration); - // not a reference to a _wrapper - if ($call.definition !== undefined) - { - console.log("Call definition:" + $call.definition.location); - if ($call.declaration.location === locationOfTheselectedMethod ) - $call.exec setName(getFuncWrapperName(aMethod)); - } - } - end -end - - - - diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationLibFuncs.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationLibFuncs.lara deleted file mode 100644 index 87b7d4de1a..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationLibFuncs.lara +++ /dev/null @@ -1,413 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ - -import clava.ClavaJoinPoints; -import antarex.utils.messages; - -var wrapperSuffix = '_wrapper'; - - -/** - * Initializes the memoization by adding two files to Clava: - * - One (FILENAME_MEMOI_DEFS) will contains the definitions used to produce the memoization library. - * - The other one (FILENAME_EXPOSED_VARS) will contains the exposed variables. - * */ -function initFileMemoization(){ - if (FIRST_MEMOIZATION) { - // Declaration of the file for the INRIA memoization library. - $newFileJp_MEMOI_DEFS = ClavaJoinPoints.file(FILENAME_MEMOI_DEFS, filepath); - Clava.addFile($newFileJp_MEMOI_DEFS); - // Declaration of the exposed variables. - $newFileJp_MEMOI_MARGOT = ClavaJoinPoints.file(FILENAME_EXPOSED_VARS, filepath); - Clava.addFile($newFileJp_MEMOI_MARGOT); - // GenCodeForMargot("toto"); - FIRST_MEMOIZATION = false; - } -} - - -/** - * @return the string code of the type ($vtype) for - * - a predefined one, - * - a typedef built on a predefined one, - - or a const type. - * or "NO" otherwise. -*/ -function getMemoType($vtype) { - // var typeKind = $vtype.kind; - - // if (typeKind === "BuiltinType") return $vtype.code; - if ($vtype.astIsInstance("BuiltinType")) return $vtype.code; - - //if (typeKind === "TypedefType") { - if ($vtype.astIsInstance("TypedefType")) { - var $unwrappedType = $vtype.unwrap; - if ($unwrappedType !== undefined) return getMemoType($unwrappedType); - } - else - // if (typeKind === "QualType") - if ($vtype.astIsInstance("QualType")) - return getMemoType($vtype.getAstChild(0)); // TYPE const - return "NO"; - } - - -/** - * Testing if the header of a function satisfies the conditions for the memoization: - * - the number of arguments is in the interval [1,3] - * - all the arguments ans the returned value have the same - * type restricted to the types tested in getMemoType(). - * @return the number of parameters or -1 if the C function is not memoizable, - * @see{getMemoType()}. -*/ -function checkHeaderMemoizableFunction($function) -{ - // TODO: to be merge with checkHeaderMemoizableMethod - var functionType = $function.type; - // var typeKind = functionType.kind; - var memoizable= false; - var nbparams = 0; - var vtype = getMemoType(functionType); - if (memoizableTypes.indexOf(vtype) > -1) { - var v = $function.params; - var b = true; - for (var x of v) { - if ( vtype !== getMemoType(x.type)) b=false; - nbparams++; - } - memoizable = b && (( nbparams == 1 ) || (nbparams == 2) || (nbparams == 3)); - } - if (!memoizable) nbparams= -1; - return nbparams; -} - -/** - * Testing if the header of a method ($method) satisfies the conditions for the memoization: - * - the number of arguments is in the interval [1,3] - * - all the arguments ans the returned value have the same - * type restricted to the types tested in getMemoType(). - * @return the number of parameters or -1 if the C function is not memoizable, - * @see{getMemoType()}. - -*/ -function checkHeaderMemoizableMethod($method) -{ - // TODO: to be merge with checkHeaderMemoizableFunction - var memoizable= false; - var functionType = $method.functionType; - var tt_return = functionType.returnType; - // var typeKind = tt_return.kind; - var nbparams = 0; - var vtype = getMemoType(tt_return); - - if (memoizableTypes.indexOf(vtype) > -1) { - var v = functionType.paramTypes; - var b = true; - for (var x of v) { - if ( vtype !== getMemoType(x)) b=false; - nbparams++; - } - memoizable = b && (( nbparams == 1 ) || (nbparams == 2) || (nbparams == 3) ); - } - if (!memoizable) nbparams = -1; - return nbparams; -} - -/** - * Testing if the header of a function or method ($fm) satisfies the conditions for the memoization. - * @return the number of parameters of $fm, or -1 if it is not memoizable. - */ -function checkHeaderMemoizable($fm) -{ - if ($fm.astName === 'CXXMethodDecl') return checkHeaderMemoizableMethod($fm); - return checkHeaderMemoizableFunction($fm); -} - - -/** - * @return an array (T) of 2 strings - * - T[0] contains the mangled name of a function or method (fmName) - * - T[1] contains the informations of the associated wrapper function. - * To produce these mangled names, it uses the className( "" for a function), - * the name of the type (typeName) and the numbers of arguments (nbparams). - * The rules for the mangling are compiler dependent. - * */ -function getMangledInfos(className, fmName, typeName, nbparams) { - var tab = []; - if ( className === "") { // C code - tab[1] = getFuncWrapperName(fmName); - if ( manglingForC ) { - var par_mangling = getManglingTypeFor(typeName, nbparams); - var prefix = "_Z"; - tab[0] = prefix + fmName.length + fmName + par_mangling; - } - else - tab[0] = fmName; - } - else { - // C++ code - var par_mangling = "E" + getManglingTypeFor(typeName, nbparams); - var classInfo = className.length + className; - var prefix = "_ZN"; - tab[0] = prefix + classInfo + fmName.length + fmName + par_mangling; - var wrapper = getFuncWrapperName(fmName); - tab[1] = prefix + classInfo + wrapper.length + wrapper + par_mangling; - } - return tab; -} - -/** - * @return the string composed of nbparams times vtype separated by a comma. - * */ -function getDeclParameters(vtype, nbparams) { - var vparam = vtype; - var nb=1; - while (nb != nbparams) { - vparam = vparam + " , " + vtype; - nb++; - } - return vparam; -} - -/** - * @return the name of the wrapper of func. - * */ -function getFuncWrapperName(func){ - return func+wrapperSuffix; -} - -/** - * @param {jointpoint $file} vfile. - * @param {array of string} ExposedVariables. - * It generates in the file (vfile) the exposed variables of ExposedVariables. - * The variables that can be modified at run time (margot or other tool). - * */ -function genExposedVariables(vfile, ExposedVariables) { - // Used only in Memoization.lara. - vfile.exec insertBefore( "}"); - for (var avar of ExposedVariables) { - vfile.exec insertBefore( varExposedToMARGOT + avar + "= B;"); - } - vfile.exec insertBefore( "\n \n void INRIA_memoInit(int B) { " ); - - var ExposedVariable; - for (var avar of ExposedVariables) { - ExposedVariable = "int " + varExposedToMARGOT + avar + " = 1;\n"; - vfile.exec insertBefore(ExposedVariable); - ExposedVariable = "extern int _alwaysReplace" + avar + ", _FullyOffLine" + avar + ";"; - vfile.exec insertBefore(ExposedVariable); - } -} - -/** - * This function adds the declaration of the predefined __EXTERN__ keyword used - * to specify external C function with a C++ compiler. - * */ -function genExternSpec(vfile){ - // Used only in Memoization.lara. - vfile.exec insertBefore%{ -#ifdef __cplusplus -#define __EXTERN__ extern "C" -#else -#define __EXTERN__ -#endif -}%; - } - - -//----- Functions for MemoizationMath.lara. - -var MathMemoizableFuncs =[ - /* double, 1 parameter */ - "acos", "acosh", "asin", "asinh", "atan", "atanh", - "cbrt", "ceil", "cos", "cosh", "erf", "erfc", "exp", "exp2", "expm1", - "fabs", "floor", "j0", "j1", "lgamma", "log", "log10", "log1p", "log2", - "logb", "nearbyint", "rint", "round", "sin", "sinh", "sqrt", "tan", "tanh", "tgamma", "trunc", - /* float, 1 parameter */ - "acosf", "acoshf", "asinf", "asinhf", "atanf", "atanhf", - "cbrtf", "ceilf", "cosf", "coshf", "erfcf", "erff", "exp2f", "expf", "expm1f", - "fabsf", "floorf", "lgammaf", "log10f", "log1pf", "log2f", "logbf", "logf", "nearbyintf", - "rintf", "roundf", "sinf", "sinhf", "sqrtf", "tanf", "tanhf", "tgammaf", "truncf", - /* double,2 parameters */ - "atan2", "copysign", "fdim", "fmax", "fmin", "fmod", "hypot", "nextafter", "pow", "remainder", "scalb", - /* float, 2 parameters */ - "atan2f", "copysignf", "fdimf", "fmaxf", "fminf", "fmodf", "hypotf", "nextafterf", "powf", "remainderf" -]; - -/** - * @return the code of the definition to add in the "funs-static.def" file for a math function, - * or 'none' if aFunc is not a memoizable math function. - * @param {string} aFunc the name of the math function. -*/ -function getKindMathFunc(aFunc) { - var index = MathMemoizableFuncs.indexOf(aFunc); - if (index < 0) return "none"; - var prefix = "DEF(" + CodeLanguages.indexOf("MF") + ", " + aFunc + ", " + getFuncWrapperName(aFunc); - if ( 0 <= index && index <= 34 ) return prefix + ", 1, double"; - if ( 35 <= index && index <= 67 ) return prefix + ", 1, float"; - if ( 67 <= index && index <= 79 ) return prefix + ", 2, double"; - if ( 79 <= index && index <= 89 ) return prefix + ", 2, float"; -} - -/** - * @returns the code of the header for the wrapper math function(aFunc). - * */ -function getWrapperDeclMathFunc(aFunc) { - var index = MathMemoizableFuncs.indexOf(aFunc); - if (index < 0) return "none"; - if ( 0 <= index && index <= 34 ) return "double" + " " + getFuncWrapperName(aFunc) + "(double);"; - if ( 35 <= index && index <= 67 ) return "float" + " " + getFuncWrapperName(aFunc) + "(float);"; - if ( 67 <= index && index <= 79 ) return "double" + " " + getFuncWrapperName(aFunc) + "(double, double);"; - if ( 79 <= index && index <= 89 ) return "float" + " " + getFuncWrapperName(aFunc) + "(float, float);"; - return "XXXXX"; // to have an compiling error. -} - -// ---- Functions referenced in MemoizationC.lara - -/** - * Initializes the wrapper file of the C memoized functions. - * */ -function initFileWrappers(){ - if (FIRST_MEMOI_C) { - $newFileJp_MEMOI_wrappers = ClavaJoinPoints.file(FILENAME_MEMOI_WRAPPERS, filepath); - Clava.addFile($newFileJp_MEMOI_wrappers); - FIRST_MEMOI_C = false; - } -} -/** - * Generates a DEF entry in the FILENAME_MEMOI_DEFS file for a C function, and declares the exposed variables. - * Such a definition will be used for the generation of the memoization library. - - * @param {string} functionName: the name of the function to memoize. - * @param {string} typeName: the type of the argument (equal to the type of the returned value). - * @param {int} nbparams: the number of arguments of the function (input argument). - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} updateTableOnCollision: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - - * */ -function GenCode_C_Memoization(functionName, typeName, nbparams, fileToLoad, FullOffLine, FileToSave, updateTableOnCollision, approx, tsize) -{ - /* 1) Generate the definition of a function (functionName) - of type typeName with nbparams parmeters for the memoization. - N args : DEF(functionName, N, typeName, approx, fileToLoad, FullOffLine, FileToSave, updateTableOnCollision, TableSize) - - 2) Generates the declaration of the corresponding wrapper in the header file. - 3) Generates the declaration of the corresponding settings for mARGOt. - */ - var memoiDef; - TRACE(" FunctionName = " + functionName + " typeName = " + typeName + " nbParams = " + nbparams); - initFileMemoization(); - initFileWrappers(); - var infoMangling = getMangledInfos("", functionName, typeName, nbparams); - - // Generate the DEF code for memoization (required by the INRIA memoization package) - strNb =nbparams.toString(); - var prefix = "DEF(" + CodeLanguages.indexOf("C") + ", " + infoMangling[0] + ", " + infoMangling[1] + ", "; - - memoiDef = prefix + strNb + ", " + typeName + ", " + approx + ", " + fileToLoad + ", " + FullOffLine + ", " + FileToSave + ", " + updateTableOnCollision + ", " + tsize + " )"; - $newFileJp_MEMOI_DEFS.exec insertBefore(memoiDef); - - // Generate the declaration of the wrapper in the header file. - var protoParam = getDeclParameters(typeName, nbparams); - var wname = getFuncWrapperName(functionName); - var memoiWrapper= typeName + ' ' + wname + ' (' + protoParam + ');'; - genCodeWrapperHeader(memoiWrapper); - ExposedVariables.push(infoMangling[0]); -} - - - -/** - * Generates the declaration of the wrapper header in the FILENAME_MEMOI_WRAPPERS file. - * - * Example: __EXTERN__ double log_wrapper(double); - * The symbol __EXTERN__ is used to solve the compiling problem (C code compiled with or not a C++ compiler). - * */ -function genCodeWrapperHeader(vdecl) -{ - $newFileJp_MEMOI_wrappers.exec insertBefore("__EXTERN__ " + vdecl ); -} - -// ------ CPP memoizations; - -/** - * Generates a DEF entry in the FILENAME_MEMOI_DEFS file for a C++ method, and declares the exposed variables. - * Such a definition will be used for the generation of the memoization library. - * @param {string} className: the name of the class. - * @param {string} methName: the name of the method to memoize. - * @param {string} typeName: the type of the argument (equal to the type of the returned value). - * @param {int} nbparams: the number of arguments of the function (input argument). - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} updateTableOnCollision: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - - * */ -function GenCode_CPP_Memoization(className, methName, typeName, nbparams, fileToLoad, fulloffline, FileToSave, updateTableOnCollision, approx, tsize) -{ - // quite similar to C function + mangling. - var none="none"; - var memoiDef; - TRACE(" methName = " + methName + " typeName = " + typeName + " nbParams = " + nbparams); - var infoMangling = getMangledInfos(className, methName, typeName, nbparams); - initFileMemoization(); - // Generate the DEF code for memoization (required by the INRIA memoization package) - strNb =nbparams.toString(); - memoiDef = "DEF(" + CodeLanguages.indexOf("CPP") + "," + infoMangling[0] + ", " + infoMangling[1] + "," - + strNb + "," + typeName + ',' + approx + "," + fileToLoad + "," + fulloffline + "," - + FileToSave + "," + updateTableOnCollision + "," + tsize + " )"; - $newFileJp_MEMOI_DEFS.exec insertBefore(memoiDef); - ExposedVariables.push(infoMangling[0]); -} - -/** - - @return "true" if a method ($method) has nbArgs parameters of type pType, "false" otherwise. - * */ -function isTheSelectedMethod($method, nbArgs, pType) { - // Used to manage the overloading. - var nbparams = checkHeaderMemoizableMethod($method); - if (nbparams != nbArgs) return false; - var functionType = $method.functionType; - var tt_return = functionType.returnType; - return (tt_return.code === pType); -} - -/** - * @return the code used for the mangling of a type (tt). - * Restricted to memoization type ( int, double, float). - */ -function getManglingType(tt) -{ - if (tt === 'int') return "i"; - if (tt === 'float') return "f"; - if (tt === 'double') return "d"; - return "undef"; -} - - -/** - * @return the mangled name of a type (typeName) for a method with nbparams parameters of this type. - * Restricted to memoization type ( int, double, float). - * */ -function getManglingTypeFor(typeName, nbparams) { - var tm = getManglingType(typeName); - var par_mangling = tm; - var nb = 1; - while (nb != nbparams) { - par_mangling = par_mangling + tm; - nb++; - } - return par_mangling; -} diff --git a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationMath.lara b/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationMath.lara deleted file mode 100644 index 7c279af331..0000000000 --- a/AntarexClavaApi/src-lara/clava/antarex/memoi/MemoizationMath.lara +++ /dev/null @@ -1,100 +0,0 @@ -/* - Author(s): Loïc Besnard (loic.besnard@irisa.fr). - IRISA-INRIA Rennes, France. - - This code has been developed during the ANTAREX project (http://www.antarex-project.eu). - It is provided under the MIT license (https://opensource.org/licenses/MIT). -*/ -import antarex.utils.messages; -import antarex.memoi.MemoizationC; - -/* -----------Memoizing Math functions ---------------------- */ - -/** - * Memoizes all the Math Functions referenced in the application, using default parameters. - */ -aspectdef Memoize_AllMathFunctions - TRACE_BEGIN_OP(" >>> Begin Memoize_math"); - call info: GetFunctions(); - var apis = info.notDeclared; - if (apis.length > 0) - call Memoize_MathFunctions(apis); -end - -/** - * Memoizes a set fo Math Functions. - * @param {array of string} functions to memoize. - * Example: call Memoize_MathFunctions(['sin', 'cos']); - * */ -aspectdef Memoize_MathFunctions -input - targets = [] -end - - for (var target of targets) { - call vcall : Memoize_MathFunction(target); - if ( ! vcall.bres ) - WARNING( target + " is not a memoizable element (ignored) !"); - } -end - -/** - * Memoizes a Math Function with default parameters. - * @param {string} target of a math function. - * @param {boolean} bres: returned value, equal to "true" if the target is a memoizable mathematical function, "false" otherwise. - * */ -aspectdef Memoize_MathFunction -input - target -end -output - bres -end -call m : Memoize_MathFunction_ARGS(target, 'none', 'no', 'none', 'no', 0, DEFAULT_TABSIZE); -bres = m.bres; -end - - -/** - * Memoizes a Math Function with specified parameters. - * @param {string} target of a math function. - * @param {string} fileToLoad: the name of the file to load to initialse the internal table, or none. - * @param {string} FullOffLine: yes or no. yes implies a full off lime memoization (requires a fileToLoad). - * @param {string} FileToSave: the name of the file to save the data of the table, or none. - * @param {string} AlwaysReplace: yes or no. yes implis that in case of collisions, the table is updated. - * @param {int} precision: the number of bit to delete (float/double) for internal approximation, 0 for int. - * @param {int} tsize: the size of the table. - - * @param {boolean} bres: returned value, equal to "true" if the target is a memoizable mathematical function, "false" otherwise. - * */ -aspectdef Memoize_MathFunction_ARGS -input - target, - fileToLoad, // name of the file to load for init the table OR none - FullOffLine, // yes|no yes : full off lime memoization (requires a fileToLoad) - FileToSave, // name of the file to save the data of the table OR none - AlwaysReplace, //yes|no , in case of collisions, the table is updated. - precision, // number of bit to delete (float/double), 0 for int - tsize // size of the table. -end -output - bres -end - memoiDef = getKindMathFunc(target); - if ( memoiDef !== "none" ) { - bres= true; - memoiDef = memoiDef + ',' + precision + ',' + fileToLoad + ',' - + FullOffLine + ',' + FileToSave + ',' + AlwaysReplace + ',' + tsize + ")"; - TRACE( " Memoization of " + target + " with " + memoiDef); - - initFileMemoization(); - $newFileJp_MEMOI_DEFS.exec insertBefore(memoiDef); - initFileWrappers(); - genCodeWrapperHeader( getWrapperDeclMathFunc(target) ); - call C_UpdateCallMemoization(target); - ExposedVariables.push(target); - } - else - bres = false; -end - diff --git a/CMake/clava/ClavaGenerate.cmake b/CMake/clava/ClavaGenerate.cmake index be8ecbe885..172911c19d 100644 --- a/CMake/clava/ClavaGenerate.cmake +++ b/CMake/clava/ClavaGenerate.cmake @@ -143,7 +143,7 @@ function(clava_generate ORIG_TARGET GENERATED_TARGET ASPECT) if(NOT EXISTS "${WOVEN_DIR}/clava_generated_files.txt") message(STATUS "Generating source code for target '${GENERATED_TARGET}' for the first time") execute_process( - COMMAND ${CLAVA_CMD} ${ASPECT} ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -b 2 -p "${PROC_ORIG_SOURCES}" -o ${WORKING_DIR} -of ${WOVEN_DIR_NAME} ${INCLUDE_HEADERS_FLAG} "${PROC_ORIG_INCLUDES}" -ncg ${CLAVA_GENERATE_FLAGS} + COMMAND ${CLAVA_CMD} ${ASPECT} ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -p "${PROC_ORIG_SOURCES}" -o ${WORKING_DIR} -of ${WOVEN_DIR_NAME} ${INCLUDE_HEADERS_FLAG} "${PROC_ORIG_INCLUDES}" -ncg ${CLAVA_GENERATE_FLAGS} #WORKING_DIRECTORY ${ORIG_CMAKE_DIR} #WORKING_DIRECTORY ${BUILD_DIR} WORKING_DIRECTORY ${WORKING_DIR} @@ -151,7 +151,7 @@ function(clava_generate ORIG_TARGET GENERATED_TARGET ASPECT) endif() add_custom_command(OUTPUT "${WOVEN_DIR}/clava_generated_files.txt" - COMMAND ${CLAVA_CMD} ${ASPECT} ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -b 2 -p "${PROC_ORIG_SOURCES}" -o ${WORKING_DIR} -of ${WOVEN_DIR_NAME} INCLUDE_HEADERS_FLAG "${PROC_ORIG_INCLUDES}" -ncg ${CLAVA_GENERATE_WEAVER_FLAGS} + COMMAND ${CLAVA_CMD} ${ASPECT} ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -p "${PROC_ORIG_SOURCES}" -o ${WORKING_DIR} -of ${WOVEN_DIR_NAME} INCLUDE_HEADERS_FLAG "${PROC_ORIG_INCLUDES}" -ncg ${CLAVA_GENERATE_WEAVER_FLAGS} #WORKING_DIRECTORY ${ORIG_CMAKE_DIR} #WORKING_DIRECTORY ${BUILD_DIR} WORKING_DIRECTORY ${WORKING_DIR} diff --git a/CMake/clava/ClavaWeave.CMakeLists.txt b/CMake/clava/ClavaWeave.CMakeLists.txt index 9bf8111915..059d18814d 100644 --- a/CMake/clava/ClavaWeave.CMakeLists.txt +++ b/CMake/clava/ClavaWeave.CMakeLists.txt @@ -6,7 +6,7 @@ project("${ORIG_TARGET}_weaving") #message(STATUS "Working dir: ${WORKING_DIR}") #message(STATUS "Woven dir name: ${WOVEN_DIR_NAME}") - #message(STATUS "-------->COMMAND: ${CLAVA_CMD} \"${ASPECT}\" ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -b 2 -p \"${PROC_ORIG_SOURCES}\" -o \"${WORKING_DIR}\" -of \"${WOVEN_DIR_NAME}\" ${INCLUDE_HEADERS_FLAG} \"${PROC_ORIG_INCLUDES}\" ${CLAVA_WEAVE_FLAGS}") + #message(STATUS "-------->COMMAND: ${CLAVA_CMD} \"${ASPECT}\" ${ASPECT_ARGS_FLAG} ${ASPECT_ARGS} --cmake -s -p \"${PROC_ORIG_SOURCES}\" -o \"${WORKING_DIR}\" -of \"${WOVEN_DIR_NAME}\" ${INCLUDE_HEADERS_FLAG} \"${PROC_ORIG_INCLUDES}\" ${CLAVA_WEAVE_FLAGS}") message(STATUS "Clava weaver flags: ${CLAVA_WEAVE_FLAGS}") @@ -14,7 +14,7 @@ project("${ORIG_TARGET}_weaving") # to skip parsing header files: -sih add_custom_command( OUTPUT "${WOVEN_DIR}/clava_generated_files.txt" - COMMAND ${CLAVA_CMD} "${ASPECT}" ${ASPECT_ARGS_FLAG} "${ASPECT_ARGS}" --cmake -s -b 2 -p "${PROC_ORIG_SOURCES}" -o "${WORKING_DIR}" -of "${WOVEN_DIR_NAME}" ${INCLUDE_HEADERS_FLAG} "${PROC_ORIG_INCLUDES}" ${CLAVA_WEAVE_FLAGS} + COMMAND ${CLAVA_CMD} "${ASPECT}" ${ASPECT_ARGS_FLAG} "${ASPECT_ARGS}" --cmake -s -p "${PROC_ORIG_SOURCES}" -o "${WORKING_DIR}" -of "${WOVEN_DIR_NAME}" ${INCLUDE_HEADERS_FLAG} "${PROC_ORIG_INCLUDES}" ${CLAVA_WEAVE_FLAGS} WORKING_DIRECTORY "${BUILD_DIR}" DEPENDS ${WEAVER_DEPENDENCIES} COMMENT "Applying LARA strategy '${ASPECT}' to target '${ORIG_TARGET}'" diff --git a/ClangAstDumper/src/tool.cpp b/ClangAstDumper/src/tool.cpp index e9c584abd9..eb9e8d6cff 100644 --- a/ClangAstDumper/src/tool.cpp +++ b/ClangAstDumper/src/tool.cpp @@ -14,10 +14,8 @@ static llvm::cl::opt UserSystemHeaderThresholdOption( int main(int argc, const char *argv[]) { - llvm::InitLLVM X(argc, argv); + llvm::InitLLVM X(argc, argv); - - //llvm::outs() << "HELLO!\n"; // Errs is the main way we dump information, we tested if making it buffered // improved performance but could not detect a significant difference // llvm::errs().SetBuffered(); diff --git a/ClangAstParser/.classpath b/ClangAstParser/.classpath deleted file mode 100644 index b1d8838dd6..0000000000 --- a/ClangAstParser/.classpath +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ClangAstParser/.project b/ClangAstParser/.project deleted file mode 100644 index 92979595de..0000000000 --- a/ClangAstParser/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - ClangAstParser - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598931 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClangAstParser/.settings/org.eclipse.jdt.core.prefs b/ClangAstParser/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f6c5ea36f6..0000000000 --- a/ClangAstParser/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled diff --git a/ClangAstParser/build.gradle b/ClangAstParser/build.gradle index 065f5eb22f..26a50196fe 100644 --- a/ClangAstParser/build.gradle +++ b/ClangAstParser/build.gradle @@ -1,58 +1,80 @@ plugins { - id 'distribution' + id 'distribution' + id 'java' + id 'jacoco' } -// Java project -apply plugin: 'java' - java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - // Repositories providers repositories { mavenCentral() } dependencies { - implementation "junit:junit:4.13.1" - - implementation ":ClavaAst" - implementation ":CommonsLangPlus" - implementation ":jOptions" - implementation ":SpecsUtils" + implementation ":ClavaAst" + implementation ":CommonsLangPlus" + implementation ":jOptions" + implementation ":SpecsUtils" - implementation group: 'com.google.guava', name: 'guava', version: '19.0' -} + implementation 'com.google.guava:guava:33.4.0-jre' -java { - withSourcesJar() + testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.0' } // Project sources sourceSets { - main { - java { - srcDir 'src' - srcDir 'test' - } - - resources { - srcDir 'resources' - } - } - - - test { - java { - srcDir 'test' - } - - resources { - srcDir 'resources' - } - } - + main { + java { + srcDir 'src' + } + resources { + srcDir 'resources' + } + } + + test { + java { + srcDir 'test' + } + resources { + srcDir 'test-resources' + } + } +} + +// Test coverage configuration +jacocoTestReport { + reports { + xml.required = true + html.required = true + } + + finalizedBy jacocoTestCoverageVerification +} + +jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 0.70 // 70% minimum coverage + } + } + } +} + +// Make sure jacoco report is generated after tests +test { + useJUnitPlatform() + + // Can't parellelize because it will trigger multiple simultaneous downloads of the dumper and stdlib zip files. + maxParallelForks = 1 + + finalizedBy jacocoTestReport } diff --git a/ClangAstParser/ivy.xml b/ClangAstParser/ivy.xml deleted file mode 100644 index 09e29d44b7..0000000000 --- a/ClangAstParser/ivy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/ClangAstParser/settings.gradle b/ClangAstParser/settings.gradle index a4fbe69a55..bd325c2914 100644 --- a/ClangAstParser/settings.gradle +++ b/ClangAstParser/settings.gradle @@ -1,6 +1,9 @@ rootProject.name = 'ClangAstParser' -includeBuild("../../clava/ClavaAst") -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/SpecsUtils") \ No newline at end of file +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' + +includeBuild("${specsJavaLibsRoot}/CommonsLangPlus") +includeBuild("${specsJavaLibsRoot}/jOptions") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") + +includeBuild("../ClavaAst") diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstFileResource.java b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstFileResource.java index 57faa25828..19f05ccce1 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstFileResource.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstFileResource.java @@ -19,10 +19,9 @@ public enum ClangAstFileResource implements Supplier { - LIBC_CXX_LLVM(ClangAstWebResource.LIBC_CXX_LLVM), - LIBC_CXX_WIN32(ClangAstWebResource.LIBC_CXX_WIN32), - LIBC_CXX_LINUX(ClangAstWebResource.LIBC_CXX_LINUX), LIBC_CXX_LINUX_COMPLETE(ClangAstWebResource.LIBC_CXX_LINUX_COMPLETE), + LIBC_CXX_MACOS_COMPLETE(ClangAstWebResource.LIBC_CXX_MACOS_COMPLETE), + LIBC_CXX_WIN32_COMPLETE(ClangAstWebResource.LIBC_CXX_WIN32_COMPLETE), OPENMP_INCLUDES(ClangAstWebResource.OPENMP_INCLUDES), CUDA_LIB(ClangAstWebResource.CUDA_LIB), WIN_EXE(ClangAstWebResource.WIN_EXE), diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstKeys.java b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstKeys.java index f5dc51c00b..f721422029 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstKeys.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstKeys.java @@ -19,7 +19,6 @@ import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaOptions; import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.lang.SpecsPlatforms; import pt.up.fe.specs.util.SpecsCheck; import pt.up.fe.specs.util.utilities.StringList; @@ -34,14 +33,15 @@ public interface ClangAstKeys { * What libc/libcxx mode should be used. */ DataKey LIBC_CXX_MODE = KeyFactory.enumeration("libcCxxMode", LibcMode.class) - .setLabel("Libc/Libcxx mode") - .setDefault(() -> (SpecsPlatforms.isWindows() || SpecsPlatforms.isLinux()) ? LibcMode.BASE_BUILTIN_ONLY : LibcMode.AUTO); + .setLabel("Libc/Libc++ mode. builtin (default): uses built-in libc/libc++; system: uses includes available in the system; auto: detects if the built-in includes are needed") + .setDefault(() -> LibcMode.BUILTIN_AND_LIBC); DataKey USES_CILK = KeyFactory.bool("usesCilk"); DataKey IGNORE_HEADER_INCLUDES = KeyFactory.stringList("ignoreHeaderIncludes") .setLabel("Headers to ignore when recreating #include directives (Java regexes)"); + public static String getFlagIgnoreIncludes() { return "ihi"; } @@ -53,8 +53,6 @@ public static String getFlagIgnoreIncludes() { * @return */ static DataStore toDataStore(List flags) { - // ClavaLog.debug(() -> "ClangAstKeys flags: " + flags); - DataStore config = DataStore.newInstance(ClavaOptions.STORE_DEFINITION, false); final String stdPrefix = "-std="; final String clangAstDumperPrefix = "-clang-dumper="; @@ -108,9 +106,7 @@ static DataStore toDataStore(List flags) { parsedFlags.add(flag); } - // config.add(ClavaOptions.FLAGS, parsedFlags.stream().collect(Collectors.joining(" "))); - // config.add(ClavaOptions.FLAGS_LIST, new JsonStringList(parsedFlags)); - config.add(ClavaOptions.FLAGS_LIST, new StringList(parsedFlags)); + config.add(ClavaOptions.FLAGS_LIST, parsedFlags); return config; } diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstWebResource.java b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstWebResource.java index 961eca9501..3310677ed2 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstWebResource.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/ClangAstWebResource.java @@ -20,10 +20,9 @@ public interface ClangAstWebResource { String ROOT_16_0_5 = "https://github.com/specs-feup/clava/releases/download/clang_ast_dumper_16.0.5/"; String ROOT_12_0_7 = "https://github.com/specs-feup/clava/releases/download/clang_ast_dumper_v12.0.7.1/"; - WebResourceProvider LIBC_CXX_LLVM = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_llvm.zip", "v16.0.5"); - WebResourceProvider LIBC_CXX_WIN32 = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_win32.zip", "v16.0.5"); - WebResourceProvider LIBC_CXX_LINUX = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_linux.zip", "v16.0.5"); WebResourceProvider LIBC_CXX_LINUX_COMPLETE = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_linux_complete.zip", "v16.0.5"); + WebResourceProvider LIBC_CXX_MACOS_COMPLETE = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_macos_complete.zip", "v16.0.6"); + WebResourceProvider LIBC_CXX_WIN32_COMPLETE = WebResourceProvider.newInstance(ROOT_16_0_5, "libc_cxx_win32_complete.zip", "v16.0.5"); WebResourceProvider OPENMP_INCLUDES = WebResourceProvider.newInstance(ROOT_16_0_5, "openmp_includes.zip"); diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/ClangResources.java b/ClangAstParser/src/pt/up/fe/specs/clang/ClangResources.java index 19108b348b..cfbf45f72f 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/ClangResources.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/ClangResources.java @@ -20,7 +20,6 @@ import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.exceptions.CaseNotDefinedException; import pt.up.fe.specs.util.lazy.Lazy; import pt.up.fe.specs.util.providers.FileResourceManager; import pt.up.fe.specs.util.providers.FileResourceProvider; @@ -42,23 +41,21 @@ public class ClangResources { private final static String CLANG_FOLDERNAME = "clang_ast_exe"; - private final static Lazy CUDALIB_FOLDER = Lazy.newInstance(ClangResources::prepareBuiltinCudaLib); + private final Lazy cudalibFolder = Lazy.newInstance(this::prepareBuiltinCudaLib); - private final FileResourceManager clangAstResources; private final CodeParser options; private static final AtomicInteger HAS_LIBC = new AtomicInteger(-1); public ClangResources(CodeParser options) { - clangAstResources = FileResourceManager.fromEnum(ClangAstFileResource.class); this.options = options; } public ClangFiles getClangFiles(String version, LibcMode libcMode) { // Create key - var key = libcMode.name() + "_" + version; + var key = libcMode.name() + "_" + version + "_" + getClangResourceFolder().getAbsolutePath(); // Check if cached var files = CLANG_FILES_CACHE.get(key); @@ -98,11 +95,10 @@ private File prepareResources(String version) { resource.writeVersioned(resourceFolder, ClangResources.class); } } else if (platform == SupportedPlatform.MAC_OS) { - //var dynLibsFolder = new File("/usr/local/lib/"); for (FileResourceProvider resource : getMacOSResources()) { resource.writeVersioned(resourceFolder, ClangResources.class); } - } else if (platform == SupportedPlatform.LINUX_5) { + } else if (platform == SupportedPlatform.LINUX) { for (FileResourceProvider resource : getLinuxResources()) { resource.writeVersioned(resourceFolder, ClangResources.class); } @@ -128,28 +124,19 @@ private File prepareResources(String version) { } } - // If file is new and we are in a flavor of Linux, make file executable - if (executable.isNewFile() && platform.isLinux()) { + // If file is new and we are in a flavor of Linux or MacOS, make file executable + if (executable.isNewFile() && (platform.isLinux() || platform.isMacOs())) { SpecsSystem.runProcess(Arrays.asList("chmod", "+x", executable.getFile().getAbsolutePath()), false, true); } - // If on linux, make folders and files accessible to all users - if (platform.isLinux()) { - SpecsSystem.runProcess(Arrays.asList("chmod", "-R", "777", resourceFolder.getAbsolutePath()), false, true); - } - return executable.getFile(); } - private FileResourceProvider getVersionedResource(FileResourceProvider resource) { - return getVersionedResource(resource, ""); - } - private FileResourceProvider getVersionedResource(FileResourceProvider resource, String version) { // If version not defined, use the latest version of the resource if (version.isEmpty()) { - version = resource.getVersion(); + version = resource.version(); } // ClangAst executable versions are separated by an underscore @@ -157,42 +144,19 @@ private FileResourceProvider getVersionedResource(FileResourceProvider resource, return resource; } - public static File getClangResourceFolder() { - return SpecsIo.getTempFolder(CLANG_FOLDERNAME); + public File getClangResourceFolder() { + return options.get(CodeParser.DUMPER_FOLDER); } - private Optional getCustomExecutable() { - // Check if theres is a custom executable - var customExe = options.get(CodeParser.CUSTOM_CLANG_AST_DUMPER_EXE); - - if (customExe.getName().isBlank()) { - return Optional.empty(); - } - - if (!customExe.isFile()) { - SpecsLogs.info("Specified a custom executable but could not find file '" + customExe - + "', using built-in executable"); - - return Optional.empty(); - } - - SpecsLogs.info("Using custom executable for ClangAstDumper: '" + customExe.getAbsolutePath() + "'"); - - return Optional.of(FileResourceProvider.newInstance(customExe)); + public static File getDefaultTempFolder() { + return SpecsIo.getTempFolder(CLANG_FOLDERNAME); } private FileResourceProvider getExecutableResource(SupportedPlatform platform) { - - var customExecutable = getCustomExecutable(); - - if (customExecutable.isPresent()) { - return customExecutable.get(); - } - switch (platform) { case WINDOWS: return CLANG_AST_RESOURCES.get(ClangAstFileResource.WIN_EXE); - case LINUX_5: + case LINUX: if (ClangAstDumper.usePlugin()) { return CLANG_AST_RESOURCES.get(ClangAstFileResource.LINUX_PLUGIN); } else { @@ -251,28 +215,25 @@ private List prepareIncludes(File clangExecutable, LibcMode libcMode) { // Get libc/libcxx resources, if required if (useBuiltinLibc(clangExecutable, libcMode)) { - // Common Clang files - if (!SupportedPlatform.getCurrentPlatform().isLinux()) { - var builtinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_LLVM); - includesZips.add(getVersionedResource(builtinResource, builtinResource.getVersion())); - } else { + + // MacOS + if (SupportedPlatform.getCurrentPlatform().isMacOs()) { + var macosBuiltinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_MACOS_COMPLETE); + includesZips.add(getVersionedResource(macosBuiltinResource, macosBuiltinResource.version())); + } + // Linux + else if (SupportedPlatform.getCurrentPlatform().isLinux()) { var linuxBuiltinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_LINUX_COMPLETE); - includesZips.add(getVersionedResource(linuxBuiltinResource, linuxBuiltinResource.getVersion())); + includesZips.add(getVersionedResource(linuxBuiltinResource, linuxBuiltinResource.version())); } - - // Windows-exclusive files - if (SupportedPlatform.getCurrentPlatform().isWindows()) { - var windowsBuiltinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_WIN32); - includesZips.add(getVersionedResource(windowsBuiltinResource, windowsBuiltinResource.getVersion())); + // Windows + else if (SupportedPlatform.getCurrentPlatform().isWindows()) { + var windowsBuiltinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_WIN32_COMPLETE); + includesZips.add(getVersionedResource(windowsBuiltinResource, windowsBuiltinResource.version())); + } else { + throw new RuntimeException("Unsupported platform: " + SupportedPlatform.getCurrentPlatform()); } - // Linux-exclusive files (disabled because common includes not working - /* - if (SupportedPlatform.getCurrentPlatform().isLinux()) { - var linuxBuiltinResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.LIBC_CXX_LINUX); - includesZips.add(getVersionedResource(linuxBuiltinResource, linuxBuiltinResource.getVersion())); - } - */ } @@ -313,9 +274,6 @@ private List prepareIncludes(File clangExecutable, LibcMode libcMode) { var includesFiles = new ArrayList(); for (var extractedFolder : extractedFolders) { var includeFolders = SpecsIo.getFolders(extractedFolder); - //.stream() - //.map(file -> file.getAbsolutePath()) - //.toList(); includesFiles.addAll(includeFolders); } @@ -325,31 +283,19 @@ private List prepareIncludes(File clangExecutable, LibcMode libcMode) { Collections.sort(includesFiles, Comparator.comparing(File::getName)); SpecsLogs.debug(() -> "Includes folders: " + includesFiles); - // If on linux, make folders and files accessible to all users - if (SupportedPlatform.getCurrentPlatform().isLinux()) { - SpecsSystem.runProcess(Arrays.asList("chmod", "-R", "777", resourceFolder.getAbsolutePath()), false, true); - } - return includesFiles.stream().map(File::getAbsolutePath).toList(); } - private boolean useBuiltinLibc(File clangExecutable, LibcMode libcMode) { - - switch (libcMode) { - case AUTO: - return !hasLibC(clangExecutable); - // Builtin and libc/libcxx are now merged in the same zip - case BUILTIN_AND_LIBC: - case BASE_BUILTIN_ONLY: - return true; - case SYSTEM: - return false; - default: - throw new CaseNotDefinedException(libcMode); - } + public static boolean useBuiltinLibc(File clangExecutable, LibcMode libcMode) { + + return switch (libcMode) { + case AUTO -> !hasLibC(clangExecutable); + case BUILTIN_AND_LIBC -> true; + case SYSTEM -> false; + }; } - private boolean hasLibC(File clangExecutable) { + private static boolean hasLibC(File clangExecutable) { var value = HAS_LIBC.get(); // Check if initiallized @@ -376,14 +322,7 @@ private boolean hasLibC(File clangExecutable) { * @param clangExecutable * @return */ - private boolean detectLibC(File clangExecutable) { - - // return false; - - // If Windows, return false and always use bundled LIBC++ - // if (SupportedPlatform.getCurrentPlatform().isWindows()) { - // return false; - // } + private static boolean detectLibC(File clangExecutable) { File clangTest = SpecsIo.mkdir(SpecsIo.getTempFolder(), "clang_ast_test"); @@ -393,13 +332,6 @@ private boolean detectLibC(File clangExecutable) { .map(resource -> resource.write(clangTest)) .collect(Collectors.toList()); - // If on linux, make folders and files accessible to all users - if (SupportedPlatform.getCurrentPlatform().isLinux()) { - SpecsSystem.runProcess(Arrays.asList("chmod", "-R", "777", clangTest.getAbsolutePath()), false, true); - } - - // boolean needsLib = Arrays.asList(ClangAstResource.TEST_INCLUDES_C, ClangAstResource.TEST_INCLUDES_CPP) - boolean needsLib = false; for (File testFile : testFiles) { @@ -436,16 +368,16 @@ private boolean detectLibC(File clangExecutable) { } - private ProcessOutputAsString runClangAstDumper(File clangExecutable, File testFile) { + private static ProcessOutputAsString runClangAstDumper(File clangExecutable, File testFile) { List arguments = Arrays.asList(clangExecutable.getAbsolutePath(), testFile.getAbsolutePath(), "--"); return SpecsSystem.runProcess(arguments, true, false); } - public static File getBuiltinCudaLib() { - return CUDALIB_FOLDER.get(); + public File getBuiltinCudaLib() { + return cudalibFolder.get(); } - private static File prepareBuiltinCudaLib() { + private File prepareBuiltinCudaLib() { var fileResource = CLANG_AST_RESOURCES.get(ClangAstFileResource.CUDA_LIB); var resourceFolder = getClangResourceFolder(); var cudalibFolder = SpecsIo.mkdir(new File(resourceFolder, "cudalib")); diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/LibcMode.java b/ClangAstParser/src/pt/up/fe/specs/clang/LibcMode.java index d3e00f56b2..fe6e80f354 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/LibcMode.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/LibcMode.java @@ -1,11 +1,11 @@ /** * Copyright 2021 SPeCS. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. under the License. @@ -15,10 +15,9 @@ public enum LibcMode { - AUTO("Detect automatically (always uses base built-ins)"), - BASE_BUILTIN_ONLY("Clava base built-ins"), - BUILTIN_AND_LIBC("Clava base built-ins + libc/libc++"), - SYSTEM("Nothing (i.e. use system libs)"); + AUTO("auto"), + BUILTIN_AND_LIBC("builtin"), + SYSTEM("system"); private final String label; diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/Platforms.java b/ClangAstParser/src/pt/up/fe/specs/clang/Platforms.java index 2720305f56..3d27c4f944 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/Platforms.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/Platforms.java @@ -61,7 +61,7 @@ private static boolean isExecutable(File file, SupportedPlatform platform) { return file.getName().endsWith(".exe"); } - if (platform.isLinux()) { + if (platform.isLinux() || platform.isMacOs()) { return file.canExecute(); } @@ -98,6 +98,9 @@ private static File getExecutable(List executables) { } } + if (lastModified == null) { + throw new RuntimeException("Could not determine the most recent executable file in the build folder"); + } SpecsLogs.msgInfo("Found more than 1 executable file in the build folder, choosing the most recent one: " + lastModified.getAbsolutePath()); diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/SupportedPlatform.java b/ClangAstParser/src/pt/up/fe/specs/clang/SupportedPlatform.java index 3ed7f588b0..ca7d4ad349 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/SupportedPlatform.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/SupportedPlatform.java @@ -31,7 +31,7 @@ public enum SupportedPlatform implements StringProvider { WINDOWS, - LINUX_5, + LINUX, MAC_OS; private static final Lazy> HELPER = EnumHelperWithValue @@ -39,7 +39,6 @@ public enum SupportedPlatform implements StringProvider { private static final double SUPPORTED_MAC_VERSION = 11.5; - private static final double SUPPORTED_LINUX_VERSION = 5; public static EnumHelperWithValue getHelper() { return HELPER.get(); @@ -79,51 +78,12 @@ private static SupportedPlatform calculateCurrentPlatform() { throw new RuntimeException("ARM-based platforms are not currently supported"); } - var linuxMajorVersion = getLinuxMajorVersion(); - - if (linuxMajorVersion == null) { - ClavaLog.info("Could not determine Linux version, running at your own risk"); - return LINUX_5; - } - - if (linuxMajorVersion >= SUPPORTED_LINUX_VERSION) { - return LINUX_5; - } - - if (linuxMajorVersion < SUPPORTED_LINUX_VERSION) { - throw new RuntimeException("Current major Linux version is " + linuxMajorVersion + ", minimum version supported is " + SUPPORTED_LINUX_VERSION); - } - + return LINUX; } - - throw new RuntimeException("Platform currently not supported: " + System.getProperty("os.name")); } - private static Integer getLinuxMajorVersion() { - var linuxVersion = System.getProperty("os.version"); - var dotIndex = linuxVersion.indexOf('.'); - - if (dotIndex == -1) { - ClavaLog.info("Could not extract major version from Linux OS version string, expected at least a . : '" - + linuxVersion + "'"); - return null; - } - - var majorVersionString = linuxVersion.substring(0, dotIndex); - - var majorVersion = SpecsStrings.parseInteger(majorVersionString); - - if (majorVersion == null) { - ClavaLog.info("Could not extract major version from Linux OS version string, '" + majorVersionString - + "' is not an integer: '" + linuxVersion + "'"); - return null; - } - - return majorVersion; - } - private static Double getMacOSVersion() { var macosVersion = System.getProperty("os.version"); @@ -151,7 +111,11 @@ public boolean isWindows() { } public boolean isLinux() { - return this == MAC_OS || this == LINUX_5; + return this == LINUX; + } + + public boolean isMacOs() { + return this == MAC_OS; } public String getName() { diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/CodeParser.java b/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/CodeParser.java index 9986bba870..32d4fe0fd0 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/CodeParser.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/CodeParser.java @@ -16,6 +16,7 @@ import org.suikasoft.jOptions.DataStore.ADataClass; import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.Datakey.KeyFactory; +import pt.up.fe.specs.clang.ClangResources; import pt.up.fe.specs.clava.ast.extra.App; import pt.up.fe.specs.clava.context.ClavaContext; @@ -28,8 +29,6 @@ * @author JoaoBispo * */ -// public interface CodeParser> extends DataClass { -// public interface CodeParser extends DataClass { public abstract class CodeParser extends ADataClass { // BEGIN DATAKEY @@ -45,22 +44,16 @@ public abstract class CodeParser extends ADataClass { public static final DataKey CUDA_PATH = KeyFactory.string("cudaPath") .setLabel("CUDA Path (empty: uses system installed; : uses builtin version)") .setDefaultString(""); - public static final DataKey CUSTOM_CLANG_AST_DUMPER_EXE = KeyFactory.file("customClangAstDumperExe") - .setLabel("Custom ClangAstDumper executable file"); + public static final DataKey DUMPER_FOLDER = KeyFactory.folder("dumperFolder") + .setLabel("The work folder for the clang-dumper. Clava will look for it in this folder, and if not found, will download it. If not set, a temporary folder will be used.") + .setDefault(ClangResources::getDefaultTempFolder); /** * Execution information, such as execution time and memory used. */ public static final DataKey SHOW_EXEC_INFO = KeyFactory.bool("showExecInfo").setDefault(() -> true); - /** - * Applies several transformations to the Clava AST when parsing (e.g., normalization passes). By default is - * enabled. - */ - // public static final DataKey PROCESS_CLAVA_AST = KeyFactory.bool("processClavaAst").setDefault(() -> - // true); - - // BEGIN DATAKEY + // END DATAKEY private final static String BUILT_IN_CUDALIB = ""; @@ -73,8 +66,7 @@ public static String getBuiltinOption() { /** * * @param sources - * @param compilerOptions - * flags compatible with C/C++ compilers such as Clang or GCC + * @param compilerOptions flags compatible with C/C++ compilers such as Clang or GCC * @return */ public App parse(List sources, List compilerOptions) { @@ -87,7 +79,6 @@ public App parse(List sources, List compilerOptions) { * @return currently returns an instance of ParallelCodeParser */ public static CodeParser newInstance() { - // return new MonolithicCodeParser(); return new ParallelCodeParser(); } } diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/TUnitProcessor.java b/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/TUnitProcessor.java index 819832d970..af7410545c 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/TUnitProcessor.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/codeparser/TUnitProcessor.java @@ -88,8 +88,6 @@ public List getTranslationUnits() { // Only consider nodes with valid locations, nodes with invalid locations in the AST at this point // where most likely introduced by Clava (e.g., Includes, Null nodes, etc) .filter(node -> node.getLocation().isValid()) - // Ignore expressions - //.filter(node -> !(node instanceof Expr)) // Ignore certain nodes that might have the same location, such as ImplicitCastExpr // .filter(node -> !IGNORE_CLASSES.contains(node.getClass())) .forEach(node -> addNode(node)); @@ -224,11 +222,6 @@ private Optional normalizeNode(ClavaNode node) { return Optional.empty(); } - // Expressions cannot be normalized - //if (node instanceof Expr) { - // return Optional.empty(); - //} - String signature = node.getNodeSignature(); // If signature is ambiguous, cannot normalize node diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java index 13c4f6c8ae..718a1f4bdf 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstDumper.java @@ -18,7 +18,6 @@ import org.suikasoft.jOptions.streamparser.LineStreamParser; import pt.up.fe.specs.clang.ClangAstKeys; import pt.up.fe.specs.clang.ClangResources; -import pt.up.fe.specs.clang.LibcMode; import pt.up.fe.specs.clang.cilk.CilkParser; import pt.up.fe.specs.clang.codeparser.CodeParser; import pt.up.fe.specs.clang.codeparser.ParallelCodeParser; @@ -31,7 +30,6 @@ import pt.up.fe.specs.clava.language.Standard; import pt.up.fe.specs.clava.utils.SourceType; import pt.up.fe.specs.lang.SpecsPlatforms; -import pt.up.fe.specs.util.SpecsCheck; import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; import pt.up.fe.specs.util.SpecsSystem; @@ -44,6 +42,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; /** * Calls the ClangAstDumper executable and returns the dumped information. Clava AST can be built based on this output. @@ -87,6 +86,7 @@ public static List getTempFiles() { private File clangExecutable; private List builtinIncludes; private int systemIncludesThreshold; + private ClangResources clangResources; private final CodeParser parserConfig; @@ -113,6 +113,7 @@ public ClangAstDumper(boolean streamConsoleOutput, this.baseFolder = null; this.systemIncludesThreshold = ParallelCodeParser.SYSTEM_INCLUDES_THRESHOLD.getDefault().get(); this.parserConfig = parserConfig; + this.clangResources = new ClangResources(parserConfig); } public File getLastWorkingFolder() { @@ -234,7 +235,7 @@ else if (isCuda) { // Check if should use built-in CUDA lib File cudaFolder = cudaPath.toUpperCase().equals(CodeParser.getBuiltinOption()) - ? ClangResources.getBuiltinCudaLib() + ? clangResources.getBuiltinCudaLib() : SpecsIo.existingFolder(cudaPath); ClavaLog.debug("Setting --cuda-path to folder '" + cudaFolder.getAbsolutePath() + "'"); @@ -253,8 +254,8 @@ else if (SourceType.isHeader(sourceFile)) { arguments.add(standard.isCxx() ? "c++" : "c"); } - // If option to ony use built-in includes, disable system includes - if (config.get(ClangAstKeys.LIBC_CXX_MODE) == LibcMode.BASE_BUILTIN_ONLY) { + // If it was determined that built-in includes will be used, disable system includes + if (ClangResources.useBuiltinLibc(clangExecutable, config.get(ClangAstKeys.LIBC_CXX_MODE))) { arguments.add("-nostdinc"); arguments.add("-nostdinc++"); } @@ -275,7 +276,7 @@ else if (SourceType.isHeader(sourceFile)) { arguments.addAll(ArgumentsParser.newCommandLine().parse(config.get(ClavaOptions.FLAGS))); - arguments.addAll(config.get(ClavaOptions.FLAGS_LIST).getStringList()); + arguments.addAll(config.get(ClavaOptions.FLAGS_LIST)); ClavaLog.debug(() -> "Calling Clang AST Dumper: " + arguments); @@ -311,7 +312,7 @@ else if (SourceType.isHeader(sourceFile)) { }); parsedData = output.getStdErr(); - SpecsCheck.checkNotNull(parsedData, () -> "Did not expect error output to be null"); + Objects.requireNonNull(parsedData, () -> "Did not expect error output to be null"); parsedData.set(ClangAstData.HAS_ERRORS, output.isError()); // If console output streaming is disabled, show output only at the end diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstParser.java b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstParser.java index 6f0742f7b7..75c0fb5309 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstParser.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/dumper/ClangAstParser.java @@ -13,13 +13,44 @@ package pt.up.fe.specs.clang.dumper; -import com.google.common.base.Preconditions; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + import org.suikasoft.jOptions.Interfaces.DataStore; + import pt.up.fe.specs.clang.ClangAstKeys; import pt.up.fe.specs.clang.cilk.CilkAstAdapter; import pt.up.fe.specs.clang.parsers.ClavaNodes; -import pt.up.fe.specs.clang.transforms.*; -import pt.up.fe.specs.clava.*; +import pt.up.fe.specs.clang.transforms.AnnotateLabelDecls; +import pt.up.fe.specs.clang.transforms.CreateDeclStmts; +import pt.up.fe.specs.clang.transforms.CreateEmptyStmts; +import pt.up.fe.specs.clang.transforms.CreatePointerToMemberExpr; +import pt.up.fe.specs.clang.transforms.DeleteTemplateSpecializations; +import pt.up.fe.specs.clang.transforms.FlattenSubStmtNodes; +import pt.up.fe.specs.clang.transforms.MoveDeclsToTagDecl; +import pt.up.fe.specs.clang.transforms.MoveImplicitCasts; +import pt.up.fe.specs.clang.transforms.ProcessCudaNodes; +import pt.up.fe.specs.clang.transforms.RemoveClangOmpNodes; +import pt.up.fe.specs.clang.transforms.RemoveExtraNodes; +import pt.up.fe.specs.clang.transforms.RemovePoison; +import pt.up.fe.specs.clava.ClavaLog; +import pt.up.fe.specs.clava.ClavaNode; +import pt.up.fe.specs.clava.ClavaRule; +import pt.up.fe.specs.clava.Include; +import pt.up.fe.specs.clava.SourceRange; import pt.up.fe.specs.clava.ast.decl.Decl; import pt.up.fe.specs.clava.ast.decl.ParmVarDecl; import pt.up.fe.specs.clava.ast.extra.TranslationUnit; @@ -32,17 +63,16 @@ import pt.up.fe.specs.clava.parsing.snippet.SnippetParser; import pt.up.fe.specs.clava.parsing.snippet.TextElements; import pt.up.fe.specs.clava.parsing.snippet.TextParser; -import pt.up.fe.specs.util.*; +import pt.up.fe.specs.util.SpecsCheck; +import pt.up.fe.specs.util.SpecsCollections; +import pt.up.fe.specs.util.SpecsIo; +import pt.up.fe.specs.util.SpecsLogs; +import pt.up.fe.specs.util.SpecsStrings; import pt.up.fe.specs.util.collections.MultiMap; import pt.up.fe.specs.util.treenode.NodeInsertUtils; import pt.up.fe.specs.util.utilities.LineStream; import pt.up.fe.specs.util.utilities.StringList; -import java.io.File; -import java.util.*; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - /** * Creates a Clava tree from information dumped by ClangAstDumper. * @@ -92,7 +122,6 @@ public static Collection getTextParsingRules() { return TEXT_PARSING_RULES; } - public TranslationUnit parseTu(File sourceFile) { // Get top-level nodes Set topLevelDecls = data.get(ClangAstData.TOP_LEVEL_DECL_IDS); @@ -106,7 +135,7 @@ public TranslationUnit parseTu(File sourceFile) { // for (String topLevelDeclId : topLevelDecls.flatValues()) { for (String topLevelDeclId : topLevelDecls) { ClavaNode parsedNode = data.get(ClangAstData.CLAVA_NODES).get(topLevelDeclId); - Preconditions.checkNotNull(parsedNode, "No node for decl '" + topLevelDeclId + "'"); + Objects.requireNonNull(parsedNode, () -> "No node for decl '" + topLevelDeclId + "'"); // Check topLevelDeclNodes.add(parsedNode); } @@ -117,14 +146,14 @@ public TranslationUnit parseTu(File sourceFile) { continue; } ClavaNode parsedNode = data.get(ClangAstData.CLAVA_NODES).get(topLevelTypeId); - Preconditions.checkNotNull(parsedNode, "No node for type '" + topLevelTypeId + "'"); + Objects.requireNonNull(parsedNode, () -> "No node for type '" + topLevelTypeId + "'"); } // Parse top-level attributes for (String topLevelAttributeId : topLevelAttributes) { ClavaNode parsedNode = data.get(ClangAstData.CLAVA_NODES).get(topLevelAttributeId); - Preconditions.checkNotNull(parsedNode, "No node for attribute '" + topLevelAttributeId + "'"); + Objects.requireNonNull(parsedNode, () -> "No node for attribute '" + topLevelAttributeId + "'"); } // Create TU node diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodeParser.java b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodeParser.java index 96b019990f..f069600ee6 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodeParser.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodeParser.java @@ -18,6 +18,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.function.BiFunction; @@ -33,7 +34,6 @@ import pt.up.fe.specs.clava.ast.stmt.CompoundStmt; import pt.up.fe.specs.clava.context.ClavaContext; import pt.up.fe.specs.clava.utils.ClassesService; -import pt.up.fe.specs.util.SpecsCheck; import pt.up.fe.specs.util.SpecsLogs; import pt.up.fe.specs.util.utilities.LineStream; @@ -202,7 +202,7 @@ private ClavaNode parseNode(String nodeId, String classname, ClangAstData data, } int index = i; - SpecsCheck.checkNotNull(child, + Objects.requireNonNull(child, () -> "Did not find ClavaNode for child with index '" + index + "' and id '" + childId + "' when parsing " + clavaNodeClass.getSimpleName() + " -> " + nodeData); @@ -238,7 +238,7 @@ private ClavaNode parseNode(String nodeId, String classname, ClangAstData data, // } int index = i; - SpecsCheck.checkNotNull(child, + Objects.requireNonNull(child, () -> "Did not find ClavaNode for child with index '" + index + "' and id '" + childId + "' when parsing " + clavaNodeClass.getSimpleName() + " -> " + nodeData); diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodes.java b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodes.java index 4713f0cf58..4deb221452 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodes.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/ClavaNodes.java @@ -19,6 +19,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -27,8 +28,6 @@ import org.suikasoft.jOptions.DataStore.DataClass; import org.suikasoft.jOptions.Datakey.DataKey; -import com.google.common.base.Preconditions; - import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.NullNodeType; @@ -70,7 +69,7 @@ public List getQueuedActions() { public ClavaNode get(String nodeId) { ClavaNode clavaNode = clavaNodes.get(nodeId); - Preconditions.checkNotNull(clavaNode, "Could not find ClavaNode with id '" + nodeId + Objects.requireNonNull(clavaNode, () -> "Could not find ClavaNode with id '" + nodeId + "'. Check if node is being visited. If parsing of includes is enabled, check that the parsing level is sufficient."); return clavaNode; diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/NodeDataParser.java b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/NodeDataParser.java index 5e1cc9b2f0..b0d410ecf5 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/parsers/NodeDataParser.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/parsers/NodeDataParser.java @@ -272,6 +272,9 @@ public static DataStore parseNodeData(LineStream lines, boolean hasLocation, Cla // TODO: Consider removing boolean isMacro = hasLocation ? LineStreamParsers.oneOrZero(lines) : false; + + // Do not remove. I know its value is not being used, but it is being parsed + // Will break the parser if removed SourceRange spellingLocation = isMacro ? ClavaDataParsers.parseLocation(lines, dataStore) : SourceRange.invalidRange(); diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/transforms/AnnotateLabelDecls.java b/ClangAstParser/src/pt/up/fe/specs/clang/transforms/AnnotateLabelDecls.java index cf1cb60009..e234566e4d 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/transforms/AnnotateLabelDecls.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/transforms/AnnotateLabelDecls.java @@ -15,8 +15,6 @@ import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.decl.*; -import pt.up.fe.specs.clava.ast.extra.TranslationUnit; -import pt.up.fe.specs.clava.ast.stmt.DeclStmt; import pt.up.fe.specs.clava.ast.stmt.LabelStmt; import pt.up.fe.specs.clava.transform.SimplePostClavaRule; import pt.up.fe.specs.util.treenode.transform.TransformQueue; @@ -40,6 +38,4 @@ public void applySimple(ClavaNode node, TransformQueue queue) { } } - - } diff --git a/ClangAstParser/src/pt/up/fe/specs/clang/transforms/legacy/RecoverStdMacros.java b/ClangAstParser/src/pt/up/fe/specs/clang/transforms/legacy/RecoverStdMacros.java index a172fbf848..6df50254d0 100644 --- a/ClangAstParser/src/pt/up/fe/specs/clang/transforms/legacy/RecoverStdMacros.java +++ b/ClangAstParser/src/pt/up/fe/specs/clang/transforms/legacy/RecoverStdMacros.java @@ -15,10 +15,9 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.regex.Pattern; -import com.google.common.base.Preconditions; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.expr.ParenExpr; import pt.up.fe.specs.clava.transform.SimplePreClavaRule; @@ -60,7 +59,7 @@ public void applySimple(ClavaNode node, TransformQueue queue) { // Get corresponding macro String macroStd = STD_MACROS.get(stdMacroNumber); - Preconditions.checkNotNull(macroStd, "Case not defined, " + stdMacroNumber); + Objects.requireNonNull(macroStd, () -> "Case not defined, " + stdMacroNumber); // Replace expression queue.replace(parenExpr, node.getFactory().literalExpr(macroStd, parenExpr.getExprType())); diff --git a/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/ClangCxxTester.java b/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/ClangCxxTester.java index b144c8fddc..430ec9c6d3 100644 --- a/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/ClangCxxTester.java +++ b/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/ClangCxxTester.java @@ -38,11 +38,11 @@ private static AClangAstTester newClangCxxTester(String... files) { @Test public void testBool() { - newClangCxxTester("cxx/ast-print-bool.c").test(); + newClangCxxTester("cxx/ast-print-bool.cpp").test(); } @Test public void testRecordDeclStruct() { - newClangCxxTester("cxx/ast-print-record-decl.c").addFlags("-DKW=struct", "-DBASES=\" : B\"").test(); + newClangCxxTester("cxx/ast-print-record-decl.cpp").addFlags("-DKW=struct", "-DBASES=\" : B\"").test(); } } diff --git a/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/CxxProblematicTester.java b/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/CxxProblematicTester.java index ccf9a430b0..0fe9cd8e75 100644 --- a/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/CxxProblematicTester.java +++ b/ClangAstParser/test-experimental/eu/antarex/clang/parser/tests/CxxProblematicTester.java @@ -84,7 +84,7 @@ public void testDummy() { @Test public void testMsAsm() { - new CxxTester("problematic/ms_asm.c").addFlags("-fasm-blocks").onePass().showCode().test(); + new CxxTester("problematic/ms_asm.cpp").addFlags("-fasm-blocks").onePass().showCode().test(); } } diff --git a/ClangAstParser/resources/c/array_filler.c b/ClangAstParser/test-resources/c/array_filler.c similarity index 100% rename from ClangAstParser/resources/c/array_filler.c rename to ClangAstParser/test-resources/c/array_filler.c diff --git a/ClangAstParser/resources/c/array_filler.c.txt b/ClangAstParser/test-resources/c/array_filler.c.txt similarity index 100% rename from ClangAstParser/resources/c/array_filler.c.txt rename to ClangAstParser/test-resources/c/array_filler.c.txt diff --git a/ClangAstParser/resources/c/bench/2mm.c b/ClangAstParser/test-resources/c/bench/2mm.c similarity index 100% rename from ClangAstParser/resources/c/bench/2mm.c rename to ClangAstParser/test-resources/c/bench/2mm.c diff --git a/ClangAstParser/resources/c/bench/2mm.c.txt b/ClangAstParser/test-resources/c/bench/2mm.c.txt similarity index 100% rename from ClangAstParser/resources/c/bench/2mm.c.txt rename to ClangAstParser/test-resources/c/bench/2mm.c.txt diff --git a/ClangAstParser/resources/c/bench/2mm.h b/ClangAstParser/test-resources/c/bench/2mm.h similarity index 100% rename from ClangAstParser/resources/c/bench/2mm.h rename to ClangAstParser/test-resources/c/bench/2mm.h diff --git a/ClangAstParser/resources/c/bench/2mm.h.txt b/ClangAstParser/test-resources/c/bench/2mm.h.txt similarity index 100% rename from ClangAstParser/resources/c/bench/2mm.h.txt rename to ClangAstParser/test-resources/c/bench/2mm.h.txt diff --git a/ClangAstParser/resources/c/bench/nas_bt.c b/ClangAstParser/test-resources/c/bench/nas_bt.c similarity index 100% rename from ClangAstParser/resources/c/bench/nas_bt.c rename to ClangAstParser/test-resources/c/bench/nas_bt.c diff --git a/ClangAstParser/resources/c/bench/nas_bt.c.txt b/ClangAstParser/test-resources/c/bench/nas_bt.c.txt similarity index 100% rename from ClangAstParser/resources/c/bench/nas_bt.c.txt rename to ClangAstParser/test-resources/c/bench/nas_bt.c.txt diff --git a/ClangAstParser/resources/c/bench/nas_ft.c b/ClangAstParser/test-resources/c/bench/nas_ft.c similarity index 100% rename from ClangAstParser/resources/c/bench/nas_ft.c rename to ClangAstParser/test-resources/c/bench/nas_ft.c diff --git a/ClangAstParser/resources/c/bench/nas_ft.c.txt b/ClangAstParser/test-resources/c/bench/nas_ft.c.txt similarity index 100% rename from ClangAstParser/resources/c/bench/nas_ft.c.txt rename to ClangAstParser/test-resources/c/bench/nas_ft.c.txt diff --git a/ClangAstParser/resources/c/bench/nas_lu.c b/ClangAstParser/test-resources/c/bench/nas_lu.c similarity index 100% rename from ClangAstParser/resources/c/bench/nas_lu.c rename to ClangAstParser/test-resources/c/bench/nas_lu.c diff --git a/ClangAstParser/resources/c/bench/nas_lu.c.txt b/ClangAstParser/test-resources/c/bench/nas_lu.c.txt similarity index 100% rename from ClangAstParser/resources/c/bench/nas_lu.c.txt rename to ClangAstParser/test-resources/c/bench/nas_lu.c.txt diff --git a/ClangAstParser/resources/c/bench/nas_ua.c b/ClangAstParser/test-resources/c/bench/nas_ua.c similarity index 100% rename from ClangAstParser/resources/c/bench/nas_ua.c rename to ClangAstParser/test-resources/c/bench/nas_ua.c diff --git a/ClangAstParser/resources/c/bench/nas_ua.c.txt b/ClangAstParser/test-resources/c/bench/nas_ua.c.txt similarity index 100% rename from ClangAstParser/resources/c/bench/nas_ua.c.txt rename to ClangAstParser/test-resources/c/bench/nas_ua.c.txt diff --git a/ClangAstParser/resources/c/bench/polybench.h b/ClangAstParser/test-resources/c/bench/polybench.h similarity index 100% rename from ClangAstParser/resources/c/bench/polybench.h rename to ClangAstParser/test-resources/c/bench/polybench.h diff --git a/ClangAstParser/resources/c/bench/polybench.h.txt b/ClangAstParser/test-resources/c/bench/polybench.h.txt similarity index 100% rename from ClangAstParser/resources/c/bench/polybench.h.txt rename to ClangAstParser/test-resources/c/bench/polybench.h.txt diff --git a/ClangAstParser/resources/c/boolean.c b/ClangAstParser/test-resources/c/boolean.c similarity index 100% rename from ClangAstParser/resources/c/boolean.c rename to ClangAstParser/test-resources/c/boolean.c diff --git a/ClangAstParser/resources/c/boolean.c.txt b/ClangAstParser/test-resources/c/boolean.c.txt similarity index 100% rename from ClangAstParser/resources/c/boolean.c.txt rename to ClangAstParser/test-resources/c/boolean.c.txt diff --git a/ClangAstParser/resources/c/boolean2.c b/ClangAstParser/test-resources/c/boolean2.c similarity index 100% rename from ClangAstParser/resources/c/boolean2.c rename to ClangAstParser/test-resources/c/boolean2.c diff --git a/ClangAstParser/resources/c/boolean2.c.txt b/ClangAstParser/test-resources/c/boolean2.c.txt similarity index 100% rename from ClangAstParser/resources/c/boolean2.c.txt rename to ClangAstParser/test-resources/c/boolean2.c.txt diff --git a/ClangAstParser/resources/c/builtin_types.cl b/ClangAstParser/test-resources/c/builtin_types.cl similarity index 100% rename from ClangAstParser/resources/c/builtin_types.cl rename to ClangAstParser/test-resources/c/builtin_types.cl diff --git a/ClangAstParser/resources/c/builtin_types.cl.txt b/ClangAstParser/test-resources/c/builtin_types.cl.txt similarity index 100% rename from ClangAstParser/resources/c/builtin_types.cl.txt rename to ClangAstParser/test-resources/c/builtin_types.cl.txt diff --git a/ClangAstParser/resources/c/c89.c b/ClangAstParser/test-resources/c/c89.c similarity index 100% rename from ClangAstParser/resources/c/c89.c rename to ClangAstParser/test-resources/c/c89.c diff --git a/ClangAstParser/resources/c/c89.c.txt b/ClangAstParser/test-resources/c/c89.c.txt similarity index 100% rename from ClangAstParser/resources/c/c89.c.txt rename to ClangAstParser/test-resources/c/c89.c.txt diff --git a/ClangAstParser/resources/c/c99.c b/ClangAstParser/test-resources/c/c99.c similarity index 100% rename from ClangAstParser/resources/c/c99.c rename to ClangAstParser/test-resources/c/c99.c diff --git a/ClangAstParser/resources/c/c99.c.txt b/ClangAstParser/test-resources/c/c99.c.txt similarity index 100% rename from ClangAstParser/resources/c/c99.c.txt rename to ClangAstParser/test-resources/c/c99.c.txt diff --git a/ClangAstParser/resources/c/cilk.c b/ClangAstParser/test-resources/c/cilk.c similarity index 100% rename from ClangAstParser/resources/c/cilk.c rename to ClangAstParser/test-resources/c/cilk.c diff --git a/ClangAstParser/resources/c/cilk.c.txt b/ClangAstParser/test-resources/c/cilk.c.txt similarity index 100% rename from ClangAstParser/resources/c/cilk.c.txt rename to ClangAstParser/test-resources/c/cilk.c.txt diff --git a/ClangAstParser/resources/c/cl_attribute.cl b/ClangAstParser/test-resources/c/cl_attribute.cl similarity index 100% rename from ClangAstParser/resources/c/cl_attribute.cl rename to ClangAstParser/test-resources/c/cl_attribute.cl diff --git a/ClangAstParser/resources/c/cl_attribute.cl.txt b/ClangAstParser/test-resources/c/cl_attribute.cl.txt similarity index 100% rename from ClangAstParser/resources/c/cl_attribute.cl.txt rename to ClangAstParser/test-resources/c/cl_attribute.cl.txt diff --git a/ClangAstParser/resources/c/compound_literal.c b/ClangAstParser/test-resources/c/compound_literal.c similarity index 100% rename from ClangAstParser/resources/c/compound_literal.c rename to ClangAstParser/test-resources/c/compound_literal.c diff --git a/ClangAstParser/resources/c/compound_literal.c.txt b/ClangAstParser/test-resources/c/compound_literal.c.txt similarity index 100% rename from ClangAstParser/resources/c/compound_literal.c.txt rename to ClangAstParser/test-resources/c/compound_literal.c.txt diff --git a/ClangAstParser/resources/c/decl.c b/ClangAstParser/test-resources/c/decl.c similarity index 100% rename from ClangAstParser/resources/c/decl.c rename to ClangAstParser/test-resources/c/decl.c diff --git a/ClangAstParser/resources/c/decl.c.txt b/ClangAstParser/test-resources/c/decl.c.txt similarity index 100% rename from ClangAstParser/resources/c/decl.c.txt rename to ClangAstParser/test-resources/c/decl.c.txt diff --git a/ClangAstParser/resources/c/enum.c b/ClangAstParser/test-resources/c/enum.c similarity index 100% rename from ClangAstParser/resources/c/enum.c rename to ClangAstParser/test-resources/c/enum.c diff --git a/ClangAstParser/resources/c/enum.c.txt b/ClangAstParser/test-resources/c/enum.c.txt similarity index 100% rename from ClangAstParser/resources/c/enum.c.txt rename to ClangAstParser/test-resources/c/enum.c.txt diff --git a/ClangAstParser/resources/c/enum.h b/ClangAstParser/test-resources/c/enum.h similarity index 100% rename from ClangAstParser/resources/c/enum.h rename to ClangAstParser/test-resources/c/enum.h diff --git a/ClangAstParser/resources/c/enum.h.txt b/ClangAstParser/test-resources/c/enum.h.txt similarity index 100% rename from ClangAstParser/resources/c/enum.h.txt rename to ClangAstParser/test-resources/c/enum.h.txt diff --git a/ClangAstParser/resources/c/gnu_stmt_expr.c b/ClangAstParser/test-resources/c/gnu_stmt_expr.c similarity index 100% rename from ClangAstParser/resources/c/gnu_stmt_expr.c rename to ClangAstParser/test-resources/c/gnu_stmt_expr.c diff --git a/ClangAstParser/resources/c/gnu_stmt_expr.c.txt b/ClangAstParser/test-resources/c/gnu_stmt_expr.c.txt similarity index 100% rename from ClangAstParser/resources/c/gnu_stmt_expr.c.txt rename to ClangAstParser/test-resources/c/gnu_stmt_expr.c.txt diff --git a/ClangAstParser/resources/c/goto.c b/ClangAstParser/test-resources/c/goto.c similarity index 100% rename from ClangAstParser/resources/c/goto.c rename to ClangAstParser/test-resources/c/goto.c diff --git a/ClangAstParser/resources/c/goto.c.txt b/ClangAstParser/test-resources/c/goto.c.txt similarity index 100% rename from ClangAstParser/resources/c/goto.c.txt rename to ClangAstParser/test-resources/c/goto.c.txt diff --git a/ClangAstParser/resources/c/labels.c b/ClangAstParser/test-resources/c/labels.c similarity index 100% rename from ClangAstParser/resources/c/labels.c rename to ClangAstParser/test-resources/c/labels.c diff --git a/ClangAstParser/resources/c/labels.c.txt b/ClangAstParser/test-resources/c/labels.c.txt similarity index 100% rename from ClangAstParser/resources/c/labels.c.txt rename to ClangAstParser/test-resources/c/labels.c.txt diff --git a/ClangAstParser/resources/c/macro.c b/ClangAstParser/test-resources/c/macro.c similarity index 100% rename from ClangAstParser/resources/c/macro.c rename to ClangAstParser/test-resources/c/macro.c diff --git a/ClangAstParser/resources/c/macro.c.txt b/ClangAstParser/test-resources/c/macro.c.txt similarity index 100% rename from ClangAstParser/resources/c/macro.c.txt rename to ClangAstParser/test-resources/c/macro.c.txt diff --git a/ClangAstParser/resources/c/macro.h b/ClangAstParser/test-resources/c/macro.h similarity index 100% rename from ClangAstParser/resources/c/macro.h rename to ClangAstParser/test-resources/c/macro.h diff --git a/ClangAstParser/resources/c/macro.h.txt b/ClangAstParser/test-resources/c/macro.h.txt similarity index 100% rename from ClangAstParser/resources/c/macro.h.txt rename to ClangAstParser/test-resources/c/macro.h.txt diff --git a/ClangAstParser/resources/c/naked_loops.c b/ClangAstParser/test-resources/c/naked_loops.c similarity index 100% rename from ClangAstParser/resources/c/naked_loops.c rename to ClangAstParser/test-resources/c/naked_loops.c diff --git a/ClangAstParser/resources/c/naked_loops.c.txt b/ClangAstParser/test-resources/c/naked_loops.c.txt similarity index 100% rename from ClangAstParser/resources/c/naked_loops.c.txt rename to ClangAstParser/test-resources/c/naked_loops.c.txt diff --git a/ClangAstParser/resources/c/offset.c b/ClangAstParser/test-resources/c/offset.c similarity index 100% rename from ClangAstParser/resources/c/offset.c rename to ClangAstParser/test-resources/c/offset.c diff --git a/ClangAstParser/resources/c/offset.c.txt b/ClangAstParser/test-resources/c/offset.c.txt similarity index 100% rename from ClangAstParser/resources/c/offset.c.txt rename to ClangAstParser/test-resources/c/offset.c.txt diff --git a/ClangAstParser/resources/c/predefined.c b/ClangAstParser/test-resources/c/predefined.c similarity index 100% rename from ClangAstParser/resources/c/predefined.c rename to ClangAstParser/test-resources/c/predefined.c diff --git a/ClangAstParser/resources/c/predefined.c.txt b/ClangAstParser/test-resources/c/predefined.c.txt similarity index 100% rename from ClangAstParser/resources/c/predefined.c.txt rename to ClangAstParser/test-resources/c/predefined.c.txt diff --git a/ClangAstParser/resources/c/sizeof.c b/ClangAstParser/test-resources/c/sizeof.c similarity index 100% rename from ClangAstParser/resources/c/sizeof.c rename to ClangAstParser/test-resources/c/sizeof.c diff --git a/ClangAstParser/resources/c/sizeof.c.txt b/ClangAstParser/test-resources/c/sizeof.c.txt similarity index 100% rename from ClangAstParser/resources/c/sizeof.c.txt rename to ClangAstParser/test-resources/c/sizeof.c.txt diff --git a/ClangAstParser/resources/c/struct.c b/ClangAstParser/test-resources/c/struct.c similarity index 100% rename from ClangAstParser/resources/c/struct.c rename to ClangAstParser/test-resources/c/struct.c diff --git a/ClangAstParser/resources/c/struct.c.txt b/ClangAstParser/test-resources/c/struct.c.txt similarity index 100% rename from ClangAstParser/resources/c/struct.c.txt rename to ClangAstParser/test-resources/c/struct.c.txt diff --git a/ClangAstParser/resources/c/struct2.c b/ClangAstParser/test-resources/c/struct2.c similarity index 100% rename from ClangAstParser/resources/c/struct2.c rename to ClangAstParser/test-resources/c/struct2.c diff --git a/ClangAstParser/resources/c/struct2.c.txt b/ClangAstParser/test-resources/c/struct2.c.txt similarity index 100% rename from ClangAstParser/resources/c/struct2.c.txt rename to ClangAstParser/test-resources/c/struct2.c.txt diff --git a/ClangAstParser/resources/c/switch.c b/ClangAstParser/test-resources/c/switch.c similarity index 100% rename from ClangAstParser/resources/c/switch.c rename to ClangAstParser/test-resources/c/switch.c diff --git a/ClangAstParser/resources/c/switch.c.txt b/ClangAstParser/test-resources/c/switch.c.txt similarity index 100% rename from ClangAstParser/resources/c/switch.c.txt rename to ClangAstParser/test-resources/c/switch.c.txt diff --git a/ClangAstParser/resources/c/timer_linux.c b/ClangAstParser/test-resources/c/timer_linux.c similarity index 100% rename from ClangAstParser/resources/c/timer_linux.c rename to ClangAstParser/test-resources/c/timer_linux.c diff --git a/ClangAstParser/resources/c/timer_linux.c.txt b/ClangAstParser/test-resources/c/timer_linux.c.txt similarity index 100% rename from ClangAstParser/resources/c/timer_linux.c.txt rename to ClangAstParser/test-resources/c/timer_linux.c.txt diff --git a/ClangAstParser/resources/c/timer_windows.c b/ClangAstParser/test-resources/c/timer_windows.c similarity index 100% rename from ClangAstParser/resources/c/timer_windows.c rename to ClangAstParser/test-resources/c/timer_windows.c diff --git a/ClangAstParser/resources/c/timer_windows.c.txt b/ClangAstParser/test-resources/c/timer_windows.c.txt similarity index 100% rename from ClangAstParser/resources/c/timer_windows.c.txt rename to ClangAstParser/test-resources/c/timer_windows.c.txt diff --git a/ClangAstParser/resources/c/types.c b/ClangAstParser/test-resources/c/types.c similarity index 100% rename from ClangAstParser/resources/c/types.c rename to ClangAstParser/test-resources/c/types.c diff --git a/ClangAstParser/resources/c/types.c.txt b/ClangAstParser/test-resources/c/types.c.txt similarity index 100% rename from ClangAstParser/resources/c/types.c.txt rename to ClangAstParser/test-resources/c/types.c.txt diff --git a/ClangAstParser/resources/c/variadic.c b/ClangAstParser/test-resources/c/variadic.c similarity index 100% rename from ClangAstParser/resources/c/variadic.c rename to ClangAstParser/test-resources/c/variadic.c diff --git a/ClangAstParser/resources/c/variadic.c.txt b/ClangAstParser/test-resources/c/variadic.c.txt similarity index 100% rename from ClangAstParser/resources/c/variadic.c.txt rename to ClangAstParser/test-resources/c/variadic.c.txt diff --git a/ClangAstParser/resources/clang/c/ast-dump-c-attr.c b/ClangAstParser/test-resources/clang/c/ast-dump-c-attr.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-dump-c-attr.c rename to ClangAstParser/test-resources/clang/c/ast-dump-c-attr.c diff --git a/ClangAstParser/resources/clang/c/ast-dump-expr.c b/ClangAstParser/test-resources/clang/c/ast-dump-expr.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-dump-expr.c rename to ClangAstParser/test-resources/clang/c/ast-dump-expr.c diff --git a/ClangAstParser/resources/clang/c/ast-dump-records.c b/ClangAstParser/test-resources/clang/c/ast-dump-records.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-dump-records.c rename to ClangAstParser/test-resources/clang/c/ast-dump-records.c diff --git a/ClangAstParser/resources/clang/c/ast-dump-stmt.c b/ClangAstParser/test-resources/clang/c/ast-dump-stmt.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-dump-stmt.c rename to ClangAstParser/test-resources/clang/c/ast-dump-stmt.c diff --git a/ClangAstParser/resources/clang/c/ast-print-bool.c b/ClangAstParser/test-resources/clang/c/ast-print-bool.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-print-bool.c rename to ClangAstParser/test-resources/clang/c/ast-print-bool.c diff --git a/ClangAstParser/resources/clang/c/ast-print-enum-decl.c b/ClangAstParser/test-resources/clang/c/ast-print-enum-decl.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-print-enum-decl.c rename to ClangAstParser/test-resources/clang/c/ast-print-enum-decl.c diff --git a/ClangAstParser/resources/clang/c/ast-print-record-decl.c b/ClangAstParser/test-resources/clang/c/ast-print-record-decl.c similarity index 100% rename from ClangAstParser/resources/clang/c/ast-print-record-decl.c rename to ClangAstParser/test-resources/clang/c/ast-print-record-decl.c diff --git a/ClangAstParser/resources/clang/c/attr-target-ast.c b/ClangAstParser/test-resources/clang/c/attr-target-ast.c similarity index 100% rename from ClangAstParser/resources/clang/c/attr-target-ast.c rename to ClangAstParser/test-resources/clang/c/attr-target-ast.c diff --git a/ClangAstParser/resources/clang/c/c-casts.c b/ClangAstParser/test-resources/clang/c/c-casts.c similarity index 100% rename from ClangAstParser/resources/clang/c/c-casts.c rename to ClangAstParser/test-resources/clang/c/c-casts.c diff --git a/ClangAstParser/resources/clang/c/fixed_point.c b/ClangAstParser/test-resources/clang/c/fixed_point.c similarity index 100% rename from ClangAstParser/resources/clang/c/fixed_point.c rename to ClangAstParser/test-resources/clang/c/fixed_point.c diff --git a/ClangAstParser/resources/clang/c/fixed_point_to_string.c b/ClangAstParser/test-resources/clang/c/fixed_point_to_string.c similarity index 100% rename from ClangAstParser/resources/clang/c/fixed_point_to_string.c rename to ClangAstParser/test-resources/clang/c/fixed_point_to_string.c diff --git a/ClangAstParser/resources/clang/c/implicit-cast-dump.c b/ClangAstParser/test-resources/clang/c/implicit-cast-dump.c similarity index 100% rename from ClangAstParser/resources/clang/c/implicit-cast-dump.c rename to ClangAstParser/test-resources/clang/c/implicit-cast-dump.c diff --git a/ClangAstParser/resources/clang/c/multistep-explicit-cast.c b/ClangAstParser/test-resources/clang/c/multistep-explicit-cast.c similarity index 100% rename from ClangAstParser/resources/clang/c/multistep-explicit-cast.c rename to ClangAstParser/test-resources/clang/c/multistep-explicit-cast.c diff --git a/ClangAstParser/resources/clang/c/rdr6094103-unordered-compare-promote.c b/ClangAstParser/test-resources/clang/c/rdr6094103-unordered-compare-promote.c similarity index 100% rename from ClangAstParser/resources/clang/c/rdr6094103-unordered-compare-promote.c rename to ClangAstParser/test-resources/clang/c/rdr6094103-unordered-compare-promote.c diff --git a/ClangAstParser/resources/clang/c/variadic-promotion.c b/ClangAstParser/test-resources/clang/c/variadic-promotion.c similarity index 100% rename from ClangAstParser/resources/clang/c/variadic-promotion.c rename to ClangAstParser/test-resources/clang/c/variadic-promotion.c diff --git a/ClangAstParser/resources/clang/cxx/ast-print-bool.cpp b/ClangAstParser/test-resources/clang/cxx/ast-print-bool.cpp similarity index 100% rename from ClangAstParser/resources/clang/cxx/ast-print-bool.cpp rename to ClangAstParser/test-resources/clang/cxx/ast-print-bool.cpp diff --git a/ClangAstParser/resources/clang/cxx/ast-print-record-decl.cpp b/ClangAstParser/test-resources/clang/cxx/ast-print-record-decl.cpp similarity index 100% rename from ClangAstParser/resources/clang/cxx/ast-print-record-decl.cpp rename to ClangAstParser/test-resources/clang/cxx/ast-print-record-decl.cpp diff --git a/ClangAstParser/resources/cxx/ArrayInitLoopExpr.cpp b/ClangAstParser/test-resources/cxx/ArrayInitLoopExpr.cpp similarity index 100% rename from ClangAstParser/resources/cxx/ArrayInitLoopExpr.cpp rename to ClangAstParser/test-resources/cxx/ArrayInitLoopExpr.cpp diff --git a/ClangAstParser/resources/cxx/ArrayInitLoopExpr.cpp.txt b/ClangAstParser/test-resources/cxx/ArrayInitLoopExpr.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/ArrayInitLoopExpr.cpp.txt rename to ClangAstParser/test-resources/cxx/ArrayInitLoopExpr.cpp.txt diff --git a/ClangAstParser/resources/cxx/ComplexType.cpp b/ClangAstParser/test-resources/cxx/ComplexType.cpp similarity index 100% rename from ClangAstParser/resources/cxx/ComplexType.cpp rename to ClangAstParser/test-resources/cxx/ComplexType.cpp diff --git a/ClangAstParser/resources/cxx/ComplexType.cpp.txt b/ClangAstParser/test-resources/cxx/ComplexType.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/ComplexType.cpp.txt rename to ClangAstParser/test-resources/cxx/ComplexType.cpp.txt diff --git a/ClangAstParser/resources/cxx/OMPParallelForDirective.cpp b/ClangAstParser/test-resources/cxx/OMPParallelForDirective.cpp similarity index 100% rename from ClangAstParser/resources/cxx/OMPParallelForDirective.cpp rename to ClangAstParser/test-resources/cxx/OMPParallelForDirective.cpp diff --git a/ClangAstParser/resources/cxx/OMPParallelForDirective.cpp.txt b/ClangAstParser/test-resources/cxx/OMPParallelForDirective.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/OMPParallelForDirective.cpp.txt rename to ClangAstParser/test-resources/cxx/OMPParallelForDirective.cpp.txt diff --git a/ClangAstParser/resources/cxx/TemplateTemplateParmDecl.cpp b/ClangAstParser/test-resources/cxx/TemplateTemplateParmDecl.cpp similarity index 100% rename from ClangAstParser/resources/cxx/TemplateTemplateParmDecl.cpp rename to ClangAstParser/test-resources/cxx/TemplateTemplateParmDecl.cpp diff --git a/ClangAstParser/resources/cxx/TemplateTemplateParmDecl.cpp.txt b/ClangAstParser/test-resources/cxx/TemplateTemplateParmDecl.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/TemplateTemplateParmDecl.cpp.txt rename to ClangAstParser/test-resources/cxx/TemplateTemplateParmDecl.cpp.txt diff --git a/ClangAstParser/resources/cxx/VectorType.cpp b/ClangAstParser/test-resources/cxx/VectorType.cpp similarity index 100% rename from ClangAstParser/resources/cxx/VectorType.cpp rename to ClangAstParser/test-resources/cxx/VectorType.cpp diff --git a/ClangAstParser/resources/cxx/VectorType.cpp.txt b/ClangAstParser/test-resources/cxx/VectorType.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/VectorType.cpp.txt rename to ClangAstParser/test-resources/cxx/VectorType.cpp.txt diff --git a/ClangAstParser/resources/cxx/attribute.cpp b/ClangAstParser/test-resources/cxx/attribute.cpp similarity index 100% rename from ClangAstParser/resources/cxx/attribute.cpp rename to ClangAstParser/test-resources/cxx/attribute.cpp diff --git a/ClangAstParser/resources/cxx/attribute.cpp.txt b/ClangAstParser/test-resources/cxx/attribute.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/attribute.cpp.txt rename to ClangAstParser/test-resources/cxx/attribute.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/Routing.cpp b/ClangAstParser/test-resources/cxx/bench/Routing.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/Routing.cpp rename to ClangAstParser/test-resources/cxx/bench/Routing.cpp diff --git a/ClangAstParser/resources/cxx/bench/Routing.cpp.txt b/ClangAstParser/test-resources/cxx/bench/Routing.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/Routing.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/Routing.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/ShortcutPosition.h b/ClangAstParser/test-resources/cxx/bench/ShortcutPosition.h similarity index 100% rename from ClangAstParser/resources/cxx/bench/ShortcutPosition.h rename to ClangAstParser/test-resources/cxx/bench/ShortcutPosition.h diff --git a/ClangAstParser/resources/cxx/bench/ShortcutPosition.h.txt b/ClangAstParser/test-resources/cxx/bench/ShortcutPosition.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/ShortcutPosition.h.txt rename to ClangAstParser/test-resources/cxx/bench/ShortcutPosition.h.txt diff --git a/ClangAstParser/resources/cxx/bench/atom.cpp b/ClangAstParser/test-resources/cxx/bench/atom.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/atom.cpp rename to ClangAstParser/test-resources/cxx/bench/atom.cpp diff --git a/ClangAstParser/resources/cxx/bench/atom.cpp.txt b/ClangAstParser/test-resources/cxx/bench/atom.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/atom.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/atom.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/blocked_mm.cpp b/ClangAstParser/test-resources/cxx/bench/blocked_mm.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/blocked_mm.cpp rename to ClangAstParser/test-resources/cxx/bench/blocked_mm.cpp diff --git a/ClangAstParser/resources/cxx/bench/blocked_mm.cpp.txt b/ClangAstParser/test-resources/cxx/bench/blocked_mm.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/blocked_mm.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/blocked_mm.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/fast_stack.cpp b/ClangAstParser/test-resources/cxx/bench/fast_stack.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/fast_stack.cpp rename to ClangAstParser/test-resources/cxx/bench/fast_stack.cpp diff --git a/ClangAstParser/resources/cxx/bench/fast_stack.cpp.txt b/ClangAstParser/test-resources/cxx/bench/fast_stack.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/fast_stack.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/fast_stack.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/mini_logger.hpp b/ClangAstParser/test-resources/cxx/bench/mini_logger.hpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/mini_logger.hpp rename to ClangAstParser/test-resources/cxx/bench/mini_logger.hpp diff --git a/ClangAstParser/resources/cxx/bench/mini_logger.hpp.txt b/ClangAstParser/test-resources/cxx/bench/mini_logger.hpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/mini_logger.hpp.txt rename to ClangAstParser/test-resources/cxx/bench/mini_logger.hpp.txt diff --git a/ClangAstParser/resources/cxx/bench/pair_hash.cpp b/ClangAstParser/test-resources/cxx/bench/pair_hash.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/pair_hash.cpp rename to ClangAstParser/test-resources/cxx/bench/pair_hash.cpp diff --git a/ClangAstParser/resources/cxx/bench/pair_hash.cpp.txt b/ClangAstParser/test-resources/cxx/bench/pair_hash.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/pair_hash.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/pair_hash.cpp.txt diff --git a/ClangAstParser/resources/cxx/bench/pair_hash.h b/ClangAstParser/test-resources/cxx/bench/pair_hash.h similarity index 100% rename from ClangAstParser/resources/cxx/bench/pair_hash.h rename to ClangAstParser/test-resources/cxx/bench/pair_hash.h diff --git a/ClangAstParser/resources/cxx/bench/pair_hash.h.txt b/ClangAstParser/test-resources/cxx/bench/pair_hash.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/pair_hash.h.txt rename to ClangAstParser/test-resources/cxx/bench/pair_hash.h.txt diff --git a/ClangAstParser/resources/cxx/bench/sorted_id.cpp b/ClangAstParser/test-resources/cxx/bench/sorted_id.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/sorted_id.cpp rename to ClangAstParser/test-resources/cxx/bench/sorted_id.cpp diff --git a/ClangAstParser/resources/cxx/bench/sorted_id.h b/ClangAstParser/test-resources/cxx/bench/sorted_id.h similarity index 100% rename from ClangAstParser/resources/cxx/bench/sorted_id.h rename to ClangAstParser/test-resources/cxx/bench/sorted_id.h diff --git a/ClangAstParser/resources/cxx/bench/template_expansion_pack.cpp b/ClangAstParser/test-resources/cxx/bench/template_expansion_pack.cpp similarity index 100% rename from ClangAstParser/resources/cxx/bench/template_expansion_pack.cpp rename to ClangAstParser/test-resources/cxx/bench/template_expansion_pack.cpp diff --git a/ClangAstParser/resources/cxx/bench/template_expansion_pack.cpp.txt b/ClangAstParser/test-resources/cxx/bench/template_expansion_pack.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/bench/template_expansion_pack.cpp.txt rename to ClangAstParser/test-resources/cxx/bench/template_expansion_pack.cpp.txt diff --git a/ClangAstParser/resources/cxx/boolean.cpp b/ClangAstParser/test-resources/cxx/boolean.cpp similarity index 100% rename from ClangAstParser/resources/cxx/boolean.cpp rename to ClangAstParser/test-resources/cxx/boolean.cpp diff --git a/ClangAstParser/resources/cxx/boolean.cpp.txt b/ClangAstParser/test-resources/cxx/boolean.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/boolean.cpp.txt rename to ClangAstParser/test-resources/cxx/boolean.cpp.txt diff --git a/ClangAstParser/resources/cxx/boost.cpp b/ClangAstParser/test-resources/cxx/boost.cpp similarity index 100% rename from ClangAstParser/resources/cxx/boost.cpp rename to ClangAstParser/test-resources/cxx/boost.cpp diff --git a/ClangAstParser/resources/cxx/boost.cpp.txt b/ClangAstParser/test-resources/cxx/boost.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/boost.cpp.txt rename to ClangAstParser/test-resources/cxx/boost.cpp.txt diff --git a/ClangAstParser/resources/cxx/builtin_types.cpp b/ClangAstParser/test-resources/cxx/builtin_types.cpp similarity index 100% rename from ClangAstParser/resources/cxx/builtin_types.cpp rename to ClangAstParser/test-resources/cxx/builtin_types.cpp diff --git a/ClangAstParser/resources/cxx/builtin_types.cpp.txt b/ClangAstParser/test-resources/cxx/builtin_types.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/builtin_types.cpp.txt rename to ClangAstParser/test-resources/cxx/builtin_types.cpp.txt diff --git a/ClangAstParser/resources/cxx/character.cpp b/ClangAstParser/test-resources/cxx/character.cpp similarity index 100% rename from ClangAstParser/resources/cxx/character.cpp rename to ClangAstParser/test-resources/cxx/character.cpp diff --git a/ClangAstParser/resources/cxx/character.cpp.txt b/ClangAstParser/test-resources/cxx/character.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/character.cpp.txt rename to ClangAstParser/test-resources/cxx/character.cpp.txt diff --git a/ClangAstParser/resources/cxx/class_template.cpp b/ClangAstParser/test-resources/cxx/class_template.cpp similarity index 100% rename from ClangAstParser/resources/cxx/class_template.cpp rename to ClangAstParser/test-resources/cxx/class_template.cpp diff --git a/ClangAstParser/resources/cxx/class_template.cpp.txt b/ClangAstParser/test-resources/cxx/class_template.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/class_template.cpp.txt rename to ClangAstParser/test-resources/cxx/class_template.cpp.txt diff --git a/ClangAstParser/resources/cxx/class_template.h b/ClangAstParser/test-resources/cxx/class_template.h similarity index 100% rename from ClangAstParser/resources/cxx/class_template.h rename to ClangAstParser/test-resources/cxx/class_template.h diff --git a/ClangAstParser/resources/cxx/class_template.h.txt b/ClangAstParser/test-resources/cxx/class_template.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/class_template.h.txt rename to ClangAstParser/test-resources/cxx/class_template.h.txt diff --git a/ClangAstParser/resources/cxx/classes.cpp b/ClangAstParser/test-resources/cxx/classes.cpp similarity index 100% rename from ClangAstParser/resources/cxx/classes.cpp rename to ClangAstParser/test-resources/cxx/classes.cpp diff --git a/ClangAstParser/resources/cxx/classes.cpp.txt b/ClangAstParser/test-resources/cxx/classes.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/classes.cpp.txt rename to ClangAstParser/test-resources/cxx/classes.cpp.txt diff --git a/ClangAstParser/resources/cxx/comment.cpp b/ClangAstParser/test-resources/cxx/comment.cpp similarity index 100% rename from ClangAstParser/resources/cxx/comment.cpp rename to ClangAstParser/test-resources/cxx/comment.cpp diff --git a/ClangAstParser/resources/cxx/comment.cpp.txt b/ClangAstParser/test-resources/cxx/comment.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/comment.cpp.txt rename to ClangAstParser/test-resources/cxx/comment.cpp.txt diff --git a/ClangAstParser/resources/cxx/comment_include.cpp b/ClangAstParser/test-resources/cxx/comment_include.cpp similarity index 100% rename from ClangAstParser/resources/cxx/comment_include.cpp rename to ClangAstParser/test-resources/cxx/comment_include.cpp diff --git a/ClangAstParser/resources/cxx/comment_include.cpp.txt b/ClangAstParser/test-resources/cxx/comment_include.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/comment_include.cpp.txt rename to ClangAstParser/test-resources/cxx/comment_include.cpp.txt diff --git a/ClangAstParser/resources/cxx/constructor.cpp b/ClangAstParser/test-resources/cxx/constructor.cpp similarity index 100% rename from ClangAstParser/resources/cxx/constructor.cpp rename to ClangAstParser/test-resources/cxx/constructor.cpp diff --git a/ClangAstParser/resources/cxx/constructor.cpp.txt b/ClangAstParser/test-resources/cxx/constructor.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/constructor.cpp.txt rename to ClangAstParser/test-resources/cxx/constructor.cpp.txt diff --git a/ClangAstParser/resources/cxx/constructor.h b/ClangAstParser/test-resources/cxx/constructor.h similarity index 100% rename from ClangAstParser/resources/cxx/constructor.h rename to ClangAstParser/test-resources/cxx/constructor.h diff --git a/ClangAstParser/resources/cxx/constructor.h.txt b/ClangAstParser/test-resources/cxx/constructor.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/constructor.h.txt rename to ClangAstParser/test-resources/cxx/constructor.h.txt diff --git a/ClangAstParser/resources/cxx/cuda/atomicAdd.cu b/ClangAstParser/test-resources/cxx/cuda/atomicAdd.cu similarity index 100% rename from ClangAstParser/resources/cxx/cuda/atomicAdd.cu rename to ClangAstParser/test-resources/cxx/cuda/atomicAdd.cu diff --git a/ClangAstParser/resources/cxx/cuda/atomicAdd.cu.txt b/ClangAstParser/test-resources/cxx/cuda/atomicAdd.cu.txt similarity index 100% rename from ClangAstParser/resources/cxx/cuda/atomicAdd.cu.txt rename to ClangAstParser/test-resources/cxx/cuda/atomicAdd.cu.txt diff --git a/ClangAstParser/resources/cxx/cuda/convolution_cache.cu b/ClangAstParser/test-resources/cxx/cuda/convolution_cache.cu similarity index 100% rename from ClangAstParser/resources/cxx/cuda/convolution_cache.cu rename to ClangAstParser/test-resources/cxx/cuda/convolution_cache.cu diff --git a/ClangAstParser/resources/cxx/cuda/convolution_cache.cu.txt b/ClangAstParser/test-resources/cxx/cuda/convolution_cache.cu.txt similarity index 100% rename from ClangAstParser/resources/cxx/cuda/convolution_cache.cu.txt rename to ClangAstParser/test-resources/cxx/cuda/convolution_cache.cu.txt diff --git a/ClangAstParser/resources/cxx/cuda/mult_matrix.cu b/ClangAstParser/test-resources/cxx/cuda/mult_matrix.cu similarity index 100% rename from ClangAstParser/resources/cxx/cuda/mult_matrix.cu rename to ClangAstParser/test-resources/cxx/cuda/mult_matrix.cu diff --git a/ClangAstParser/resources/cxx/cuda/mult_matrix.cu.txt b/ClangAstParser/test-resources/cxx/cuda/mult_matrix.cu.txt similarity index 100% rename from ClangAstParser/resources/cxx/cuda/mult_matrix.cu.txt rename to ClangAstParser/test-resources/cxx/cuda/mult_matrix.cu.txt diff --git a/ClangAstParser/resources/cxx/cuda/streamAdd.cu b/ClangAstParser/test-resources/cxx/cuda/streamAdd.cu similarity index 100% rename from ClangAstParser/resources/cxx/cuda/streamAdd.cu rename to ClangAstParser/test-resources/cxx/cuda/streamAdd.cu diff --git a/ClangAstParser/resources/cxx/cuda/streamAdd.cu.txt b/ClangAstParser/test-resources/cxx/cuda/streamAdd.cu.txt similarity index 100% rename from ClangAstParser/resources/cxx/cuda/streamAdd.cu.txt rename to ClangAstParser/test-resources/cxx/cuda/streamAdd.cu.txt diff --git a/ClangAstParser/resources/cxx/cuda/sumArrays.cu b/ClangAstParser/test-resources/cxx/cuda/sumArrays.cu similarity index 100% rename from ClangAstParser/resources/cxx/cuda/sumArrays.cu rename to ClangAstParser/test-resources/cxx/cuda/sumArrays.cu diff --git a/ClangAstParser/resources/cxx/cuda/sumArrays.cu.txt b/ClangAstParser/test-resources/cxx/cuda/sumArrays.cu.txt similarity index 100% rename from ClangAstParser/resources/cxx/cuda/sumArrays.cu.txt rename to ClangAstParser/test-resources/cxx/cuda/sumArrays.cu.txt diff --git a/ClangAstParser/resources/cxx/data1.dat b/ClangAstParser/test-resources/cxx/data1.dat similarity index 100% rename from ClangAstParser/resources/cxx/data1.dat rename to ClangAstParser/test-resources/cxx/data1.dat diff --git a/ClangAstParser/resources/cxx/dbl_max.cpp b/ClangAstParser/test-resources/cxx/dbl_max.cpp similarity index 100% rename from ClangAstParser/resources/cxx/dbl_max.cpp rename to ClangAstParser/test-resources/cxx/dbl_max.cpp diff --git a/ClangAstParser/resources/cxx/dbl_max.cpp.txt b/ClangAstParser/test-resources/cxx/dbl_max.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/dbl_max.cpp.txt rename to ClangAstParser/test-resources/cxx/dbl_max.cpp.txt diff --git a/ClangAstParser/resources/cxx/decl_unix.cpp b/ClangAstParser/test-resources/cxx/decl_unix.cpp similarity index 100% rename from ClangAstParser/resources/cxx/decl_unix.cpp rename to ClangAstParser/test-resources/cxx/decl_unix.cpp diff --git a/ClangAstParser/resources/cxx/decl_unix.cpp.txt b/ClangAstParser/test-resources/cxx/decl_unix.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/decl_unix.cpp.txt rename to ClangAstParser/test-resources/cxx/decl_unix.cpp.txt diff --git a/ClangAstParser/resources/cxx/decl_windows.cpp b/ClangAstParser/test-resources/cxx/decl_windows.cpp similarity index 100% rename from ClangAstParser/resources/cxx/decl_windows.cpp rename to ClangAstParser/test-resources/cxx/decl_windows.cpp diff --git a/ClangAstParser/resources/cxx/decl_windows.cpp.txt b/ClangAstParser/test-resources/cxx/decl_windows.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/decl_windows.cpp.txt rename to ClangAstParser/test-resources/cxx/decl_windows.cpp.txt diff --git a/ClangAstParser/resources/cxx/default.h b/ClangAstParser/test-resources/cxx/default.h similarity index 100% rename from ClangAstParser/resources/cxx/default.h rename to ClangAstParser/test-resources/cxx/default.h diff --git a/ClangAstParser/resources/cxx/default.h.txt b/ClangAstParser/test-resources/cxx/default.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/default.h.txt rename to ClangAstParser/test-resources/cxx/default.h.txt diff --git a/ClangAstParser/resources/cxx/dependent_scope_decl_ref_expr.cpp b/ClangAstParser/test-resources/cxx/dependent_scope_decl_ref_expr.cpp similarity index 100% rename from ClangAstParser/resources/cxx/dependent_scope_decl_ref_expr.cpp rename to ClangAstParser/test-resources/cxx/dependent_scope_decl_ref_expr.cpp diff --git a/ClangAstParser/resources/cxx/dependent_scope_decl_ref_expr.cpp.txt b/ClangAstParser/test-resources/cxx/dependent_scope_decl_ref_expr.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/dependent_scope_decl_ref_expr.cpp.txt rename to ClangAstParser/test-resources/cxx/dependent_scope_decl_ref_expr.cpp.txt diff --git a/ClangAstParser/resources/cxx/destructor.cpp b/ClangAstParser/test-resources/cxx/destructor.cpp similarity index 100% rename from ClangAstParser/resources/cxx/destructor.cpp rename to ClangAstParser/test-resources/cxx/destructor.cpp diff --git a/ClangAstParser/resources/cxx/destructor.cpp.txt_ b/ClangAstParser/test-resources/cxx/destructor.cpp.txt_ similarity index 100% rename from ClangAstParser/resources/cxx/destructor.cpp.txt_ rename to ClangAstParser/test-resources/cxx/destructor.cpp.txt_ diff --git a/ClangAstParser/resources/cxx/enum.cpp b/ClangAstParser/test-resources/cxx/enum.cpp similarity index 100% rename from ClangAstParser/resources/cxx/enum.cpp rename to ClangAstParser/test-resources/cxx/enum.cpp diff --git a/ClangAstParser/resources/cxx/enum.cpp.txt b/ClangAstParser/test-resources/cxx/enum.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/enum.cpp.txt rename to ClangAstParser/test-resources/cxx/enum.cpp.txt diff --git a/ClangAstParser/resources/cxx/enum.hpp b/ClangAstParser/test-resources/cxx/enum.hpp similarity index 100% rename from ClangAstParser/resources/cxx/enum.hpp rename to ClangAstParser/test-resources/cxx/enum.hpp diff --git a/ClangAstParser/resources/cxx/enum.hpp.txt b/ClangAstParser/test-resources/cxx/enum.hpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/enum.hpp.txt rename to ClangAstParser/test-resources/cxx/enum.hpp.txt diff --git a/ClangAstParser/resources/cxx/exceptions.cpp b/ClangAstParser/test-resources/cxx/exceptions.cpp similarity index 100% rename from ClangAstParser/resources/cxx/exceptions.cpp rename to ClangAstParser/test-resources/cxx/exceptions.cpp diff --git a/ClangAstParser/resources/cxx/exceptions.cpp.txt b/ClangAstParser/test-resources/cxx/exceptions.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/exceptions.cpp.txt rename to ClangAstParser/test-resources/cxx/exceptions.cpp.txt diff --git a/ClangAstParser/resources/cxx/for.cpp b/ClangAstParser/test-resources/cxx/for.cpp similarity index 100% rename from ClangAstParser/resources/cxx/for.cpp rename to ClangAstParser/test-resources/cxx/for.cpp diff --git a/ClangAstParser/resources/cxx/for.cpp.txt b/ClangAstParser/test-resources/cxx/for.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/for.cpp.txt rename to ClangAstParser/test-resources/cxx/for.cpp.txt diff --git a/ClangAstParser/resources/cxx/friend.cpp b/ClangAstParser/test-resources/cxx/friend.cpp similarity index 100% rename from ClangAstParser/resources/cxx/friend.cpp rename to ClangAstParser/test-resources/cxx/friend.cpp diff --git a/ClangAstParser/resources/cxx/friend.cpp.txt b/ClangAstParser/test-resources/cxx/friend.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/friend.cpp.txt rename to ClangAstParser/test-resources/cxx/friend.cpp.txt diff --git a/ClangAstParser/resources/cxx/functions.cpp b/ClangAstParser/test-resources/cxx/functions.cpp similarity index 100% rename from ClangAstParser/resources/cxx/functions.cpp rename to ClangAstParser/test-resources/cxx/functions.cpp diff --git a/ClangAstParser/resources/cxx/functions.cpp.txt b/ClangAstParser/test-resources/cxx/functions.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/functions.cpp.txt rename to ClangAstParser/test-resources/cxx/functions.cpp.txt diff --git a/ClangAstParser/resources/cxx/gnu_extensions.cpp b/ClangAstParser/test-resources/cxx/gnu_extensions.cpp similarity index 100% rename from ClangAstParser/resources/cxx/gnu_extensions.cpp rename to ClangAstParser/test-resources/cxx/gnu_extensions.cpp diff --git a/ClangAstParser/resources/cxx/gnu_extensions.cpp.txt b/ClangAstParser/test-resources/cxx/gnu_extensions.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/gnu_extensions.cpp.txt rename to ClangAstParser/test-resources/cxx/gnu_extensions.cpp.txt diff --git a/ClangAstParser/resources/cxx/if.cpp b/ClangAstParser/test-resources/cxx/if.cpp similarity index 100% rename from ClangAstParser/resources/cxx/if.cpp rename to ClangAstParser/test-resources/cxx/if.cpp diff --git a/ClangAstParser/resources/cxx/if.cpp.txt b/ClangAstParser/test-resources/cxx/if.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/if.cpp.txt rename to ClangAstParser/test-resources/cxx/if.cpp.txt diff --git a/ClangAstParser/resources/cxx/includes.cpp b/ClangAstParser/test-resources/cxx/includes.cpp similarity index 100% rename from ClangAstParser/resources/cxx/includes.cpp rename to ClangAstParser/test-resources/cxx/includes.cpp diff --git a/ClangAstParser/resources/cxx/includes.cpp.txt b/ClangAstParser/test-resources/cxx/includes.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/includes.cpp.txt rename to ClangAstParser/test-resources/cxx/includes.cpp.txt diff --git a/ClangAstParser/resources/cxx/includes.h b/ClangAstParser/test-resources/cxx/includes.h similarity index 100% rename from ClangAstParser/resources/cxx/includes.h rename to ClangAstParser/test-resources/cxx/includes.h diff --git a/ClangAstParser/resources/cxx/includes.h.txt b/ClangAstParser/test-resources/cxx/includes.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/includes.h.txt rename to ClangAstParser/test-resources/cxx/includes.h.txt diff --git a/ClangAstParser/resources/cxx/includes2.cpp b/ClangAstParser/test-resources/cxx/includes2.cpp similarity index 100% rename from ClangAstParser/resources/cxx/includes2.cpp rename to ClangAstParser/test-resources/cxx/includes2.cpp diff --git a/ClangAstParser/resources/cxx/includes2.cpp.txt b/ClangAstParser/test-resources/cxx/includes2.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/includes2.cpp.txt rename to ClangAstParser/test-resources/cxx/includes2.cpp.txt diff --git a/ClangAstParser/resources/cxx/includes2.h b/ClangAstParser/test-resources/cxx/includes2.h similarity index 100% rename from ClangAstParser/resources/cxx/includes2.h rename to ClangAstParser/test-resources/cxx/includes2.h diff --git a/ClangAstParser/resources/cxx/includes2.h.txt b/ClangAstParser/test-resources/cxx/includes2.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/includes2.h.txt rename to ClangAstParser/test-resources/cxx/includes2.h.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue09.h b/ClangAstParser/test-resources/cxx/issues/clava_issue09.h similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue09.h rename to ClangAstParser/test-resources/cxx/issues/clava_issue09.h diff --git a/ClangAstParser/resources/cxx/issues/clava_issue09.h.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue09.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue09.h.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue09.h.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue10.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue10.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue10.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue10.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue10.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue10.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue10.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue10.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue11.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue11.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue11.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue11.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue11.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue11.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue11.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue11.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue13.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue13.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue13.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue13.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue13.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue13.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue13.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue13.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue14.h b/ClangAstParser/test-resources/cxx/issues/clava_issue14.h similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue14.h rename to ClangAstParser/test-resources/cxx/issues/clava_issue14.h diff --git a/ClangAstParser/resources/cxx/issues/clava_issue14.h.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue14.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue14.h.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue14.h.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue15.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue15.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue15.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue15.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue15.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue15.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue15.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue15.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue17.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue17.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue17.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue17.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue17.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue17.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue17.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue17.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue18.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue18.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue18.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue18.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue18.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue18.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue18.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue18.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue19.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue19.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue19.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue19.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue19.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue19.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue19.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue19.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue20.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue20.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue20.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue20.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue20.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue20.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue20.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue20.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue21.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue21.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue21.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue21.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue21.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue21.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue21.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue21.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue24.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue24.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue24.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue24.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue24.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue24.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue24.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue24.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue25.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue25.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue25.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue25.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue25.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue25.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue25.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue25.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue26.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue26.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue26.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue26.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue26.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue26.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue26.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue26.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue27.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue27.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue27.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue27.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue27.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue27.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue27.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue27.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue28.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue28.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue28.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue28.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue28.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue28.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue28.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue28.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue28.h b/ClangAstParser/test-resources/cxx/issues/clava_issue28.h similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue28.h rename to ClangAstParser/test-resources/cxx/issues/clava_issue28.h diff --git a/ClangAstParser/resources/cxx/issues/clava_issue28.h.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue28.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue28.h.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue28.h.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue29.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue29.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue29.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue29.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue29.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue29.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue29.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue29.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue39.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue39.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue39.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue39.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue39.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue39.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue39.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue39.cpp.txt diff --git a/ClangAstParser/resources/cxx/issues/clava_issue40.cpp b/ClangAstParser/test-resources/cxx/issues/clava_issue40.cpp similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue40.cpp rename to ClangAstParser/test-resources/cxx/issues/clava_issue40.cpp diff --git a/ClangAstParser/resources/cxx/issues/clava_issue40.cpp.txt b/ClangAstParser/test-resources/cxx/issues/clava_issue40.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/issues/clava_issue40.cpp.txt rename to ClangAstParser/test-resources/cxx/issues/clava_issue40.cpp.txt diff --git a/ClangAstParser/resources/cxx/lambda.cpp b/ClangAstParser/test-resources/cxx/lambda.cpp similarity index 100% rename from ClangAstParser/resources/cxx/lambda.cpp rename to ClangAstParser/test-resources/cxx/lambda.cpp diff --git a/ClangAstParser/resources/cxx/lambda.cpp.txt b/ClangAstParser/test-resources/cxx/lambda.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/lambda.cpp.txt rename to ClangAstParser/test-resources/cxx/lambda.cpp.txt diff --git a/ClangAstParser/resources/cxx/lambda_test.cpp b/ClangAstParser/test-resources/cxx/lambda_test.cpp similarity index 100% rename from ClangAstParser/resources/cxx/lambda_test.cpp rename to ClangAstParser/test-resources/cxx/lambda_test.cpp diff --git a/ClangAstParser/resources/cxx/literals.cpp b/ClangAstParser/test-resources/cxx/literals.cpp similarity index 100% rename from ClangAstParser/resources/cxx/literals.cpp rename to ClangAstParser/test-resources/cxx/literals.cpp diff --git a/ClangAstParser/resources/cxx/literals.cpp.txt b/ClangAstParser/test-resources/cxx/literals.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/literals.cpp.txt rename to ClangAstParser/test-resources/cxx/literals.cpp.txt diff --git a/ClangAstParser/resources/cxx/member_calls.cpp b/ClangAstParser/test-resources/cxx/member_calls.cpp similarity index 100% rename from ClangAstParser/resources/cxx/member_calls.cpp rename to ClangAstParser/test-resources/cxx/member_calls.cpp diff --git a/ClangAstParser/resources/cxx/member_calls.cpp.txt b/ClangAstParser/test-resources/cxx/member_calls.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/member_calls.cpp.txt rename to ClangAstParser/test-resources/cxx/member_calls.cpp.txt diff --git a/ClangAstParser/resources/cxx/multiple_clauses_omp_pragmas.cpp b/ClangAstParser/test-resources/cxx/multiple_clauses_omp_pragmas.cpp similarity index 100% rename from ClangAstParser/resources/cxx/multiple_clauses_omp_pragmas.cpp rename to ClangAstParser/test-resources/cxx/multiple_clauses_omp_pragmas.cpp diff --git a/ClangAstParser/resources/cxx/multiple_clauses_omp_pragmas.cpp.txt b/ClangAstParser/test-resources/cxx/multiple_clauses_omp_pragmas.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/multiple_clauses_omp_pragmas.cpp.txt rename to ClangAstParser/test-resources/cxx/multiple_clauses_omp_pragmas.cpp.txt diff --git a/ClangAstParser/resources/cxx/namespace.c.txt b/ClangAstParser/test-resources/cxx/namespace.c.txt similarity index 100% rename from ClangAstParser/resources/cxx/namespace.c.txt rename to ClangAstParser/test-resources/cxx/namespace.c.txt diff --git a/ClangAstParser/resources/cxx/namespace.cpp b/ClangAstParser/test-resources/cxx/namespace.cpp similarity index 100% rename from ClangAstParser/resources/cxx/namespace.cpp rename to ClangAstParser/test-resources/cxx/namespace.cpp diff --git a/ClangAstParser/resources/cxx/namespace.h b/ClangAstParser/test-resources/cxx/namespace.h similarity index 100% rename from ClangAstParser/resources/cxx/namespace.h rename to ClangAstParser/test-resources/cxx/namespace.h diff --git a/ClangAstParser/resources/cxx/namespace.h.txt b/ClangAstParser/test-resources/cxx/namespace.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/namespace.h.txt rename to ClangAstParser/test-resources/cxx/namespace.h.txt diff --git a/ClangAstParser/resources/cxx/namespacealias.cpp b/ClangAstParser/test-resources/cxx/namespacealias.cpp similarity index 100% rename from ClangAstParser/resources/cxx/namespacealias.cpp rename to ClangAstParser/test-resources/cxx/namespacealias.cpp diff --git a/ClangAstParser/resources/cxx/namespacealias.cpp.txt b/ClangAstParser/test-resources/cxx/namespacealias.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/namespacealias.cpp.txt rename to ClangAstParser/test-resources/cxx/namespacealias.cpp.txt diff --git a/ClangAstParser/resources/cxx/new.cpp b/ClangAstParser/test-resources/cxx/new.cpp similarity index 100% rename from ClangAstParser/resources/cxx/new.cpp rename to ClangAstParser/test-resources/cxx/new.cpp diff --git a/ClangAstParser/resources/cxx/new.cpp.txt b/ClangAstParser/test-resources/cxx/new.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/new.cpp.txt rename to ClangAstParser/test-resources/cxx/new.cpp.txt diff --git a/ClangAstParser/resources/cxx/noexcept.cpp b/ClangAstParser/test-resources/cxx/noexcept.cpp similarity index 100% rename from ClangAstParser/resources/cxx/noexcept.cpp rename to ClangAstParser/test-resources/cxx/noexcept.cpp diff --git a/ClangAstParser/resources/cxx/noexcept.cpp.txt b/ClangAstParser/test-resources/cxx/noexcept.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/noexcept.cpp.txt rename to ClangAstParser/test-resources/cxx/noexcept.cpp.txt diff --git a/ClangAstParser/resources/cxx/offset.cpp b/ClangAstParser/test-resources/cxx/offset.cpp similarity index 100% rename from ClangAstParser/resources/cxx/offset.cpp rename to ClangAstParser/test-resources/cxx/offset.cpp diff --git a/ClangAstParser/resources/cxx/offset.cpp.txt b/ClangAstParser/test-resources/cxx/offset.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/offset.cpp.txt rename to ClangAstParser/test-resources/cxx/offset.cpp.txt diff --git a/ClangAstParser/resources/cxx/omp_pragmas.cpp b/ClangAstParser/test-resources/cxx/omp_pragmas.cpp similarity index 100% rename from ClangAstParser/resources/cxx/omp_pragmas.cpp rename to ClangAstParser/test-resources/cxx/omp_pragmas.cpp diff --git a/ClangAstParser/resources/cxx/omp_pragmas.cpp.txt b/ClangAstParser/test-resources/cxx/omp_pragmas.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/omp_pragmas.cpp.txt rename to ClangAstParser/test-resources/cxx/omp_pragmas.cpp.txt diff --git a/ClangAstParser/resources/cxx/operator.cpp b/ClangAstParser/test-resources/cxx/operator.cpp similarity index 100% rename from ClangAstParser/resources/cxx/operator.cpp rename to ClangAstParser/test-resources/cxx/operator.cpp diff --git a/ClangAstParser/resources/cxx/operator.cpp.txt b/ClangAstParser/test-resources/cxx/operator.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/operator.cpp.txt rename to ClangAstParser/test-resources/cxx/operator.cpp.txt diff --git a/ClangAstParser/resources/cxx/pointer_to_member_operators.cpp b/ClangAstParser/test-resources/cxx/pointer_to_member_operators.cpp similarity index 100% rename from ClangAstParser/resources/cxx/pointer_to_member_operators.cpp rename to ClangAstParser/test-resources/cxx/pointer_to_member_operators.cpp diff --git a/ClangAstParser/resources/cxx/pointer_to_member_operators.cpp.txt b/ClangAstParser/test-resources/cxx/pointer_to_member_operators.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/pointer_to_member_operators.cpp.txt rename to ClangAstParser/test-resources/cxx/pointer_to_member_operators.cpp.txt diff --git a/ClangAstParser/resources/cxx/pragmas.cpp b/ClangAstParser/test-resources/cxx/pragmas.cpp similarity index 100% rename from ClangAstParser/resources/cxx/pragmas.cpp rename to ClangAstParser/test-resources/cxx/pragmas.cpp diff --git a/ClangAstParser/resources/cxx/pragmas.cpp.txt b/ClangAstParser/test-resources/cxx/pragmas.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/pragmas.cpp.txt rename to ClangAstParser/test-resources/cxx/pragmas.cpp.txt diff --git a/ClangAstParser/resources/cxx/problematic/dummy.cpp b/ClangAstParser/test-resources/cxx/problematic/dummy.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/dummy.cpp rename to ClangAstParser/test-resources/cxx/problematic/dummy.cpp diff --git a/ClangAstParser/resources/cxx/problematic/implicit_reference.cpp b/ClangAstParser/test-resources/cxx/problematic/implicit_reference.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/implicit_reference.cpp rename to ClangAstParser/test-resources/cxx/problematic/implicit_reference.cpp diff --git a/ClangAstParser/resources/cxx/problematic/ms_asm.cpp b/ClangAstParser/test-resources/cxx/problematic/ms_asm.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/ms_asm.cpp rename to ClangAstParser/test-resources/cxx/problematic/ms_asm.cpp diff --git a/ClangAstParser/resources/cxx/problematic/operator.cpp b/ClangAstParser/test-resources/cxx/problematic/operator.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/operator.cpp rename to ClangAstParser/test-resources/cxx/problematic/operator.cpp diff --git a/ClangAstParser/resources/cxx/problematic/operator.cpp.txt b/ClangAstParser/test-resources/cxx/problematic/operator.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/problematic/operator.cpp.txt rename to ClangAstParser/test-resources/cxx/problematic/operator.cpp.txt diff --git a/ClangAstParser/resources/cxx/problematic/template_auto.cpp b/ClangAstParser/test-resources/cxx/problematic/template_auto.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/template_auto.cpp rename to ClangAstParser/test-resources/cxx/problematic/template_auto.cpp diff --git a/ClangAstParser/resources/cxx/problematic/template_expansion_pack.cpp b/ClangAstParser/test-resources/cxx/problematic/template_expansion_pack.cpp similarity index 100% rename from ClangAstParser/resources/cxx/problematic/template_expansion_pack.cpp rename to ClangAstParser/test-resources/cxx/problematic/template_expansion_pack.cpp diff --git a/ClangAstParser/resources/cxx/pseudo_destructor.cpp b/ClangAstParser/test-resources/cxx/pseudo_destructor.cpp similarity index 100% rename from ClangAstParser/resources/cxx/pseudo_destructor.cpp rename to ClangAstParser/test-resources/cxx/pseudo_destructor.cpp diff --git a/ClangAstParser/resources/cxx/pseudo_destructor.cpp.txt b/ClangAstParser/test-resources/cxx/pseudo_destructor.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/pseudo_destructor.cpp.txt rename to ClangAstParser/test-resources/cxx/pseudo_destructor.cpp.txt diff --git a/ClangAstParser/resources/cxx/qualifiers.cpp b/ClangAstParser/test-resources/cxx/qualifiers.cpp similarity index 100% rename from ClangAstParser/resources/cxx/qualifiers.cpp rename to ClangAstParser/test-resources/cxx/qualifiers.cpp diff --git a/ClangAstParser/resources/cxx/qualifiers.cpp.txt b/ClangAstParser/test-resources/cxx/qualifiers.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/qualifiers.cpp.txt rename to ClangAstParser/test-resources/cxx/qualifiers.cpp.txt diff --git a/ClangAstParser/resources/cxx/scope.cpp b/ClangAstParser/test-resources/cxx/scope.cpp similarity index 100% rename from ClangAstParser/resources/cxx/scope.cpp rename to ClangAstParser/test-resources/cxx/scope.cpp diff --git a/ClangAstParser/resources/cxx/scope.cpp.txt b/ClangAstParser/test-resources/cxx/scope.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/scope.cpp.txt rename to ClangAstParser/test-resources/cxx/scope.cpp.txt diff --git a/ClangAstParser/resources/cxx/sizeof.cpp b/ClangAstParser/test-resources/cxx/sizeof.cpp similarity index 100% rename from ClangAstParser/resources/cxx/sizeof.cpp rename to ClangAstParser/test-resources/cxx/sizeof.cpp diff --git a/ClangAstParser/resources/cxx/sizeof.cpp.txt b/ClangAstParser/test-resources/cxx/sizeof.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/sizeof.cpp.txt rename to ClangAstParser/test-resources/cxx/sizeof.cpp.txt diff --git a/ClangAstParser/resources/cxx/strings.cpp b/ClangAstParser/test-resources/cxx/strings.cpp similarity index 100% rename from ClangAstParser/resources/cxx/strings.cpp rename to ClangAstParser/test-resources/cxx/strings.cpp diff --git a/ClangAstParser/resources/cxx/strings.cpp.txt b/ClangAstParser/test-resources/cxx/strings.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/strings.cpp.txt rename to ClangAstParser/test-resources/cxx/strings.cpp.txt diff --git a/ClangAstParser/resources/cxx/struct.cpp b/ClangAstParser/test-resources/cxx/struct.cpp similarity index 100% rename from ClangAstParser/resources/cxx/struct.cpp rename to ClangAstParser/test-resources/cxx/struct.cpp diff --git a/ClangAstParser/resources/cxx/struct.cpp.txt b/ClangAstParser/test-resources/cxx/struct.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/struct.cpp.txt rename to ClangAstParser/test-resources/cxx/struct.cpp.txt diff --git a/ClangAstParser/resources/cxx/templates.cpp b/ClangAstParser/test-resources/cxx/templates.cpp similarity index 100% rename from ClangAstParser/resources/cxx/templates.cpp rename to ClangAstParser/test-resources/cxx/templates.cpp diff --git a/ClangAstParser/resources/cxx/templates.cpp.txt b/ClangAstParser/test-resources/cxx/templates.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/templates.cpp.txt rename to ClangAstParser/test-resources/cxx/templates.cpp.txt diff --git a/ClangAstParser/resources/cxx/templates.h b/ClangAstParser/test-resources/cxx/templates.h similarity index 100% rename from ClangAstParser/resources/cxx/templates.h rename to ClangAstParser/test-resources/cxx/templates.h diff --git a/ClangAstParser/resources/cxx/templates.h.txt b/ClangAstParser/test-resources/cxx/templates.h.txt similarity index 100% rename from ClangAstParser/resources/cxx/templates.h.txt rename to ClangAstParser/test-resources/cxx/templates.h.txt diff --git a/ClangAstParser/resources/cxx/throw.cpp b/ClangAstParser/test-resources/cxx/throw.cpp similarity index 100% rename from ClangAstParser/resources/cxx/throw.cpp rename to ClangAstParser/test-resources/cxx/throw.cpp diff --git a/ClangAstParser/resources/cxx/throw.cpp.txt b/ClangAstParser/test-resources/cxx/throw.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/throw.cpp.txt rename to ClangAstParser/test-resources/cxx/throw.cpp.txt diff --git a/ClangAstParser/resources/cxx/types.cpp b/ClangAstParser/test-resources/cxx/types.cpp similarity index 100% rename from ClangAstParser/resources/cxx/types.cpp rename to ClangAstParser/test-resources/cxx/types.cpp diff --git a/ClangAstParser/resources/cxx/types.cpp.txt b/ClangAstParser/test-resources/cxx/types.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/types.cpp.txt rename to ClangAstParser/test-resources/cxx/types.cpp.txt diff --git a/ClangAstParser/resources/cxx/using.cpp b/ClangAstParser/test-resources/cxx/using.cpp similarity index 100% rename from ClangAstParser/resources/cxx/using.cpp rename to ClangAstParser/test-resources/cxx/using.cpp diff --git a/ClangAstParser/resources/cxx/using.cpp.txt b/ClangAstParser/test-resources/cxx/using.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/using.cpp.txt rename to ClangAstParser/test-resources/cxx/using.cpp.txt diff --git a/ClangAstParser/resources/cxx/while.cpp b/ClangAstParser/test-resources/cxx/while.cpp similarity index 100% rename from ClangAstParser/resources/cxx/while.cpp rename to ClangAstParser/test-resources/cxx/while.cpp diff --git a/ClangAstParser/resources/cxx/while.cpp.txt b/ClangAstParser/test-resources/cxx/while.cpp.txt similarity index 100% rename from ClangAstParser/resources/cxx/while.cpp.txt rename to ClangAstParser/test-resources/cxx/while.cpp.txt diff --git a/ClangAstParser/test/eu/antarex/clang/parser/AClangAstTester.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/AClangAstTester.java similarity index 77% rename from ClangAstParser/test/eu/antarex/clang/parser/AClangAstTester.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/AClangAstTester.java index 32a63ccf67..2dd5c33e79 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/AClangAstTester.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/AClangAstTester.java @@ -11,14 +11,22 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; -import org.junit.Assert; -import org.junit.Before; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.junit.jupiter.api.Assertions.*; import org.suikasoft.jOptions.Datakey.DataKey; + import pt.up.fe.specs.clang.codeparser.CodeParser; import pt.up.fe.specs.clang.codeparser.ParallelCodeParser; -import pt.up.fe.specs.clang.dumper.ClangAstDumper; import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ast.extra.App; import pt.up.fe.specs.util.SpecsIo; @@ -27,14 +35,13 @@ import pt.up.fe.specs.util.SpecsSystem; import pt.up.fe.specs.util.providers.ResourceProvider; -import java.io.File; -import java.util.*; -import java.util.stream.Collectors; - public abstract class AClangAstTester { private static final boolean CLEAN_CLANG_FILES = !SpecsSystem.isDebug(); - private static final String OUTPUT_FOLDERNAME = "temp-clang-ast"; + private static final String OUTPUT_FOLDERNAME_PREFIX = "temp-clang-ast-"; + + // Each test instance gets a unique output folder to avoid race conditions in parallel execution + private final String outputFoldername; private final Collection resources; private List compilerOptions; @@ -80,6 +87,9 @@ private AClangAstTester(TestResources resources, List compilerOptions) { public AClangAstTester(Collection resources, List compilerOptions) { this.resources = resources; this.compilerOptions = new ArrayList<>(compilerOptions); + + // Create unique output folder for this test instance to avoid parallel test conflicts + this.outputFoldername = OUTPUT_FOLDERNAME_PREFIX + System.nanoTime() + "-" + Thread.currentThread().getId(); codeParser = CodeParser.newInstance(); // Set strict mode @@ -147,38 +157,40 @@ public void test() { testProper(); } catch (Exception e) { throw new RuntimeException(e); + } finally { + // Clean up this test instance's folder after test completes + // Safe even in parallel execution since each instance has a unique folder + try { + cleanupInstance(); + } catch (Exception e) { + // Log but don't fail the test if cleanup fails + SpecsLogs.info("Failed to cleanup test folder: " + e.getMessage()); + } } } - @Before public void setUp() throws Exception { SpecsSystem.programStandardInit(); - // Copy resources under test - File outputFolder = SpecsIo.mkdir(AClangAstTester.OUTPUT_FOLDERNAME); + // Copy resources under test to this test's unique output folder + File outputFolder = SpecsIo.mkdir(outputFoldername); for (ResourceProvider resource : resources) { File copiedFile = SpecsIo.resourceCopy(resource.getResource(), outputFolder, false, true); - Assert.assertTrue("Could not copy resource '" + resource + "'", copiedFile.isFile()); + assertTrue(copiedFile.isFile(), "Could not copy resource '" + resource + "'"); } } - // @After - public static void clear() throws Exception { - - // Delete ClangAst files + /** + * Cleans up this test instance's unique output folder. + * Safe to call from @AfterEach even when tests run in parallel. + */ + public void cleanupInstance() throws Exception { if (CLEAN_CLANG_FILES) { - - // Delete resources under test - File outputFolder = SpecsIo.mkdir(AClangAstTester.OUTPUT_FOLDERNAME); - SpecsIo.deleteFolderContents(outputFolder); - outputFolder.delete(); - - ClangAstDumper.getTempFiles().stream() - .forEach(filename -> new File(filename).delete()); + File outputFolder = new File(outputFoldername); + SpecsIo.deleteFolder(outputFolder); } - } public void testProper() { @@ -186,13 +198,12 @@ public void testProper() { // Enable parallel parsing codeParser.set(ParallelCodeParser.PARALLEL_PARSING); - File workFolder = new File(AClangAstTester.OUTPUT_FOLDERNAME); - + File workFolder = new File(outputFoldername); // Parse files App clavaAst = codeParser.parse(Arrays.asList(workFolder), compilerOptions); - clavaAst.write(SpecsIo.mkdir(AClangAstTester.OUTPUT_FOLDERNAME + "/outputFirst")); + clavaAst.write(SpecsIo.mkdir(outputFoldername + "/outputFirst")); if (onePass) { return; } @@ -204,19 +215,19 @@ public void testProper() { // Parse output again, check if files are the same - File firstOutputFolder = new File(AClangAstTester.OUTPUT_FOLDERNAME + "/outputFirst"); + File firstOutputFolder = new File(outputFoldername + "/outputFirst"); App testClavaAst = testCodeParser.parse(Arrays.asList(firstOutputFolder), compilerOptions); - testClavaAst.write(SpecsIo.mkdir(AClangAstTester.OUTPUT_FOLDERNAME + "/outputSecond")); + testClavaAst.write(SpecsIo.mkdir(outputFoldername + "/outputSecond")); // System.out.println("STOREDEF CACHE:\n" + StoreDefinitions.getStoreDefinitionsCache().getAnalytics()); // Test if files from first and second are the same - Map outputFiles1 = SpecsIo.getFiles(new File(AClangAstTester.OUTPUT_FOLDERNAME + "/outputFirst")) + Map outputFiles1 = SpecsIo.getFiles(new File(outputFoldername + "/outputFirst")) .stream() .collect(Collectors.toMap(file -> file.getName(), file -> file)); - Map outputFiles2 = SpecsIo.getFiles(new File(AClangAstTester.OUTPUT_FOLDERNAME + "/outputSecond")) + Map outputFiles2 = SpecsIo.getFiles(new File(outputFoldername + "/outputSecond")) .stream() .collect(Collectors.toMap(file -> file.getName(), file -> file)); @@ -225,7 +236,7 @@ public void testProper() { // Get corresponding file in output 2 File outputFile2 = outputFiles2.get(name); - Assert.assertNotNull("Could not find second version of file '" + name + "'", outputFile2); + assertNotNull(outputFile2, "Could not find second version of file '" + name + "'"); } // Compare with .txt, if available @@ -244,7 +255,7 @@ public void testProper() { File generatedFile = outputFiles2.get(resource.getFilename()); String generatedFileContents = SpecsStrings.normalizeFileContents(SpecsIo.read(generatedFile), true); - Assert.assertEquals(txtContents, generatedFileContents); + assertEquals(txtContents, generatedFileContents); } // Idempotence test @@ -264,7 +275,7 @@ private void testIdempotence(Map outputFiles1, Map o var normalizedFile1 = SpecsStrings.normalizeFileContents(SpecsIo.read(outputFile1), true); var normalizedFile2 = SpecsStrings.normalizeFileContents(SpecsIo.read(outputFile2), true); - Assert.assertEquals(normalizedFile1, normalizedFile2); + assertEquals(normalizedFile1, normalizedFile2); } } diff --git a/ClangAstParser/test/eu/antarex/clang/parser/CTester.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CTester.java similarity index 96% rename from ClangAstParser/test/eu/antarex/clang/parser/CTester.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/CTester.java index c2097869a1..b9f6055bcb 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/CTester.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CTester.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; import java.util.Arrays; import java.util.List; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/ClangTester.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/ClangTester.java similarity index 95% rename from ClangAstParser/test/eu/antarex/clang/parser/ClangTester.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/ClangTester.java index 565ee1c52a..3541eec8c7 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/ClangTester.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/ClangTester.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; import java.util.Arrays; import java.util.List; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/CxxCudaTester.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxCudaTester.java similarity index 96% rename from ClangAstParser/test/eu/antarex/clang/parser/CxxCudaTester.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxCudaTester.java index 047d4b41ac..58c8966bec 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/CxxCudaTester.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxCudaTester.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; import java.util.Arrays; import java.util.List; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/CxxTester.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxTester.java similarity index 96% rename from ClangAstParser/test/eu/antarex/clang/parser/CxxTester.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxTester.java index de74b150ae..ada4489f5e 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/CxxTester.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/CxxTester.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; import java.util.Arrays; import java.util.List; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/TestResources.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/TestResources.java similarity index 97% rename from ClangAstParser/test/eu/antarex/clang/parser/TestResources.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/TestResources.java index 1efbeca603..86da40cf7c 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/TestResources.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/TestResources.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser; +package pt.up.fe.specs.clang.parser; import java.util.Arrays; import java.util.List; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/scripts/ConcreteClassesScript.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/scripts/ConcreteClassesScript.java similarity index 97% rename from ClangAstParser/test/eu/antarex/clang/parser/scripts/ConcreteClassesScript.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/scripts/ConcreteClassesScript.java index 7b80d4c26c..1f2fb12d23 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/scripts/ConcreteClassesScript.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/scripts/ConcreteClassesScript.java @@ -11,14 +11,14 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.scripts; +package pt.up.fe.specs.clang.parser.scripts; import java.io.File; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import org.junit.jupiter.api.Test; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.util.SpecsIo; diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CBenchTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CBenchTest.java similarity index 75% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CBenchTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CBenchTest.java index 8e61be8069..427b709726 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CBenchTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CBenchTest.java @@ -11,27 +11,14 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CTester; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import pt.up.fe.specs.clang.parser.CTester; import pt.up.fe.specs.lang.SpecsPlatforms; public class CBenchTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testBt() { if (SpecsPlatforms.isLinux()) { diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CTest.java similarity index 89% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CTest.java index cdbb92ec16..9d97f3ab51 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CTest.java @@ -11,27 +11,14 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CTester; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import pt.up.fe.specs.clang.parser.CTester; import pt.up.fe.specs.lang.SpecsPlatforms; public class CTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testBoolean() { new CTester("boolean.c", "boolean2.c").test(); diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxBenchTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxBenchTest.java similarity index 82% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CxxBenchTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxBenchTest.java index dce61a11d0..369094677e 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxBenchTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxBenchTest.java @@ -11,28 +11,14 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CxxTester; +import pt.up.fe.specs.clang.parser.CxxTester; import pt.up.fe.specs.lang.SpecsPlatforms; public class CxxBenchTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testBlockedMm() { new CxxTester("bench/blocked_mm.cpp").test(); diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxCudaTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxCudaTest.java similarity index 54% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CxxCudaTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxCudaTest.java index 2a91dd6b15..2705b73398 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxCudaTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxCudaTest.java @@ -11,14 +11,11 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CxxCudaTester; +import pt.up.fe.specs.clang.parser.CxxCudaTester; /** * Disabled tests, they are failing in the CI server. Even when passing the --cuda-path built-in library, the parser @@ -28,40 +25,9 @@ * */ public class CxxCudaTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testAtomicAdd() { - // .addFlags( - // // "-std=cuda", - // // "-fms-compatibility", "-D_MSC_VER", "-D_LIBCPP_MSVCRT", - // // "--cuda-gpu-arch=sm_30", - // // "--cuda-device-only", - // // "-ferror-limit=10000", - // "-ferror-limit=10000") - // "--cuda-path=/usr/local/cuda-11.4") - // "/tmp/clang_ast_exe_osboxes/cuda") - - // "--cuda-path=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.3") - // - // .addFlags("-x", "cuda", "--cuda-path=C:\\Program Files\\NVIDIA GPU Computing - // Toolkit\\CUDA\\v11.3", - // "-nocudalib", "-nocudainc", - // "--cuda-device-only") - // .onePass() - // .showClavaAst() - new CxxCudaTester("atomicAdd.cu").test(); - } @Test @@ -83,5 +49,4 @@ public void testStreamAdd() { public void testSumArrays() { new CxxCudaTester("sumArrays.cu").showCode().test(); } - } diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxIssuesTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxIssuesTest.java similarity index 87% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CxxIssuesTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxIssuesTest.java index 4af90da66b..fc4556e641 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxIssuesTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxIssuesTest.java @@ -11,27 +11,13 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CxxTester; +import pt.up.fe.specs.clang.parser.CxxTester; public class CxxIssuesTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testClavaIssue09() { new CxxTester("issues/clava_issue09.h").test(); diff --git a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxTest.java b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxTest.java similarity index 94% rename from ClangAstParser/test/eu/antarex/clang/parser/tests/CxxTest.java rename to ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxTest.java index acc239b418..e26e8a493d 100644 --- a/ClangAstParser/test/eu/antarex/clang/parser/tests/CxxTest.java +++ b/ClangAstParser/test/pt/up/fe/specs/clang/parser/tests/CxxTest.java @@ -11,27 +11,14 @@ * specific language governing permissions and limitations under the License. under the License. */ -package eu.antarex.clang.parser.tests; +package pt.up.fe.specs.clang.parser.tests; -import eu.antarex.clang.parser.AClangAstTester; -import eu.antarex.clang.parser.CxxTester; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import pt.up.fe.specs.clang.parser.CxxTester; import pt.up.fe.specs.lang.SpecsPlatforms; public class CxxTest { - - @BeforeClass - public static void setup() throws Exception { - AClangAstTester.clear(); - } - - @After - public void tearDown() throws Exception { - AClangAstTester.clear(); - } - @Test public void testBoolean() { new CxxTester("boolean.cpp").test(); diff --git a/Clava-JS/eslint.config.js b/Clava-JS/eslint.config.js index ef44376fe9..2ad231fb71 100644 --- a/Clava-JS/eslint.config.js +++ b/Clava-JS/eslint.config.js @@ -7,7 +7,7 @@ import eslintConfigPrettier from "eslint-config-prettier"; export default [ js.configs.recommended, eslintConfigPrettier, - ...typescriptEslint.configs.all, + ...typescriptEslint.configs.recommended, { ignores: ["**/*.d.ts", "**/*.config.js"], }, @@ -18,6 +18,8 @@ export default [ }, languageOptions: { + tsconfigRootDir: __dirname, + parser: typescriptEslint.parser, ecmaVersion: 5, sourceType: "script", diff --git a/Clava-JS/jest.config.js b/Clava-JS/jest.config.js index 6449bb36e1..ea4524bfa8 100644 --- a/Clava-JS/jest.config.js +++ b/Clava-JS/jest.config.js @@ -13,7 +13,6 @@ const config = { "(.+)\\.js": "$1", }, projects: ["src-api", "src-code"], - }; export default config; diff --git a/Clava-JS/jest/ClavaLegacyTester.ts b/Clava-JS/jest/ClavaLegacyTester.ts new file mode 100644 index 0000000000..c5a75e0ca1 --- /dev/null +++ b/Clava-JS/jest/ClavaLegacyTester.ts @@ -0,0 +1,44 @@ +import ClavaJavaTypes, { + ClavaJavaClasses, +} from "@specs-feup/clava/api/clava/ClavaJavaTypes.js"; + +import { WeaverLegacyTester } from "@specs-feup/lara/jest/WeaverLegacyTester.js"; + +export class ClavaLegacyTester extends WeaverLegacyTester { + protected readonly WORK_FOLDER: string = "cxx_weaver_output"; + private readonly standard: ClavaJavaClasses.Standard; + private readonly compilerFlags: string; + + public constructor( + basePackage: string, + standard: ClavaJavaClasses.Standard, + compilerFlags: string = "" + ) { + super(basePackage); + this.standard = standard; + this.compilerFlags = compilerFlags; + + this.set(ClavaJavaTypes.ClavaOptions.FLAGS, this.compilerFlags); + } + + public async test( + laraResource: string, + ...codeResources: string[] + ): Promise { + if (this.standard != null) { + this.set(ClavaJavaTypes.ClavaOptions.STANDARD, this.standard); + } + + this.set( + ClavaJavaTypes.CxxWeaverOption.CHECK_SYNTAX, + this.checkWovenCodeSyntax + ); + this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CLAVA_INFO, true); + this.set(ClavaJavaTypes.CxxWeaverOption.DISABLE_CODE_GENERATION); + + // Enable parallel parsing + //this.set(ClavaJavaTypes.ParallelCodeParser.PARALLEL_PARSING); + + await super.test(laraResource, ...codeResources); + } +} diff --git a/Clava-JS/package.json b/Clava-JS/package.json index eb191fc21f..38a7c426e2 100644 --- a/Clava-JS/package.json +++ b/Clava-JS/package.json @@ -1,6 +1,6 @@ { "name": "@specs-feup/clava", - "version": "3.0.33", + "version": "3.5.0", "description": "A C/C++ source-to-source compiler written in Typescript", "type": "module", "files": [ @@ -34,7 +34,6 @@ "test:code": "npm run test -- src-code", "test:cov": "npm run test -- --coverage", "test:watch": "npm run test -- --watch", - "java-dist": "npx lara-java-dist --jsSourceFolder api --jsDestinationFolder ../ClavaLaraApi/src-lara/clava/ --javaClassname ClavaApiJsResource --javaPackageName pt.up.fe.specs.clava.weaver --javaDestinationFolder ../ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ --javaResourceNamespace clava", "build-interfaces": "npx lara-build-interfaces --input ../ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.json --lara @specs-feup/lara/LaraJoinPointSpecification.json --output src-api/Joinpoints.ts" }, "repository": { @@ -56,7 +55,8 @@ }, "homepage": "https://github.com/specs-feup/clava#readme", "dependencies": { - "@specs-feup/lara": "~3.0.13" + "@specs-feup/lara": "~3.5.0", + "cytoscape": "^3.0.0" }, "devDependencies": { "@jest/globals": "^29.7.0", diff --git a/Clava-JS/publish_clava.ps1 b/Clava-JS/publish_clava.ps1 deleted file mode 100644 index 713756793d..0000000000 --- a/Clava-JS/publish_clava.ps1 +++ /dev/null @@ -1,15 +0,0 @@ - -npm run build-interfaces -npm run build -npm run java-dist - -cd .. -cd ClavaWeaver -gradle installDist -cd .. -cd Clava-JS - -$source = "../ClavaWeaver/build/install/ClavaWeaver/lib" -$destination = "./java-binaries" - -Copy-Item -Path "$source\*" -Destination $destination -Recurse -Force diff --git a/Clava-JS/src-api/Issues.test.ts b/Clava-JS/src-api/Issues.test.ts index 68115e256f..dd73aa1cdc 100644 --- a/Clava-JS/src-api/Issues.test.ts +++ b/Clava-JS/src-api/Issues.test.ts @@ -3,7 +3,7 @@ import { registerSourceCodes, } from "@specs-feup/lara/jest/jestHelpers.js"; import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { FunctionJp, Loop } from "@specs-feup/clava/api/Joinpoints.js"; +import { FunctionJp } from "@specs-feup/clava/api/Joinpoints.js"; import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; const code187 = ` @@ -28,7 +28,7 @@ describe("issue187", () => { ); if (functionJp === undefined) { - fail(); + throw new Error("functionJp is undefined"); } functionJp.setParams([newParam1, newParam2]); @@ -61,23 +61,20 @@ describe("issue190", () => { ).first(); if (functionJp2 === undefined) { - fail(); + throw new Error("functionJp2 is undefined"); } functionJp2.setName("bar"); expect(functionJp2.name).toBe("bar"); - //console.log(functionJp2.name); //expected "bar" but still shows "foo" const functionJp1 = Query.search(FunctionJp, (jp) => jp.filepath.endsWith("file1.c") ).first(); if (functionJp1 === undefined) { - fail(); + throw new Error("functionJp1 is undefined"); } expect(functionJp1.name).toBe("foo"); - - // console.log(functionJp1.name); // unexpected name "bar" }); }); diff --git a/Clava-JS/src-api/LegacyIntegrationTests - C.test.ts b/Clava-JS/src-api/LegacyIntegrationTests - C.test.ts new file mode 100644 index 0000000000..e039f61c09 --- /dev/null +++ b/Clava-JS/src-api/LegacyIntegrationTests - C.test.ts @@ -0,0 +1,373 @@ +import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.js"; +import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; +import ClavaJavaTypes from "@specs-feup/clava/api/clava/ClavaJavaTypes.js"; +import path from "path"; + +const isWindows = process.platform === "win32"; +const isMacOS = process.platform === "darwin"; + +/* eslint-disable jest/expect-expect */ +describe("CTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/weaver/"), + ClavaJavaTypes.Standard.C99 + ) + .setResultPackage("c/results") + .setSrcPackage("c/src"); + } + + // TODO: Temporarily disabled, Jenkins fails with "Cannot inherit from final class" + it("Loop", async () => { + await newTester().test("Loop.js", "loop.c"); + }); + + it("ReplaceCallWithStmt", async () => { + await newTester().test( + "ReplaceCallWithStmt.js", + "ReplaceCallWithStmt.c" + ); + }); + + it("InsertsLiteral", async () => { + await newTester().test("InsertsLiteral.js", "inserts.c"); + }); + + it("InsertsJp", async () => { + await newTester().test("InsertsJp.js", "inserts.c"); + }); + + it("Clone", async () => { + await newTester().test("Clone.js", "clone.c"); + }); + + it("AddGlobal", async () => { + await newTester().test( + "AddGlobal.js", + "add_global_1.c", + "add_global_2.c" + ); + }); + + it("Expressions", async () => { + await newTester().test("Expressions.js", "expressions.c"); + }); + + // FIXME: currentTime() is a method only available in the MasterWeaver class and not in any Weaver that is actually shipped. + // This test only runs in the java test runner and does not work in the real world. + /* + it("Dijkstra", async () => { + await newTester() + .setCheckWovenCodeSyntax(false) + .checkExpectedOutput(false) + .test("Dijkstra.js", "dijkstra.c"); + }); + */ + + it("Wrap", async () => { + const tester = newTester().set( + ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES + ); + + if (JavaTypes.SpecsPlatforms.isMac()) { + tester.setResultsFile("Wrap.js.macos.txt"); + } + + await tester.test("Wrap.js", "wrap.c", "wrap.h"); + }); + + it("VarrefInWhile", async () => { + await newTester().test("VarrefInWhile.js", "varref_in_while.c"); + }); + + it("Inline", async () => { + await newTester().test( + "Inline.js", + "inline.c", + "inline_utils.h", + "inline_utils.c" + ); + }); + + it("SetType", async () => { + await newTester().test("SetType.js", "set_type.c"); + }); + + it("Detach", async () => { + await newTester().test("Detach.js", "detach.c"); + }); + + (isWindows ? it.skip : it)("InlineNasLu", async () => { + await newTester() + .checkExpectedOutput(false) + .test("InlineNasLu.js", "inline_nas_lu.c"); + }); + + it("InlineNasFt", async () => { + await newTester() + .checkExpectedOutput(false) + .test("InlineNasFt.js", "inline_nas_ft.c"); + }); + + it("NullNodes", async () => { + await newTester().test("NullNodes.js", "null_nodes.c"); + }); + + it("TypeRenamer", async () => { + await newTester().test("TypeRenamer.js", "type_renamer.c"); + }); + + it("AstNodes", async () => { + await newTester().test("AstNodes.js", "ast_nodes.c"); + }); + + it("RemoveInclude", async () => { + await newTester().test( + "RemoveInclude.js", + "remove_include.c", + "remove_include_0.h", + "remove_include_1.h", + "remove_include_2.h" + ); + }); + + it("IncludeLocation", async () => { + await newTester().test( + "IncludeLoc.js", + "remove_include.c", + "remove_include_0.h", + "remove_include_1.h", + "remove_include_2.h" + ); + }); + + it("DynamicCallGraph", async () => { + await newTester().test("DynamicCallGraph.js", "dynamic_call_graph.c"); + }); + + it("Selects", async () => { + await newTester().test("Selects.js", "selects.c"); + }); + + it("Scope", async () => { + await newTester().test("Scope.js", "scope.c"); + }); + + it("Array", async () => { + await newTester().test("ArrayTest.js", "array_test.c"); + }); + + // @Test + // it("OpenCLType", async () => { + // // TODO: Certain attributes are not supported yet (e.g., ReqdWorkGroupSizeAttr, WorkGroupSizeHintAttr, + // // VecTypeHintAttr) + // await newTester().set(ClavaOptions.STANDARD, Standard.OPENCL20).test("OpenCLType.js", "opencl_type.cl"); + // }); + + it("Cilk", async () => { + // Generated code has Cilk directives + await newTester() + .set(ClavaJavaTypes.ClavaOptions.FLAGS, "-fcilkplus") + .test("Cilk.js", "cilk.c"); + }); + + it("TagDecl", async () => { + await newTester().test("TagDecl.js", "tag_decl.c"); + }); + + it("File", async () => { + await newTester().test("File.js", "file.c"); + }); + + it("Switch", async () => { + await newTester().test("SwitchTest.js", "switch.c"); + }); + + it("AddParam", async () => { + await newTester().test("AddParamTest.js", "add_param.c"); + }); + + it("AddArg", async () => { + await newTester().test("AddArgTest.js", "add_arg.c"); + }); + + it("Cfg", async () => { + await newTester().test("Cfg.js", "cfg.c"); + }); + + it("ExprStmt", async () => { + await newTester().test("ExprStmt.js", "expr_stmt.c"); + }); + + it("Traversal", async () => { + await newTester().test("Traversal.js", "traversal.c"); + }); + + it("If", async () => { + await newTester().test("If.js", "if.c"); + }); +}); + +describe("CBenchTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/bench/"), + ClavaJavaTypes.Standard.C99 + ) + .setResultPackage("c/results") + .setSrcPackage("c/src"); + } + + it("HamidRegion", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("HamidRegion.js", "hamid_region.c", "hamid_region.h"); + }); + + it("DspMatmul", async () => { + await newTester().test("DspMatmul.js", "dsp_matmul.c"); + }); + + it("LSIssue1", async () => { + await newTester().test("LSIssue1.js", "ls_issue1.c"); + }); +}); + +describe("CApiTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/api/"), + ClavaJavaTypes.Standard.C99 + ) + .setSrcPackage("c/src/") + .setResultPackage("c/results/"); + } + + it("Logger", async () => { + await newTester().test("LoggerTest.js", "logger_test.c"); + }); + + it("Timer", async () => { + const tester = newTester(); + if (JavaTypes.SpecsPlatforms.isUnix()) { + tester.setResultsFile("TimerTest.js.unix.txt"); + } + + const t = async () => tester.test("TimerTest.js", "timer_test.c"); + + if (JavaTypes.SpecsPlatforms.isMac()) { + await expect(t()).rejects.toThrow( + "Timer Exception: Platform not supported (Windows and Linux only)" + ); + } else { + await t(); + } + }); + + // Compiles C code, but with C++ flag. + it("TimerWithCxxFlag", async () => { + // This test results differ from the previous due to the Singleton pattern in the IdGenerator class. + // The IdGenerator instance is not reset between tests, so the ids generated differ. + // This is a limitation of this legacy test harness. We won't bother fixing it as this is legacy code. + const tester = newTester(); + if (JavaTypes.SpecsPlatforms.isUnix()) { + tester.setResultsFile("TimerTestWithCxxFlag.js.unix.txt"); + } + + const t = async () => + tester + .set( + ClavaJavaTypes.ClavaOptions.STANDARD, + ClavaJavaTypes.Standard.CXX11 + ) + .test("TimerTestWithCxxFlag.js", "timer_test.c"); + + if (JavaTypes.SpecsPlatforms.isMac()) { + await expect(t()).rejects.toThrow( + "Timer Exception: Platform not supported (Windows and Linux only)" + ); + } else { + await t(); + } + }); + + it("Energy", async () => { + // Disable syntax check of woven code, rapl include is not available + await newTester() + .setCheckWovenCodeSyntax(false) + .test("EnergyTest.js", "energy_test.c"); + }); + + it("CodeInserter", async () => { + await newTester().test("CodeInserterTest.js", "code_inserter.c"); + }); + + it("ArrayLinearizer", async () => { + await newTester().test("ArrayLinearizerTest.js", "qr.c"); + }); + + it("Selector", async () => { + await newTester().test("SelectorTest.js", "selector_test.c"); + }); + + it("StrcpyChecker", async () => { + const tester = newTester(); + + if (isMacOS) { + tester.setResultsFile("StrcpyChecker.js.macos.txt"); + } + + await tester.test("StrcpyChecker.js", "strcpy.c"); + }); + + it("StaticCallGraph", async () => { + await newTester().test("StaticCallGraphTest.js", "static_call_graph.c"); + }); + + it("PassComposition", async () => { + await newTester().test("PassCompositionTest.js", "pass_composition.c"); + }); + + it("CfgApi", async () => { + await newTester().test("CfgApi.js", "cfg_api.c"); + }); + + it("Inliner", async () => { + const tester = newTester(); + + if (JavaTypes.SpecsPlatforms.isMac()) { + tester.setResultsFile("InlinerTest.js.macos.txt"); + } + + await tester.test("InlinerTest.js", "inliner.c"); + }); + + it("StatementDecomposer", async () => { + await newTester().test( + "StatementDecomposerTest.js", + "stmt_decomposer.c" + ); + }); + + it("ToSingleFile", async () => { + await newTester().test( + "ToSingleFile.js", + "to_single_file_1.c", + "to_single_file_2.c" + ); + }); + + it("LivenessAnalysis", async () => { + await newTester().test( + "LivenessAnalysisTest.js", + "liveness_analysis.c" + ); + }); + + it("SwitchToIf", async () => { + await newTester().test( + "SwitchToIfTransformationTest.js", + "switch_to_if.c" + ); + }); +}); diff --git a/Clava-JS/src-api/LegacyIntegrationTests - CXX.test.ts b/Clava-JS/src-api/LegacyIntegrationTests - CXX.test.ts new file mode 100644 index 0000000000..5473c3bc3a --- /dev/null +++ b/Clava-JS/src-api/LegacyIntegrationTests - CXX.test.ts @@ -0,0 +1,561 @@ +import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.js"; +import ClavaJavaTypes from "@specs-feup/clava/api/clava/ClavaJavaTypes.js"; +import JavaInterop from "@specs-feup/lara/api/lara/JavaInterop.js"; +import path from "path"; + +const isWindows = process.platform === "win32"; +const isMacOS = process.platform === "darwin"; + +/* eslint-disable jest/expect-expect */ +describe("CxxTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/weaver"), + ClavaJavaTypes.Standard.CXX11 + ) + .setResultPackage("cpp/results") + .setSrcPackage("cpp/src"); + } + + it("Statement", async () => { + await newTester().test("Statement.js", "statement.cpp"); + }); + + it("Loop", async () => { + await newTester().test("Loop.js", "loop.cpp"); + }); + + it("ReplaceCallWithStmt", async () => { + await newTester().test( + "ReplaceCallWithStmt.js", + "ReplaceCallWithStmt.cpp" + ); + }); + + it("InsertsLiteral", async () => { + await newTester().test("InsertsLiteral.js", "inserts.cpp"); + }); + + it("InsertsJp", async () => { + await newTester().test("InsertsJp.js", "inserts.cpp"); + }); + + it("Pragmas", async () => { + await newTester().test("Pragmas.js", "pragma.cpp"); + }); + + it("Pragmas2", async () => { + await newTester().test("Pragma2.js", "pragma2.cpp"); + }); + + it("Actions", async () => { + await newTester().test("Actions.js", "actions.cpp"); + }); + + it("ArrayAccess", async () => { + await newTester().test( + "ArrayAccess.js", + "array_access.cpp", + "array_access.h" + ); + }); + + it("AttributeUse", async () => { + await newTester().test("AttributeUse.js", "attribute_use.cpp"); + }); + + it("Hdf5Types", async () => { + await newTester() + // Disable syntax checking, since test system may not have HDF5 includes automatically available + .setCheckWovenCodeSyntax(false) + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("Hdf5Types.js", "hdf5types.cpp"); + }); + + it("OmpThreadsExplore", async () => { + await newTester() + .set( + ClavaJavaTypes.ClavaOptions.FLAGS_LIST, + JavaInterop.arrayToList(["-fopenmp=libomp"]) + ) + .test("OmpThreadsExplore.js", "omp_threads_explore.cpp"); + }); + + it("HamidCfg", async () => { + await newTester().test("HamidCfg.js", "dijkstra.cpp"); + }); + + it("Clone", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("Clone.js", "clone.cpp", "clone.h"); + }); + + it("AddGlobal", async () => { + await newTester().test( + "AddGlobal.js", + "add_global_1.cpp", + "add_global_2.cpp" + ); + }); + + it("Omp", async () => { + await newTester().test("Omp.js", "omp.cpp"); + }); + + it("OmpAttributes", async () => { + await newTester().test("OmpAttributes.js", "omp_attributes.cpp"); + }); + + it("OmpSetAttributes", async () => { + await newTester().test("OmpSetAttributes.js", "omp_set_attributes.cpp"); + }); + + it("Expressions", async () => { + await newTester().test("Expressions.js", "expressions.cpp", "classA.h"); + }); + + it("ParentRegion", async () => { + await newTester().test("ParentRegion.js", "parent_region.cpp"); + }); + + it("VarDecl", async () => { + await newTester().test("Vardecl.js", "vardecl.cpp"); + }); + + it("ParamType", async () => { + await newTester() + .checkExpectedOutput(false) + .test("ParamType.js", "param_type.cpp"); + }); + + (isWindows ? it.skip : it)("Wrap", async () => { + const tester = newTester().set( + ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES + ); + + if (isMacOS) { + tester.setResultsFile("Wrap.js.macos.txt"); + } + + await tester.test("Wrap.js", "wrap.cpp", "wrap.h"); + }); + + it("SelectVarDecl", async () => { + await newTester().test("SelectVardecl.js", "select_vardecl.cpp"); + }); + + it("Macros", async () => { + await newTester() + .setCheckWovenCodeSyntax(false) + .test("Macros.js", "macros.cpp"); + }); + + it("Call", async () => { + await newTester().test("Call.js", "call.cpp"); + }); + + it("TypeTemplate", async () => { + await newTester().test("TypeTemplate.js", "type_template.cpp"); + }); + + it("Function", async () => { + await newTester().test("Function.js", "function.cpp", "function.h"); + }); + + it("AstAttributes", async () => { + await newTester().test("AstAttributes.js", "ast_attributes.cpp"); + }); + + it("PragmaData", async () => { + await newTester().test( + "PragmaData.js", + "pragma_data.cpp", + "pragma_data_2.cpp" + ); + }); + + it("GlobalAttributes", async () => { + await newTester().test("GlobalAttributes.js", "global_attributes.cpp"); + }); + + it("SetType", async () => { + await newTester().test("SetTypeCxx.js", "set_type.cpp"); + }); + + it("MultiFile", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("MultiFile.js", "multiFile.cpp", "multiFile.h"); + }); + + it("Field", async () => { + await newTester().test("Field.js", "field.hpp"); + }); + + it("FileRebuild", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test( + "FileRebuild.js", + "file_rebuild.cpp", + "file_rebuild.h", + "file_rebuild_2.h" + ); + }); + + it("Setters", async () => { + const tester = newTester(); + + if (isMacOS) { + tester.setResultsFile("Setters.js.macos.txt"); + } + + await tester.test("Setters.js", "setters.cpp"); + }); + + it("SkipParsingHeaders", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES, false) + .test( + "SkipParsingHeaders.js", + "skip_parsing_headers.cpp", + "skip_parsing_headers.h" + ); + }); + + it("NoParsing", async () => { + await newTester().test("NoParsing.js"); + }); + + it("LaraGetter", async () => { + await newTester().test("LaraGetter.js"); + }); + + it("VarDeclV2", async () => { + await newTester().test( + "VardeclV2.js", + "vardeclv2.cpp", + "vardeclv2_2.cpp" + ); + }); + + it("File", async () => { + await newTester().test("File.js", "file.cpp"); + }); + + it("DataClass", async () => { + await newTester().test("DataClass.js", "dataclass.cpp"); + }); + + it("ClassManipulation", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test( + "ClassManipulation.js", + "class_manipulation.cpp", + "class_manipulation.h" + ); + }); + + it("This", async () => { + await newTester().test("ThisTest.js", "this.cpp"); + }); + + it("Member", async () => { + await newTester().test("Member.js", "member.cpp"); + }); + + it("FieldRef", async () => { + await newTester() + .checkExpectedOutput(false) + .test("FieldRef.js", "fieldRef.cpp"); + }); + + it("ExpressionDecls", async () => { + await newTester().test("ExpressionDecls.js", "expressionDecls.cpp"); + }); + + it("TemplateSpecializationType", async () => { + await newTester().test( + "TemplateSpecializationType.js", + "template_specialization_type.cpp" + ); + }); + + it("ReverseIterator", async () => { + await newTester().test("ReverseIterator.js", "reverse_iterator.cpp"); + }); + + it("Function2", async () => { + await newTester().test("Function2.js", "function2.cpp"); + }); + + it("CloneOnFile", async () => { + await newTester() + // Generates a file in another folder, needs to generate the header file otherwise it will not parse + // correctly the second time + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("CloneOnFile.js", "clone_on_file.cpp", "clone_on_file.h"); + }); + + it("EmptyStmt", async () => { + await newTester().test("EmptyStmt.js", "empty_stmt.cpp"); + }); + + it("Class", async () => { + await newTester().test("Class.js", "class.cpp"); + }); + + it("Canonical", async () => { + await newTester().test("CanonicalTest.js", "canonical.cpp"); + }); + + it("Break", async () => { + await newTester().test("Break.js", "break.cpp"); + }); +}); + +describe("CxxBenchTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/bench/"), + ClavaJavaTypes.Standard.CXX11 + ) + .setResultPackage("cpp/results") + .setSrcPackage("cpp/src"); + } + + it("LoicEx1", async () => { + await newTester().test("LoicEx1.js", "loic_ex1.cpp"); + }); + + it("LoicEx2", async () => { + await newTester() + .setCheckWovenCodeSyntax(false) + .checkExpectedOutput(false) + .test("LoicEx2.js", "loic_ex2.cpp"); + }); + + it("LoicEx3", async () => { + await newTester().test("LoicEx3.js", "loic_ex3.cpp"); + }); + + it("LSIssue2", async () => { + await newTester().test("LSIssue2.js", "ls_issue2.cpp"); + }); + + it("CbMultios", async () => { + await newTester().test("CbMultios.js", "cb_multios.cpp"); + }); +}); + +describe("CxxApiTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/api/"), + ClavaJavaTypes.Standard.CXX11 + ) + .setSrcPackage("cpp/src/") + .setResultPackage("cpp/results/"); + } + + it("Logger", async () => { + await newTester().test("LoggerTest.js", "logger_test.cpp"); + }); + + it("LoggerWithLibrary", async () => { + // Disable syntax check of woven code, SpecsLogger includes are not available + await newTester() + .setCheckWovenCodeSyntax(false) + .test("LoggerTestWithLib.js", "logger_test.cpp"); + }); + + it("Energy", async () => { + // Disable syntax check of woven code, rapl include is not available + await newTester() + .setCheckWovenCodeSyntax(false) + .test("EnergyTest.js", "energy_test.cpp"); + }); + + it("Timer", async () => { + await newTester().test("TimerTest.js", "timer_test.cpp"); + }); + + it("ClavaFindJp", async () => { + await newTester().test("ClavaFindJpTest.js", "clava_find_jptest.cpp"); + }); + + it.skip("CMaker", async () => { + // TODO: Figure out a way to check if CMake is available + const IS_CMAKE_AVAILABLE = false; // --- IGNORE --- + + if (!IS_CMAKE_AVAILABLE) { + return; + } + + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("CMakerTest.js", "cmaker_test.cpp", "cmaker_test.h"); + }); + + it("MathExtra", async () => { + await newTester().test("MathExtraTest.js", "math_extra_test.cpp"); + }); + + it.skip("WeaverLauncher", async () => { + await newTester().test( + "WeaverLauncherTest.js", + "weaver_launcher_test.cpp" + ); + }); + + it("ClavaDataStore", async () => { + await newTester().test( + "ClavaDataStoreTest.js", + "clava_data_store_test.cpp" + ); + }); + + it("UserValues", async () => { + await newTester().test("UserValuesTest.js", "user_values.cpp"); + }); + + it("ClavaCode", async () => { + await newTester().test("ClavaCodeTest.js", "clava_code.cpp"); + }); + + it("ClavaJoinPointsTest", async () => { + await newTester().test( + "ClavaJoinPointsTest.js", + "clava_join_points.cpp" + ); + }); + + it("JpFilter", async () => { + await newTester() + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES) + .test("JpFilter.js", "jp_filter.hpp"); + }); + + it("Rebuild", async () => { + await newTester().test("RebuildTest.js", "rebuild.cpp"); + }); + + it("FileIterator", async () => { + await newTester().test( + "FileIteratorTest.js", + "file_iterator_1.cpp", + "file_iterator_2.cpp" + ); + }); + + it("AddHeaderFile", async () => { + await newTester().test("AddHeaderFileTest.js", "add_header_file.cpp"); + }); + + it("Clava", async () => { + await newTester().test("ClavaTest.js", "clava.cpp"); + }); + + it("Query", async () => { + await newTester().test("QueryTest.js", "query.cpp"); + }); + + it("ClavaType", async () => { + await newTester().test("ClavaTypeTest.js"); + }); + + it("StatementDecomposer", async () => { + await newTester().test( + "StatementDecomposerTest.js", + "stmt_decomposer.cpp" + ); + }); + + it("SimplifyVarDeclarations", async () => { + await newTester().test( + "PassSimplifyVarDeclarations.js", + "pass_simplify_var_declarations.cpp" + ); + }); + + it("SingleReturnFunction", async () => { + await newTester().test( + "PassSingleReturnTest.js", + "pass_single_return.cpp" + ); + }); + + it("SimplifyAssignment", async () => { + await newTester().test( + "CodeSimplifyAssignmentTest.js", + "code_simplify_assignment.cpp" + ); + }); + + it("SimplifyTernaryOp", async () => { + await newTester().test( + "CodeSimplifyTernaryOpTest.js", + "code_simplify_ternary_op.cpp" + ); + }); + + it("SimplifyLoops", async () => { + await newTester().test( + "PassSimplifyLoopsTest.js", + "pass_simplify_loops.cpp" + ); + }); + + it("MpiScatterGather", async () => { + await newTester() + // Disable syntax check of woven code, mpi.h may not be available + .setCheckWovenCodeSyntax(false) + .set(ClavaJavaTypes.CxxWeaverOption.PARSE_INCLUDES, false) + .test( + "MpiScatterGatherTest.js", + "mpi_scatter_gather.cpp", + "mpi_scatter_gather.h" + ); + }); + + it("Subset", async () => { + const tester = newTester(); + + if (isWindows) { + tester.setResultsFile("SubsetTest.js.windows.txt"); + } + + await tester.test("SubsetTest.js", "subset.cpp"); + }); +}); + +(isWindows ? describe.skip : describe)("CudaTest", () => { + function newTester() { + const cudaTester = new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/weaver/"), + ClavaJavaTypes.Standard.CUDA + ) + .setResultPackage("cuda/results") + .setSrcPackage("cuda/src") + .set( + ClavaJavaTypes.CodeParser.CUDA_PATH, + ClavaJavaTypes.CodeParser.getBuiltinOption() + ); + + return cudaTester; + } + + it("Cuda", async () => { + await newTester().test("Cuda.js", "atomicAdd.cu"); + }); + + it("CudaMatrixMul", async () => { + await newTester().test("CudaMatrixMul.js", "mult_matrix.cu"); + }); + + it("CudaQuery", async () => { + await newTester().test("CudaQuery.js", "sample.cu"); + }); +}); diff --git a/Clava-JS/src-api/LegacyIntegrationTests - Issues.test.ts b/Clava-JS/src-api/LegacyIntegrationTests - Issues.test.ts new file mode 100644 index 0000000000..480a24262a --- /dev/null +++ b/Clava-JS/src-api/LegacyIntegrationTests - Issues.test.ts @@ -0,0 +1,23 @@ +import { ClavaLegacyTester } from "../jest/ClavaLegacyTester.js"; +import ClavaJavaTypes from "@specs-feup/clava/api/clava/ClavaJavaTypes.js"; +import path from "path"; + +/* eslint-disable jest/expect-expect */ +describe("IssuesTest", () => { + function newTester() { + return new ClavaLegacyTester( + path.resolve("../ClavaWeaver/resources/clava/test/issues"), + ClavaJavaTypes.Standard.CXX11 + ) + .setResultPackage("c/results") + .setSrcPackage("c/src"); + } + + it("Issue168", async () => { + await newTester().test("Issue168.js", "issue_168.c"); + }); + + it("Issue-AIQ-1", async () => { + await newTester().test("Issue_aiq_1.js", "issue_aiq_1.c"); + }); +}); diff --git a/Clava-JS/src-api/clava/Clava.ts b/Clava-JS/src-api/clava/Clava.ts index 6776bf5f44..3c07da8370 100644 --- a/Clava-JS/src-api/clava/Clava.ts +++ b/Clava-JS/src-api/clava/Clava.ts @@ -10,13 +10,6 @@ import ClavaJavaTypes from "./ClavaJavaTypes.js"; import ClavaDataStore from "./util/ClavaDataStore.js"; export default class Clava { - /** - * Enables/disables library SpecsLogger for printing. - *

- * By default, is disabled. - */ - static useSpecsLogger = false; - /** * Returns the standard being used for compilation. */ @@ -91,12 +84,17 @@ extern "C" { * @returns True if the weaver execution without problems, false otherwise */ static runClava(args: string | any[]): boolean { + //FIXME: This is broken. To be fixed when we have a proper way to run Clava from JS. + throw new Error("Clava.runClava() is not implemented yet."); + + /* // If string, separate arguments if (typeof args === "string") { args = ClavaJavaTypes.ArgumentsParser.newCommandLine().parse(args); } return ClavaJavaTypes.ClavaWeaverLauncher.execute(args); + */ } /** @@ -113,22 +111,27 @@ extern "C" { threads = -1, clavaCommand: string | string[] = ["clava"] ) { - if (typeof clavaCommand === "string") { - clavaCommand = [clavaCommand]; - } - - const jsonStrings: string[] = - ClavaJavaTypes.ClavaWeaverLauncher.executeParallel( - argsLists, - threads, - JavaInterop.arrayToStringList(clavaCommand), - Clava.getData().getContextFolder().getAbsolutePath() - ); - - // Read each json file into its own object - const results = jsonStrings.map((jsonString) => JSON.parse(jsonString)); - - return results; + //FIXME: This is broken. To be fixed when we have a proper way to run Clava from JS. + throw new Error("Clava.runClavaParallel() is not implemented yet."); + + /* + if (typeof clavaCommand === "string") { + clavaCommand = [clavaCommand]; + } + + const jsonStrings: string[] = + ClavaJavaTypes.ClavaWeaverLauncher.executeParallel( + argsLists, + threads, + JavaInterop.arrayToStringList(clavaCommand), + Clava.getData().getContextFolder().getAbsolutePath() + ); + + // Read each json file into its own object + const results = jsonStrings.map((jsonString) => JSON.parse(jsonString)); + + return results; + */ } /** diff --git a/Clava-JS/src-api/clava/ClavaJavaTypes.ts b/Clava-JS/src-api/clava/ClavaJavaTypes.ts index bd63ae75f7..8e0ade6355 100644 --- a/Clava-JS/src-api/clava/ClavaJavaTypes.ts +++ b/Clava-JS/src-api/clava/ClavaJavaTypes.ts @@ -4,7 +4,7 @@ import JavaTypes, { // eslint-disable-next-line @typescript-eslint/no-namespace export namespace ClavaJavaClasses { - /* eslint-disable @typescript-eslint/no-empty-interface */ + /* eslint-disable @typescript-eslint/no-empty-object-type */ export interface ClavaNodes extends JavaClasses.JavaClass {} export interface ClavaNode extends JavaClasses.JavaClass {} export interface CxxJoinpoints extends JavaClasses.JavaClass {} @@ -15,15 +15,11 @@ export namespace ClavaJavaClasses { export interface Standard extends JavaClasses.JavaClass {} export interface AstFactory extends JavaClasses.JavaClass {} export interface ArgumentsParser extends JavaClasses.JavaClass {} - export interface ClavaWeaverLauncher extends JavaClasses.JavaClass {} export interface MathExtraApiTools extends JavaClasses.JavaClass {} - export interface HighLevelSynthesisAPI extends JavaClasses.JavaClass {} - export interface MemoiReport extends JavaClasses.JavaClass {} - export interface MemoiReportsMap extends JavaClasses.JavaClass {} - export interface MemoiCodeGen extends JavaClasses.JavaClass {} - export interface ClavaPetit extends JavaClasses.JavaClass {} - export interface ClavaPlatforms extends JavaClasses.JavaClass {} - /* eslint-enable @typescript-eslint/no-empty-interface */ + export interface CxxWeaverOption extends JavaClasses.JavaClass {} + export interface ClavaOptions extends JavaClasses.JavaClass {} + export interface CodeParser extends JavaClasses.JavaClass {} + /* eslint-enable @typescript-eslint/no-empty-object-type */ } /** @@ -91,51 +87,27 @@ export default class ClavaJavaTypes { ) as ClavaJavaClasses.ArgumentsParser; } - static get ClavaWeaverLauncher() { - return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher" - ) as ClavaJavaClasses.ClavaWeaverLauncher; - } - static get MathExtraApiTools() { return JavaTypes.getType( "pt.up.fe.specs.clava.weaver.MathExtraApiTools" ) as ClavaJavaClasses.MathExtraApiTools; } - static get HighLevelSynthesisAPI() { - return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.hls.HighLevelSynthesisAPI" - ) as ClavaJavaClasses.HighLevelSynthesisAPI; - } - - static get MemoiReport() { - return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.memoi.MemoiReport" - ) as ClavaJavaClasses.MemoiReport; - } - - static get MemoiReportsMap() { - return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.memoi.MemoiReportsMap" - ) as ClavaJavaClasses.MemoiReportsMap; - } - - static get MemoiCodeGen() { + static get CxxWeaverOption() { return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.memoi.MemoiCodeGen" - ) as ClavaJavaClasses.MemoiCodeGen; + "pt.up.fe.specs.clava.weaver.options.CxxWeaverOption" + ) as ClavaJavaClasses.CxxWeaverOption; } - static get ClavaPetit() { + static get ClavaOptions() { return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.util.ClavaPetit" - ) as ClavaJavaClasses.ClavaPetit; + "pt.up.fe.specs.clava.ClavaOptions" + ) as ClavaJavaClasses.ClavaOptions; } - static get ClavaPlatforms() { + static get CodeParser() { return JavaTypes.getType( - "pt.up.fe.specs.clava.weaver.importable.ClavaPlatforms" - ) as ClavaJavaClasses.ClavaPlatforms; + "pt.up.fe.specs.clang.codeparser.CodeParser" + ) as ClavaJavaClasses.CodeParser; } } diff --git a/Clava-JS/src-api/clava/ClavaJoinPoints.ts b/Clava-JS/src-api/clava/ClavaJoinPoints.ts index c4f73c6143..cc98549b75 100644 --- a/Clava-JS/src-api/clava/ClavaJoinPoints.ts +++ b/Clava-JS/src-api/clava/ClavaJoinPoints.ts @@ -96,7 +96,9 @@ export default class ClavaJoinPoints { $type: Joinpoints.Type ): Joinpoints.IncompleteArrayType { return wrapJoinPoint( - ClavaJavaTypes.AstFactory.incompleteArrayType(unwrapJoinPoint($type)) + ClavaJavaTypes.AstFactory.incompleteArrayType( + unwrapJoinPoint($type) + ) ); } @@ -944,7 +946,7 @@ export default class ClavaJoinPoints { return wrapJoinPoint( ClavaJavaTypes.AstFactory.memberAccess( unwrapJoinPoint(baseExpr), - field, + unwrapJoinPoint(field), unwrapJoinPoint(fieldType) ) ); diff --git a/Clava-JS/src-api/clava/graphs/ControlFlowGraph.ts b/Clava-JS/src-api/clava/graphs/ControlFlowGraph.ts index 84c6ef329a..dbc93107a7 100644 --- a/Clava-JS/src-api/clava/graphs/ControlFlowGraph.ts +++ b/Clava-JS/src-api/clava/graphs/ControlFlowGraph.ts @@ -1,5 +1,5 @@ import Graph from "@specs-feup/lara/api/lara/graphs/Graph.js"; -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import { Statement } from "../../Joinpoints.js"; import CfgBuilder from "./cfg/CfgBuilder.js"; diff --git a/Clava-JS/src-api/clava/graphs/StaticCallGraph.ts b/Clava-JS/src-api/clava/graphs/StaticCallGraph.ts index a37f397f06..b28f2edea2 100644 --- a/Clava-JS/src-api/clava/graphs/StaticCallGraph.ts +++ b/Clava-JS/src-api/clava/graphs/StaticCallGraph.ts @@ -1,7 +1,7 @@ import DotFormatter from "@specs-feup/lara/api/lara/graphs/DotFormatter.js"; import Graph from "@specs-feup/lara/api/lara/graphs/Graph.js"; import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import { FunctionJp, Joinpoint } from "../../Joinpoints.js"; import ScgNodeData from "./scg/ScgNodeData.js"; import StaticCallGraphBuilder from "./scg/StaticCallGraphBuilder.js"; diff --git a/Clava-JS/src-api/clava/graphs/cfg/CfgBuilder.ts b/Clava-JS/src-api/clava/graphs/cfg/CfgBuilder.ts index 4273bd9ac4..e2a4e46d99 100644 --- a/Clava-JS/src-api/clava/graphs/cfg/CfgBuilder.ts +++ b/Clava-JS/src-api/clava/graphs/cfg/CfgBuilder.ts @@ -1,6 +1,6 @@ import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import Query from "@specs-feup/lara/api/weaver/Query.js"; import { Break, diff --git a/Clava-JS/src-api/clava/graphs/cfg/CfgUtils.ts b/Clava-JS/src-api/clava/graphs/cfg/CfgUtils.ts index 625108b466..02507f6bec 100644 --- a/Clava-JS/src-api/clava/graphs/cfg/CfgUtils.ts +++ b/Clava-JS/src-api/clava/graphs/cfg/CfgUtils.ts @@ -1,4 +1,4 @@ -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import { Break, Case, diff --git a/Clava-JS/src-api/clava/graphs/cfg/NextCfgNode.ts b/Clava-JS/src-api/clava/graphs/cfg/NextCfgNode.ts index bd1f944bde..02493c0aa7 100644 --- a/Clava-JS/src-api/clava/graphs/cfg/NextCfgNode.ts +++ b/Clava-JS/src-api/clava/graphs/cfg/NextCfgNode.ts @@ -1,4 +1,4 @@ -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import { Case, FunctionJp, diff --git a/Clava-JS/src-api/clava/graphs/scg/StaticCallGraphBuilder.ts b/Clava-JS/src-api/clava/graphs/scg/StaticCallGraphBuilder.ts index a21911db4b..8a00b55d35 100644 --- a/Clava-JS/src-api/clava/graphs/scg/StaticCallGraphBuilder.ts +++ b/Clava-JS/src-api/clava/graphs/scg/StaticCallGraphBuilder.ts @@ -1,6 +1,6 @@ import { LaraJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.js"; import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import Query from "@specs-feup/lara/api/weaver/Query.js"; import { Call, FunctionJp, Joinpoint, Program } from "../../../Joinpoints.js"; import ScgEdgeData from "./ScgEdgeData.js"; diff --git a/Clava-JS/src-api/clava/hls/HLSAnalysis.ts b/Clava-JS/src-api/clava/hls/HLSAnalysis.ts deleted file mode 100644 index 10dec12583..0000000000 --- a/Clava-JS/src-api/clava/hls/HLSAnalysis.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { unwrapJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.js"; -import { FunctionJp } from "../../Joinpoints.js"; -import ClavaJavaTypes from "../ClavaJavaTypes.js"; - -export default class HLSAnalysis { - /** - * Applies a set of Vivado HLS directives to a provided function using a set - * of strategies to select and configure those directives. This function applies the - * main optimization flow, which is comprised of the following strategies, by this order: - * - Function Inlining - * - Array Streaming - * - Loop strategies (loop unrolling, pipelining and array partitioning) - * For a description of how each strategy works, as well as for a standalone version of - * each of these strategies, please consult the other methods of this class. - * - * @param func - A JoinPoint of the function to analyze - * @param options - An optional argument to specify the HLS options. The format - * is the following: \{"B": 2, "N": 32, "P": 64\} - * If not specified, the compiler will use the values provided in the example above. - * - */ - static applyGenericStrategies( - func: FunctionJp, - options: { B?: number; N?: number; P?: number } = {} - ) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyGenericStrategies( - unwrapJoinPoint(func), - JSON.stringify(options) - ); - } - - /** - * Applies the function inlining directive to every called function. - * It works by calculating the cost of both the called function and the callee, - * in which cost is defined as the total number of array loads on the total lifetime - * of the function. This is then fed to the formula: - * - * calleeCost \> (callFrequency * calledCost) / B - * - * If this function is true, the function is inlined. Factor B is configurable, and allows - * for this formula to be more restrictive/permissive, based on the user's needs. The - * default value is 2. - * - * - * @param func - A JoinPoint of the function to analyze - * @param B - A positive real number to control the heuristic's aggressiveness - * */ - static applyFunctionInlining(func: FunctionJp, B: number): void { - ClavaJavaTypes.HighLevelSynthesisAPI.applyFunctionInlining( - unwrapJoinPoint(func), - B.toString() - ); - } - - /** - * This strategy analyzes every input/output array of the function, and - * tries to see if they can be implemented as a FIFO. To do this, the strategy - * makes a series of checks to see whether the array can be implemented as such. - * These checks are: - * - Check if the array only has either loads or stores operations - * - Check if the array is always accessed sequentially (limited by the information - * available at compile time) - * - Check whether each array position is accessed only once during the entire function - * lifetime - * If all these checks apply, the array is implemented as a FIFO using a Vivado HLS directive. - * - * @param func - A JoinPoint of the function to analyze - * */ - static applyArrayStreaming(func: FunctionJp): void { - ClavaJavaTypes.HighLevelSynthesisAPI.applyArrayStreaming( - unwrapJoinPoint(func) - ); - } - - /** - * Analyzes every loop nest of a function and applies loop optimizations. These - * optimizations are a combination of loop unrolling and loop pipelining. For the latter - * to be efficient, array partitioning is also applied. This strategy works by always - * unrolling the innermost loop of every nest, with a resource limitation directive to - * prevent excessive resource usage. Then, if the number of iterations of the outermost - * loop is less than 4, that loop is also unrolled, and so on. However, this is an edge case, - * since this rarely happens; the outermost loop is, instead, pipelined. The array partitioning - * is done in two ways: if an array is less than 4096 bytes, it is mapped into registers; otherwise, - * it is partitioned into P partitions using a cyclic strategy. - * - * - * @param func - A JoinPoint of the function to analyze - * @param P - The number of partitions to use. 64 is the default. - * */ - static applyLoopStrategies(func: FunctionJp, P: number): void { - ClavaJavaTypes.HighLevelSynthesisAPI.applyLoopStrategies( - unwrapJoinPoint(func), - P.toString() - ); - } - - /** - * Applies the load/stores strategy to simple loops. A simple loop is defined as - * a function with only one loop with no nests, and in which every array is either only - * loaded from or stored to in each iteration. This method can validate whether the provided - * function is a simple loop or not. If it is one, then it applies three HLS directives in tandem: - * it unrolls the loop by a factor N (called the load/stores factor), it partitions each array by - * that same factor N using a cyclic strategy and finally it pipelines the loop. This strategy is - * better than the other generic strategies for this type of function. Generally, larger values lead - * to a better speedup, although there are exceptions. Therefore, it is recommended for users to - * experiment with different values if results are unsatisfactory (the default value is 32). - * - * - * @param func - A JoinPoint of the function to analyze - * @param N - A positive integer value for the load/stores factor - * */ - static applyLoadStoresStrategy(func: FunctionJp, N: number): void { - ClavaJavaTypes.HighLevelSynthesisAPI.applyLoadStoresStrategy( - unwrapJoinPoint(func), - N.toString() - ); - } - - /** - * Checks whether a function can be instrumented. Only workds for old versions - * of the trace2c tool. - * - * @param func - A JoinPoint of the function to analyze - * @returns Whether the function can be or not instrumented - * */ - static canBeInstrumented(func: FunctionJp): boolean { - return ClavaJavaTypes.HighLevelSynthesisAPI.canBeInstrumented( - unwrapJoinPoint(func) - ); - } -} diff --git a/Clava-JS/src-api/clava/hls/MathAnalysis.ts b/Clava-JS/src-api/clava/hls/MathAnalysis.ts deleted file mode 100644 index 53ee2dd017..0000000000 --- a/Clava-JS/src-api/clava/hls/MathAnalysis.ts +++ /dev/null @@ -1,200 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BuiltinType, Call, Expression } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MathHInfo, { MathInfo } from "./MathHInfo.js"; - -export class MathAnalysis { - static fullAnalysis(name: string, report: boolean) { - //Get functions from math.h - let mathFun = MathHInfo.getInfo(); - - //If unable to read math.h, use a fallback - if (mathFun.length < 3) { - mathFun = MathHInfo.hardcodedFallback; - } - - if (report) { - MathReport(mathFun, true, name); - } else { - MathReport(mathFun, false, ""); - MathCompare(mathFun); - MathReplace(mathFun); - } - } -} - -function MathReport(mathFun: MathInfo[], csv: boolean = false, name?: string) { - //Counter for occurences of each math.h function - const occurrences: Record = {}; - mathFun.forEach((f) => { - occurrences[f.name] = 0; - }); - - //Count occurrences - for (const elem of Query.search(Call).chain()) { - const fun = (elem["call"] as Call).name; - if (fun in occurrences) { - occurrences[fun] += 1; - } - } - - //Report occurrences - if (csv) { - let txt = ""; - if (Io.isFile("MathAnalysis.csv")) { - const lines = Io.readLines("MathAnalysis.csv"); - for (let i = 0; i < lines.length; i++) txt += lines[i] + "\n"; - } else { - txt = "source file,"; - for (const f in occurrences) txt += f + ","; - txt += "\n"; - } - txt += name + ","; - for (const f in occurrences) txt += occurrences[f] + ","; - txt += "\n"; - console.log(txt); - Io.writeFile("MathAnalysis.csv", txt); - } else { - console.log( - "Occurrences of each math.f function (not showing functions with 0 occurrences):" - ); - for (const f in occurrences) { - if (occurrences[f] > 0) { - console.log(f + ": " + occurrences[f]); - } - } - console.log(""); - } -} - -function MathCompare(mathFun: MathInfo[]) { - //Compare, for each call, the type of arguments and the function signature - console.log( - "Type of arguments being passed to each call to a math.h function:" - ); - for (const elem of Query.search(Call).chain()) { - const $call = elem["call"] as Call; - const fun = $call.name; - if (fun in mathFun) { - const args = $call.args; - const types = []; - for (let i = 0; i < args.length; i++) - types.push((args[i].type as BuiltinType).builtinKind); - console.log( - `-----------\nSig: ${$call.signature}\nArgs: ${types.join(", ")}` - ); - } - } - console.log(""); -} - -/** - * Applies a series of mathemtatical function replacements using the following rules: - * - For every function with a signature requiring args of type "double" but with the - * provided args of type "float", it replaces the function by its "float" equivalent, - * if present on the provided math.h info implementation - * - If a square root is found, it is replaced by a fast inverse square root and a multiplication, - * for both "double" and "float" types, as required. The implementation of the functions is added - * to the source file - * - Replaces calls to the "pow" function using an integer exponent with a series of multiplications - * - * @param mathFun - A javascript object holding information about the signature of all functions - * present on a math.h. Can be obtained using clava.hls.MathHInfo, or otherwise built manually - * (see documentation of clava.hls.MathHInfo for the format) - * */ -function MathReplace(mathFun: MathInfo[]) { - for (const elem of Query.search(Call).chain()) { - const $call = elem["call"] as Call; - const fun = $call.name; - if (fun in mathFun) { - const args = $call.args; - const types = []; - for (let i = 0; i < args.length; i++) - types.push((args[i].type as BuiltinType).builtinKind); - - //sqrtf -> rsqrt32 - if (fun == "sqrtf" || (fun == "sqrt" && !types.includes("Double", 0))) { - console.log("Replacing sqrtf for rsqrt32"); - $call.setName("mult_rsqrt32"); - } - //sqrt -> rsqrt64 - if (fun == "sqrt" && types.includes("Double", 0)) { - console.log("Replacing sqrt for sqrt64"); - $call.setName("mult_rsqrt64"); - } - //pow(d, Int) -> d * ... * d - if ( - (fun == "pow" || fun == "powf") && - types[1] == "Int" && - /[0-9]\d*/.test(args[1].code) - ) { - console.log("Replacing " + fun + " for explicit multiplication"); - const n = parseInt(args[1].code); - const expr = ClavaJoinPoints.parenthesis(args[0]); - - if (n >= 2) { - let node = ClavaJoinPoints.binaryOp( - "mul", - expr.copy() as Expression, - expr.copy() as Expression, - types[0] - ); - for (let i = 3; i <= n; i++) { - node = ClavaJoinPoints.binaryOp( - "mul", - expr.copy() as Expression, - node, - types[0] - ); - } - $call.replaceWith(node); - } - if (n == 1) { - $call.replaceWith(expr); - } - if (n == 0) { - $call.replaceWith(ClavaJoinPoints.integerLiteral(1)); - } - } - //conversion from using functions with doubles to floats - const isFloat = fun.substring(fun.length - 1) == "f"; - if (!isFloat && !fun.includes("sqrt", 0)) { - const newFun = fun + "f"; - if (newFun in mathFun) { - $call.setName(newFun); - console.log("Replacing " + fun + " for " + newFun); - } - } - } - } -} - -function rsqrt(): string { - return ` - -static inline float mult_rsqrt32(float number) { - uint32_t i; - float x2, y; - x2 = number * 0.5F; - y = number; - i = * (uint32_t *) &y; - i = 0x5f375a86 - (i >> 1); - y = *(float *) &i; - y = y * (1.5F - (x2 * y * y)); - return y * number; -} - -static inline double mult_rsqrt64(double number) { - uint64_t i; - double x2, y; - x2 = number * 0.5; - y = number; - i = * (uint64_t *) &y; - i = 0x5fe6eb50c7b537a9 - (i >> 1); - y = * (double *) &i; - y = y * (1.5 - (x2 * y * y)); - return y * number; -} -`; -} diff --git a/Clava-JS/src-api/clava/hls/MathHInfo.ts b/Clava-JS/src-api/clava/hls/MathHInfo.ts deleted file mode 100644 index 32b2e4edf9..0000000000 --- a/Clava-JS/src-api/clava/hls/MathHInfo.ts +++ /dev/null @@ -1,117 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp, Program } from "../../Joinpoints.js"; -import Clava from "../Clava.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; - -export interface MathInfo { - name: string; - returnType: string; - paramTypes: string[]; -} - -export default class MathHInfo { - static getInfo() { - // Save current AST - Clava.pushAst(); - - // Clear AST - for (const $file of Query.search(FileJp)) { - $file.detach(); - } - - // Prepare source file that will test math.h - const mathTestCode = ` - #include - double foo() {return abs(-1);} - `; - - const $testFile = ClavaJoinPoints.file("math_h_test.c"); - $testFile.insertBegin(mathTestCode); - - // Compile example code that will allow us to get path to math.h - (Query.root() as Program).addFile($testFile); - Clava.rebuild(); - - // Seach for the abs call and obtain math.h file where it was declared - const $absCall = Query.search(Call, "abs").first() as Call; - const mathIncludeFile = $absCall.declaration.filepath; - - // Clear AST - for (const $file of Query.search(FileJp)) { - $file.detach(); - } - - // Add math.h to the AST - const $mathFile = ClavaJoinPoints.file("math_copy.h"); - $mathFile.insertBegin(Io.readFile(mathIncludeFile)); - (Query.root() as Program).addFile($mathFile); - Clava.rebuild(); - - const results = []; - for (const $fn of Query.search(FileJp, "math_copy.h").search(FunctionJp)) { - const paramTypes = []; - for (const $param of $fn.params) { - paramTypes.push($param.type.code); - } - - const mathInfo: MathInfo = { - name: $fn.name, - returnType: $fn.type.code, - paramTypes: paramTypes, - }; - - results.push(mathInfo); - } - - // Restore original AST - Clava.popAst(); - - return results; - } - - static hardcodedFallback: MathInfo[] = [ - { name: "acos", returnType: "Double", paramTypes: ["Double"] }, - { name: "asin", returnType: "Double", paramTypes: ["Double"] }, - { name: "atan", returnType: "Double", paramTypes: ["Double"] }, - { name: "atan2", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "cos", returnType: "Double", paramTypes: ["Double"] }, - { name: "cosh", returnType: "Double", paramTypes: ["Double"] }, - { name: "sin", returnType: "Double", paramTypes: ["Double"] }, - { name: "sinh", returnType: "Double", paramTypes: ["Double"] }, - { name: "tanh", returnType: "Double", paramTypes: ["Double"] }, - { name: "exp", returnType: "Double", paramTypes: ["Double"] }, - { name: "frexp", returnType: "Double", paramTypes: ["Double", "Int"] }, - { name: "ldexp", returnType: "Double", paramTypes: ["Double", "Int"] }, - { name: "log", returnType: "Double", paramTypes: ["Double"] }, - { name: "log10", returnType: "Double", paramTypes: ["Double"] }, - { name: "modf", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "pow", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "sqrt", returnType: "Double", paramTypes: ["Double"] }, - { name: "ceil", returnType: "Double", paramTypes: ["Double"] }, - { name: "fabs", returnType: "Double", paramTypes: ["Double"] }, - { name: "floor", returnType: "Double", paramTypes: ["Double"] }, - { name: "fmod", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "acosf", returnType: "Float", paramTypes: ["Float"] }, - { name: "asinf", returnType: "Float", paramTypes: ["Float"] }, - { name: "atanf", returnType: "Float", paramTypes: ["Float"] }, - { name: "atan2f", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "cosf", returnType: "Float", paramTypes: ["Float"] }, - { name: "coshf", returnType: "Float", paramTypes: ["Float"] }, - { name: "sinf", returnType: "Float", paramTypes: ["Float"] }, - { name: "sinhf", returnType: "Float", paramTypes: ["Float"] }, - { name: "tanhf", returnType: "Float", paramTypes: ["Float"] }, - { name: "expf", returnType: "Float", paramTypes: ["Float"] }, - { name: "frexpf", returnType: "Float", paramTypes: ["Float", "Int"] }, - { name: "ldexpf", returnType: "Float", paramTypes: ["Float", "Int"] }, - { name: "logf", returnType: "Float", paramTypes: ["Float"] }, - { name: "log10f", returnType: "Float", paramTypes: ["Float"] }, - { name: "modff", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "powf", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "sqrtf", returnType: "Float", paramTypes: ["Float"] }, - { name: "ceilf", returnType: "Float", paramTypes: ["Float"] }, - { name: "fabsf", returnType: "Float", paramTypes: ["Float"] }, - { name: "floorf", returnType: "Float", paramTypes: ["Float"] }, - { name: "fmodf", returnType: "Float", paramTypes: ["Float", "Float"] }, - ]; -} diff --git a/Clava-JS/src-api/clava/hls/TraceInstrumentation.ts b/Clava-JS/src-api/clava/hls/TraceInstrumentation.ts deleted file mode 100644 index 9f810b3829..0000000000 --- a/Clava-JS/src-api/clava/hls/TraceInstrumentation.ts +++ /dev/null @@ -1,643 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { - ArrayAccess, - BinaryOp, - Expression, - FunctionJp, - Joinpoint, - Loop, - MemberAccess, - Param, - Scope, - Statement, - UnaryOp, - Vardecl, - Varref, -} from "../../Joinpoints.js"; -import Logger from "../../lara/code/Logger.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; - -const interfaces: Record = {}; -const locals: Record = {}; -const defCounters = ["const", "temp", "op", "mux", "ne"]; -const CM = '\\"'; -const NL = "\\n"; -let logger: Logger; - -/** - * Source code assumptions: - * - Arrays have predetermined size - * - No pointers - */ -export default class TraceInstrumentation { - static instrument(funName: string): void { - //Get function root - let root; - const filename = funName + ".dot"; - logger = new Logger(undefined, filename); - - for (const elem of Query.search(FunctionJp).chain()) { - if ((elem["function"] as FunctionJp).name == funName) - root = elem["function"]; - } - if (root == undefined) { - console.log("Function " + funName + " not found, terminating..."); - return; - } - - //Get scope and interface - let scope; - for (let i = 0; i < root.children.length; i++) { - const child = root.children[i]; - if (child instanceof Scope) { - scope = child; - } - if (child instanceof Param) { - registerInterface(child); - } - } - - if (scope == undefined) { - console.log("Function " + funName + " has no scope, terminating..."); - return; - } - - const children = scope.children; - - //Get global vars as interfaces - for (const elem of Query.search(Vardecl)) { - if (elem.isGlobal) registerInterface(elem); - } - - //Get local vars - for (const elem of Query.search(FunctionJp, { name: funName }).search( - Vardecl - )) { - registerLocal(elem); - } - - //Begin graph and create counters - const firstOp = children[0]; - logger.text("Digraph G {\\n").log(firstOp, true); - - createSeparator(firstOp); - createDefaultCounters(firstOp); - for (const entry in locals) { - declareLocalCounter(firstOp, entry); - } - for (const entry in interfaces) { - declareInterfaceCounter(firstOp, entry); - } - - //Load all interfaces - for (const inter in interfaces) { - initializeInterface(firstOp, inter); - } - createSeparator(firstOp); - - //Go through each statement and generate nodes and edges - explore(children); - - //Close graph - logger.text("}").log(children[scope.children.length - 1], true); - } -} - -function explore(children: Joinpoint[]): void { - for (let i = 0; i < children.length; i++) { - const child = children[i]; - - if (child instanceof Statement) { - if (child.children.length == 1) { - handleStatement(child.children[0]); - } - if (child.children.length > 1) { - if (child.children[0] instanceof Vardecl) { - for (let j = 0; j < child.children.length; j++) - handleStatement(child.children[j]); - } - } - } - if (child instanceof Loop) { - explore(child.children[3].children.slice()); - } - } -} - -//-------------------- -// Counters -//-------------------- -function createDefaultCounters(node: Joinpoint): void { - for (let i = 0; i < defCounters.length; i++) - node.insertBefore( - ClavaJoinPoints.stmtLiteral("int n_" + defCounters[i] + " = 0;") - ); -} - -function declareInterfaceCounter(node: Joinpoint, name: string): void { - const info = interfaces[name]; - const init = info.length == 1 ? " = 0;" : " = {0};"; - node.insertBefore( - ClavaJoinPoints.stmtLiteral("int " + getCounterOfVar(name, info) + init) - ); -} - -function declareLocalCounter(node: Joinpoint, name: string): void { - const info = locals[name]; - const init = info.length == 1 ? " = 0;" : " = {0};"; - node.insertBefore( - ClavaJoinPoints.stmtLiteral("int " + getCounterOfVar(name, info) + init) - ); -} - -function splitMulti(str: string, tokens: string[]): string[] { - const tempChar = tokens[0]; - for (let i = 1; i < tokens.length; i++) { - str = str.split(tokens[i]).join(tempChar); - } - const strParts = str.split(tempChar); - const newStr = []; - for (let i = 0; i < strParts.length; i++) { - if (strParts[i] != "") newStr.push(strParts[i]); - } - return newStr; -} - -function filterCommonKeywords( - value: string, - index: number, - arr: string[] -): boolean { - const common = ["const", "static", "unsigned"]; - return !common.includes(value); -} - -function registerInterface(param: Param): void { - let tokens = splitMulti(param.code, [" ", "]", "["]); - if (tokens.indexOf("=") != -1) tokens = tokens.slice(0, tokens.indexOf("=")); - tokens = tokens.filter(filterCommonKeywords); - const interName = tokens[1]; - tokens.splice(1, 1); - if (interfaces[interName] != undefined) return; - interfaces[interName] = tokens; -} - -function registerLocal(local: Vardecl): void { - let tokens = splitMulti(local.code, [" ", "]", "["]); - if (tokens.indexOf("=") != -1) tokens = tokens.slice(0, tokens.indexOf("=")); - tokens = tokens.filter(filterCommonKeywords); - const locName = tokens[1]; - tokens.splice(1, 1); - if (interfaces[locName] != undefined) return; - if (locals[locName] != undefined) return; - locals[locName] = tokens; -} - -function getCounterOfVar(name: string, info: string[]): string { - let str = "n_" + name; - for (let i = 1; i < info.length; i++) str += "[" + info[i] + "]"; - return str; -} - -function isLocal(varName: string): boolean { - return locals[varName] != undefined; -} - -function isInterface(varName: string): boolean { - return interfaces[varName] != undefined; -} - -//-------------------- -// Create nodes -//-------------------- -function refCounter(name: string): Varref { - name = "n_" + name; - return ClavaJoinPoints.varRef(name, ClavaJoinPoints.builtinType("int")); -} - -function refArrayCounter(name: string, indexes: string[]): Statement { - name = "n_" + name; - for (let i = 0; i < indexes.length; i++) name += "[" + indexes[i] + "]"; - return ClavaJoinPoints.stmtLiteral(name); -} - -function refAnyExpr(code: string): Statement { - return ClavaJoinPoints.stmtLiteral(code); -} - -function incrementCounter( - node: Joinpoint, - variable: string, - indexes?: string[] -): void { - if (indexes != undefined) { - let access = ""; - for (let i = 0; i < indexes.length; i++) { - access += "[" + indexes[i] + "]"; - } - node.insertBefore( - ClavaJoinPoints.stmtLiteral("n_" + variable + access + "++;") - ); - } else { - node.insertBefore(ClavaJoinPoints.stmtLiteral("n_" + variable + "++;")); - } -} - -function storeVar(node: Joinpoint, variable: string): void { - incrementCounter(node, variable); - const att1 = "var"; - let att2 = ""; - let att3 = ""; - if (isLocal(variable)) { - att2 = "loc"; - att3 = locals[variable][0]; - } - if (isInterface(variable)) { - att2 = "inte"; - att3 = interfaces[variable][0]; - } - logger - .text(CM + variable + "_") - .int(refCounter(variable)) - .text( - CM + - " [label=" + - CM + - variable + - CM + - ", att1=" + - att1 + - ", att2=" + - att2 + - ", att3=" + - att3 + - "];" + - NL - ) - .log(node, true); -} - -function storeArray( - node: Joinpoint, - variable: string, - indexes: string[] -): void { - incrementCounter(node, variable, indexes); - const att1 = "var"; - let att2 = ""; - let att3 = ""; - if (isLocal(variable)) { - att2 = "loc"; - att3 = locals[variable][0]; - } - if (isInterface(variable)) { - att2 = "inte"; - att3 = interfaces[variable][0]; - } - logger.text(CM + variable); - for (let i = 0; i < indexes.length; i++) { - logger.text("[").int(refAnyExpr(indexes[i])).text("]"); - } - logger - .text("_") - .int(refArrayCounter(variable, indexes)) - .text("_l" + CM); - logger.text(" [label=" + CM + variable); - for (let i = 0; i < indexes.length; i++) { - logger.text("[").int(refAnyExpr(indexes[i])).text("]"); - } - logger - .text( - CM + ", att1=" + att1 + ", att2=" + att2 + ", att3=" + att3 + "];" + NL - ) - .log(node, true); -} - -function createOp(node: Joinpoint, op: string): void { - incrementCounter(node, "op"); - logger - .text(CM + "op") - .int(refCounter("op")) - .text(CM + " [label=" + CM + op + CM + ", att1=op];" + NL) - .log(node, true); -} - -function createMux(node: Joinpoint): void { - //TODO: include OP attribute? - incrementCounter(node, "mux"); - logger - .text(CM + "mux") - .int(refCounter("mux")) - .text(CM + " [label=" + CM + "mux") - .int(refCounter("mux")) - .text(CM + ", att1=mux];" + NL) - .log(node, true); -} - -function createConst(node: Joinpoint, num: string): void { - incrementCounter(node, "const"); - logger - .text(CM + "const") - .int(refCounter("const")) - .text(CM + " [label=" + CM + parseInt(num) + CM + ", att1=const];" + NL) - .log(node, true); -} - -function createTemp(node: Joinpoint, type: string): void { - incrementCounter(node, "temp"); - logger - .text(CM + "temp") - .int(refCounter("temp")) - .text(CM + " [label=" + CM + "temp") - .int(refCounter("temp")) - .text(CM + ", att1=var, att2=loc, att3=" + type + "];" + NL) - .log(node, true); -} - -function createSeparator(node: Joinpoint): void { - const separator = "//---------------------"; - node.insertBefore(ClavaJoinPoints.stmtLiteral(separator)); -} - -//-------------------- -// Create edges -//-------------------- -function createEdge( - node: Joinpoint, - source: string[], - dest: string[], - pos?: string, - offset?: string -): void { - incrementCounter(node, "ne"); - logger.text(CM); - if (source.length == 1) { - if (defCounters.includes(source[0])) { - if (source[0] == "temp" && offset != undefined) - logger.text(source[0]).int(refAnyExpr("n_temp" + offset)); - else logger.text(source[0]).int(refCounter(source[0])); - } else logger.text(source[0]).text("_").int(refCounter(source[0])); - } else { - logger.text(source[0]); - for (let i = 1; i < source.length; i++) - logger.text("[").int(refAnyExpr(source[i])).text("]"); - logger - .text("_") - .int(refArrayCounter(source[0], source.slice(1))) - .text("_l"); - } - logger.text(CM + " -> " + CM); - if (dest.length == 1) { - if (defCounters.includes(dest[0])) { - if (dest[0] == "temp" && offset != undefined) - logger.text(dest[0]).int(refAnyExpr("n_temp" + offset)); - else logger.text(dest[0]).int(refCounter(dest[0])); - } else logger.text(dest[0]).text("_").int(refCounter(dest[0])); - } else { - logger.text(dest[0]); - for (let i = 1; i < dest.length; i++) - logger.text("[").int(refAnyExpr(dest[i])).text("]"); - logger - .text("_") - .int(refArrayCounter(dest[0], dest.slice(1))) - .text("_l"); - } - logger - .text(CM + " [label=" + CM) - .int(refCounter("ne")) - .text(CM + ", ord=" + CM) - .int(refCounter("ne")); - if (pos != undefined) logger.text(CM + ", pos=" + CM + pos); - logger.text(CM + "];" + NL).log(node, true); -} - -//-------------------- -// Handle statements -//-------------------- -function handleStatement(node: Joinpoint): void { - createSeparator(node); - if (node instanceof Vardecl) handleVardecl(node); - if (node instanceof BinaryOp) handleAssign(node); - if (node instanceof UnaryOp) handleUnaryOp(node); - createSeparator(node); -} - -function handleVardecl(node: Vardecl): void { - //Not contemplating arrays, TODO if necessary - if (node.children.length != 1) return; - const info = getInfo(node.children[0]); - storeVar(node, node.name); - createEdge(node, info, [node.name]); -} - -function handleAssign(node: BinaryOp): void { - //Build rhs node(s) - let rhsInfo = getInfo(node.right); - - //Build lhs node - const lhsInfo = getInfo(node.left); - - //If assignment, load extra node and build op - if (node.kind.includes("_")) { - const opKind = mapOperation(node.kind); - createOp(node, opKind); - if (rhsInfo[0] == "temp" && lhsInfo[0] == "temp") - createEdge(node, rhsInfo, ["op"], "r", "-1"); - else createEdge(node, rhsInfo, ["op"], "r"); - createEdge(node, lhsInfo, ["op"], "l"); - rhsInfo = ["op"]; - } - - if (node.left instanceof ArrayAccess) { - storeArray(node, lhsInfo[0], lhsInfo.slice(1)); - } - if (node.left instanceof Varref) { - storeVar(node, lhsInfo[0]); - } - - //Create assignment edge - createEdge(node, rhsInfo, lhsInfo); -} - -function handleUnaryOp(node: UnaryOp): string[] | void { - if (node.kind.includes("pre") || node.kind.includes("post")) { - createOp(node, mapOperation(node.kind)); - const info = handleVarref(node.children[0] as Varref); - createConst(node, "1"); - createEdge(node, ["const"], ["op"], "r"); - createEdge(node, info, ["op"], "l"); - storeVar(node, info[0]); - createEdge(node, ["op"], info); - } else return ["const"]; -} - -function handleVarref(node: Varref): string[] { - return [node.name]; -} - -function handleArrayAccess(node: ArrayAccess): string[] { - const info = [(node.arrayVar as Varref | MemberAccess).name]; - for (let i = 0; i < node.subscript.length; i++) - info.push(node.subscript[i].code); - return info; -} - -function handleBinaryOp(node: BinaryOp): string[] { - //Build rhs - const rhsInfo = getInfo(node.right); - - //Build lhs - const lhsInfo = getInfo(node.left); - - //Build op - const opKind = mapOperation(node.kind); - createOp(node, opKind); - if (rhsInfo[0] == "temp" && lhsInfo[0] == "temp") - createEdge(node, rhsInfo, ["op"], "r", "-1"); - else createEdge(node, rhsInfo, ["op"], "r"); - createEdge(node, lhsInfo, ["op"], "l"); - - //Build temp - createTemp(node, "float"); - createEdge(node, ["op"], ["temp"]); - return ["temp"]; -} - -function getInfo(node: Joinpoint): string[] { - let info = ["null"]; - if (node instanceof Varref) info = handleVarref(node); - if (node instanceof BinaryOp) info = handleBinaryOp(node); - if (node instanceof ArrayAccess) info = handleArrayAccess(node); - if (node instanceof Expression) info = handleExpression(node); - return info; -} - -function handleExpression(node: Joinpoint): string[] { - if (node.children.length == 3 && node.children[0] instanceof Expression) { - //Build comparison - const cmpInfo = getInfo(node.children[0].children[0]); - - //Build true value - const trueInfo = getInfo(node.children[1]); - - //Build false value - const falseInfo = getInfo(node.children[2]); - - //Build multiplexer - createMux(node); - createEdge(node, cmpInfo, ["mux"], "sel"); - createEdge(node, trueInfo, ["mux"], "t"); - createEdge(node, falseInfo, ["mux"], "f"); - return ["mux"]; - } - if (node.children.length == 1) return getInfo(node.children[0]); - if (node.children.length == 0) { - createConst(node, node.code); - return ["const"]; - } - return ["null"]; -} - -//-------------------- -// Utils -//-------------------- -function mapOperation(op: string): string { - switch (op) { - case "mul": - return "*"; - case "div": - return "/"; - case "rem": - return "%"; - case "add": - return "+"; - case "sub": - return "-"; - case "shl": - return "<<"; - case "shr": - return ">>"; - case "cmp": - return "cmp"; - case "lt": - return "<"; - case "gt": - return ">"; - case "le": - return "<="; - case "ge": - return ">="; - case "eq": - return "=="; - case "ne": - return "!="; - case "and": - return "&"; - case "xor": - return "^"; - case "or": - return "|"; - case "l_and": - return "&&"; - case "l_or": - return "||"; - case "assign": - return "="; - case "mul_assign": - return "*"; - case "rem_assign": - return "%"; - case "add_assign": - return "+"; - case "sub_assign": - return "-"; - case "shl_assign": - return "<<"; - case "shr_assign": - return ">>"; - case "and_assign": - return "&&"; - case "xor_assign": - return "^"; - case "or_assign": - return "||"; - case "post_int": - return "+"; - case "post_dec": - return "-"; - case "pre_inc": - return "+"; - case "pre_dec": - return "-"; - } - return op; -} - -function initializeInterface(node: Joinpoint, variable: string): void { - let level = 0; - let stmt = ""; - const info = []; - const indexes = ["_i", "_j", "_k", "_l", "_m", "_n"]; - for (let i = 1; i < interfaces[variable].length; i++) { - stmt += - "for (int " + - indexes[level] + - " = 0; " + - indexes[level] + - " < " + - interfaces[variable][i] + - "; " + - indexes[level] + - "++) {\n"; - info.push(indexes[level]); - level++; - } - node.insertBefore(ClavaJoinPoints.stmtLiteral(stmt)); - - if (level != 0) storeArray(node, variable, info); - else storeVar(node, variable); - - stmt = ""; - for (let i = 0; i < level; i++) stmt += "}\n"; - node.insertBefore(ClavaJoinPoints.stmtLiteral(stmt)); -} diff --git a/Clava-JS/src-api/clava/liveness/LivenessAnalyser.ts b/Clava-JS/src-api/clava/liveness/LivenessAnalyser.ts index e4b7735697..1267b9aa7d 100644 --- a/Clava-JS/src-api/clava/liveness/LivenessAnalyser.ts +++ b/Clava-JS/src-api/clava/liveness/LivenessAnalyser.ts @@ -1,4 +1,4 @@ -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import { Case, Expression, If, Statement, Switch } from "../../Joinpoints.js"; import ControlFlowGraph from "../graphs/ControlFlowGraph.js"; import CfgNodeData from "../graphs/cfg/CfgNodeData.js"; diff --git a/Clava-JS/src-api/clava/liveness/LivenessAnalysis.ts b/Clava-JS/src-api/clava/liveness/LivenessAnalysis.ts index 1d571e565f..e2c9ab7263 100644 --- a/Clava-JS/src-api/clava/liveness/LivenessAnalysis.ts +++ b/Clava-JS/src-api/clava/liveness/LivenessAnalysis.ts @@ -1,4 +1,4 @@ -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import ControlFlowGraph from "../graphs/ControlFlowGraph.js"; import LivenessAnalyser from "./LivenessAnalyser.js"; diff --git a/Clava-JS/src-api/clava/liveness/LivenessUtils.ts b/Clava-JS/src-api/clava/liveness/LivenessUtils.ts index 998b335468..ed65bcb7c0 100644 --- a/Clava-JS/src-api/clava/liveness/LivenessUtils.ts +++ b/Clava-JS/src-api/clava/liveness/LivenessUtils.ts @@ -1,5 +1,5 @@ import { LaraJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.js"; -import cytoscape from "@specs-feup/lara/api/libs/cytoscape-3.26.0.js"; +import cytoscape from "cytoscape"; import Query from "@specs-feup/lara/api/weaver/Query.js"; import { BinaryOp, diff --git a/Clava-JS/src-api/clava/memoi/MemoiAnalysis.ts b/Clava-JS/src-api/clava/memoi/MemoiAnalysis.ts deleted file mode 100644 index 937260974a..0000000000 --- a/Clava-JS/src-api/clava/memoi/MemoiAnalysis.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { JSONtoFile } from "@specs-feup/lara/api/core/output.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FunctionJp, Type, Varref } from "../../Joinpoints.js"; -import MemoiTarget from "./MemoiTarget.js"; -import MemoiUtils from "./MemoiUtils.js"; - -/** - * Enum with the results of the predicate test. - */ -export enum PRED { - VALID = 1, - INVALID = -1, - WAITING = 0, -} - -type MemoiPred = ( - $call: Call, - processed: Record, - report: FailReport -) => PRED | undefined; - -export default class MemoiAnalysis { - /** - * Returns array of MemoiTarget. - */ - static findTargets(pred: MemoiPred) { - return MemoiAnalysis.findTargetsReport(pred).targets; - } - - /** - * Returns MemoiTargetReport. - */ - static findTargetsReport(pred: MemoiPred = defaultMemoiPred) { - const targets = []; - const report = new FailReport(); - - const processed = {}; - - for (const $call of Query.search(Call)) { - // find function or skip - const $func = $call.function; - if ($func === undefined) { - continue; - } - - const sig = MemoiUtils.normalizeSig($func.signature); - - // if we've processed this one before (valid or not), skip - if (isProcessed(sig, processed)) { - continue; - } - - // test if valid - const valid = pred($call, processed, report); - if (valid === PRED.VALID) { - targets.push(MemoiTarget.fromFunction($func)); - } - } - - return new MemoiTargetReport(targets, report); - } -} - -function isProcessed( - sig: string, - processed: Parameters[1] -): boolean { - return processed[sig] === PRED.VALID || processed[sig] === PRED.INVALID; -} - -function isWaiting(sig: string, processed: Parameters[1]): boolean { - return processed[sig] === PRED.WAITING; -} - -/** - * This is the default predicate. - */ -function defaultMemoiPred( - $call: Call, - processed: Parameters[1], - report: FailReport -) { - const test = defaultMemoiPredRecursive($call, processed, report); - - if (test === PRED.WAITING) { - const sig = $call.signature; - - processed[sig] = PRED.VALID; - return PRED.VALID; - } - - return test; -} - -/** - * Checks if the target function is valid. - * - * The constraints are: - * 1) has between 1 and 3 parameters - * 2) type of inputs and outputs is one of \{int, float, double\} - * 3) It doesn't access global state; - * 4) It doesn't call non-valid functions. - */ -function defaultMemoiPredRecursive( - $call: Call, - processed: Parameters[1], - report: FailReport -) { - const sig = MemoiUtils.normalizeSig($call.signature); - - // 0) check if this function was processed before - if (isProcessed(sig, processed)) { - return processed[sig]; - } - - // mark this as being processed - processed[sig] = PRED.WAITING; - - const $func = $call.function; - const $functionType = $func.functionType; - const $returnType = $functionType.returnType; - const paramTypes = $functionType.paramTypes; - - // 1) has between 1 and 3 parameters - if (paramTypes.length < 1 || paramTypes.length > 3) { - debug(sig + " - wrong number of parameters: " + paramTypes.length); - - report.incNumParams($func.signature, paramTypes.length); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - - // 2) type of return and params is one of {int, float, double} - if (!testType($returnType, ["int", "float", "double"])) { - debug(sig + " - return type is not supported: " + $returnType.code); - - report.incTypeReturn($func.signature, $returnType.code); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - - for (const $type of paramTypes) { - if (!testType($type, ["int", "float", "double"])) { - debug(sig + " - param type is not supported: " + $type.code); - - report.incTypeParams($func.signature, $type.code); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - } - - // Try to get the definition - const $def = $call.definition; - if ($def === undefined) { - if (!MemoiUtils.isWhiteListed(sig)) { - debug(sig + " - definition not found, not whitelisted"); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } else { - processed[sig] = PRED.VALID; - return PRED.VALID; - } - } - - // 3) It doesn't access global state (unless constants) - const varRefs = $def.getDescendants("varref") as Varref[]; - for (const $ref of varRefs) { - const $varDecl = $ref.vardecl; - - if ($varDecl.isGlobal && (!$ref.type.constant || $ref.type.isPointer)) { - debug(sig + " - accesses non-const global storage variable " + $ref.code); - - report.incGlobalAccess($func.signature); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - } - - // 4) It doesn't call non-valid functions - let isChildWaiting = false; - const $calls = $def.getDescendants("call") as Call[]; - for (const $childCall of $calls) { - const childSig = $childCall.signature; - - if (isWaiting(childSig, processed)) { - isChildWaiting = true; - continue; - } - - const test = defaultMemoiPredRecursive($childCall, processed, report); - if (test === PRED.INVALID) { - debug(sig + " - calls invalid function " + childSig); - - report.incInvalidCalls(); - - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } else if (test === PRED.WAITING) { - isChildWaiting = true; - } - } - - if (isChildWaiting) { - processed[sig] = undefined; - return PRED.WAITING; - } - - // Everything checked OK - processed[sig] = PRED.VALID; - return PRED.VALID; -} - -/** - * Tests if the type is one of the provided types. - */ -function testType($type: Type, typesToTest: string[]) { - const code = $type.code; - return typesToTest.includes(code); -} - -/** - * Class to hold info about target finding (targets and reports). - */ -export class MemoiTargetReport { - targets: MemoiTarget[]; - failReport: FailReport; - - constructor(targets: MemoiTarget[], failReport: FailReport) { - this.targets = targets; - this.failReport = failReport; - } - - isTarget($func: FunctionJp) { - const sig = MemoiUtils.normalizeSig($func.signature); - - for (const t of this.targets) { - if (t.sig === sig) { - return true; - } - } - - return false; - } - - toJson(jsonPath: string) { - JSONtoFile(jsonPath, this); - } - - printFailReport() { - console.log("Reasons to fail:"); - - if (this.failReport.numParams > 0) { - console.log(`\tWrong number of params: ${this.failReport.numParams}`); - console.log( - "\t\t{" + - Object.keys(this.failReport.unsupportedNumParams) - .map( - (key) => `${key}: ${this.failReport.unsupportedNumParams[key]}` - ) - .join(", ") + - "}" - ); - } - - if (this.failReport.typeParams > 0) - console.log(`\tWrong type of params: ${this.failReport.typeParams}`); - - if (this.failReport.typeReturn > 0) - console.log(`\tWrong type of return: ${this.failReport.typeReturn}`); - - if (this.failReport.typeParams > 0 || this.failReport.typeReturn > 0) { - console.log( - "\t\t{" + - Object.keys(this.failReport.unsupportedTypes) - .map((key) => `${key}: ${this.failReport.unsupportedTypes[key]}`) - .join(", ") + - "}" - ); - } - - if (this.failReport.globalAccess > 0) - console.log(`\tGlobal accesses: ${this.failReport.globalAccess}`); - - if (this.failReport.invalidCalls > 0) - console.log( - `\tCalls to invalid functions: ${this.failReport.invalidCalls}` - ); - } -} - -/** - * Class to hold info about failed targets. - */ -export class FailReport { - private _failMap: Record = {}; - private _numParams: number = 0; - private _unsupportedNumParams: Record = {}; - private _typeParams: number = 0; - private _typeReturn: number = 0; - private _unsupportedTypes: Record = {}; - private _globalAccess: number = 0; - private _invalidCalls: number = 0; - - get numParams() { - return this._numParams; - } - - get typeParams() { - return this._typeParams; - } - - get typeReturn() { - return this._typeReturn; - } - - get globalAccess() { - return this._globalAccess; - } - - get invalidCalls() { - return this._invalidCalls; - } - - get unsupportedNumParams() { - return this._unsupportedNumParams; - } - - get unsupportedTypes() { - return this._unsupportedTypes; - } - - incNumParams(sig: string, num: number | string) { - this._failMap[sig] = "Wrong number of params"; - this._numParams++; - this._addUnsupportedNumParams(String(num)); - } - - private _addUnsupportedNumParams(num: string) { - this._unsupportedNumParams[num] - ? this._unsupportedNumParams[num]++ - : (this._unsupportedNumParams[num] = 1); - } - - incTypeParams(sig: string, type: string) { - this._failMap[sig] = "Wrong type of params"; - this._typeParams++; - this._addUnsupportedTypes(type); - } - - incTypeReturn(sig: string, type: string) { - this._failMap[sig] = "Wrong type of return"; - this._typeReturn++; - this._addUnsupportedTypes(type); - } - - private _addUnsupportedTypes(type: string) { - this._unsupportedTypes[type] - ? this._unsupportedTypes[type]++ - : (this._unsupportedTypes[type] = 1); - } - - incGlobalAccess(sig: string) { - this._failMap[sig] = "Global accesses"; - this._globalAccess++; - } - - incInvalidCalls(sig?: string) { - if (sig) { - this._failMap[sig] = "Calls to invalid functions"; - } - - this._invalidCalls++; - } -} diff --git a/Clava-JS/src-api/clava/memoi/MemoiGen.ts b/Clava-JS/src-api/clava/memoi/MemoiGen.ts deleted file mode 100644 index 873ac6d742..0000000000 --- a/Clava-JS/src-api/clava/memoi/MemoiGen.ts +++ /dev/null @@ -1,556 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { arrayFromArgs } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import { TimerUnit } from "@specs-feup/lara/api/lara/util/TimeUnits.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp } from "../../Joinpoints.js"; -import Timer from "../../lara/code/Timer.js"; -import ClavaJavaTypes, { ClavaJavaClasses } from "../ClavaJavaTypes.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiTarget from "./MemoiTarget.js"; -import MemoiUtils from "./MemoiUtils.js"; - -class MemoiGen { - private _target: MemoiTarget; - private _isEmpty: boolean = true; - private _isOnline: boolean = true; - private _isUpdateAlways: boolean = false; - private _approxBits: number = 0; - private _isProf: boolean = false; - private _profReportFiles: string[] = []; - private _tableSize: number = 65536; - private _isDebug: boolean = false; - private _applyPolicy = MemoiGen.ApplyPolicy.NOT_EMPTY; - private _isZeroSim: boolean = false; - private _isResetFunc: boolean = false; - - constructor(target: MemoiTarget) { - this._target = target; - } - - /** - * Sets whether to generate a reset function. - * */ - setResetFunc(isResetFunc: boolean = true) { - this._isResetFunc = isResetFunc; - } - - /** - * Sets whether to generate code for a 0% sim. - * */ - setZeroSim(isZeroSim: boolean = true) { - this._isZeroSim = isZeroSim; - } - - /** - * Sets whether to generate an empty table in the final application. - * */ - setEmpty(isEmpty: boolean = true) { - this._isEmpty = isEmpty; - } - - /** - * Sets whether to generate update code in the final application. - * */ - setOnline(isOnline: boolean = true) { - this._isOnline = isOnline; - } - - /** - * Sets whether to always update the table on a miss, even if not vacant. - * */ - setUpdateAlways(isUpdateAlways: boolean = true) { - this._isUpdateAlways = isUpdateAlways; - } - - /** - * Sets the approximation bits in the final application. - * Defaults to 0. - * */ - setApproxBits(bits: number = 0) { - this._approxBits = bits; - } - - /** - * Sets the table size in the final application. - * Defaults to 65536. - * */ - setTableSize(size: number = 65536) { - const allowedSizes = [ - 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, - ]; - if (!allowedSizes.includes(size)) { - throw new Error( - "MemoiGen.setTableSize: The possible table sizes are 2^b, with b in [8, 16]." - ); - } - - this._tableSize = size; - } - - /** - * Sets whether to generate debug code in the final application. - * */ - setDebug(isDebug: boolean = true) { - this._isDebug = isDebug; - } - - /** - * Sets the apply policy. - * Defaults to MemoiApplyPolicy.NOT_EMPTY. - */ - setApplyPolicy( - policy: MemoiGen.ApplyPolicy = MemoiGen.ApplyPolicy.NOT_EMPTY - ) { - this._applyPolicy = policy; - } - - /** - * Checks files with the given names for reports matching the current target. - * @param names - the paths of the report files - */ - setProfFromFileNames(...names: string[]) { - this._isProf = true; - this._isEmpty = false; - - const namesArray = arrayFromArgs(names) as string[]; - - for (const name of namesArray) { - if (!Io.isFile(name)) { - throw new Error(`MemoiGen.setProfFromFileNames: ${name} is not a file`); - } - this._profReportFiles.push(name); - } - } - - /** - * Checks dir for reports matching the current target. - * @param dir - The path to the directory of the report files - */ - setProfFromDir(dir: string) { - this._isProf = true; - this._isEmpty = false; - this._profReportFiles = Io.getFiles(dir, "*.json", false).map((f) => - f.getAbsolutePath() - ); - } - - /** - * Generates a table for all calls of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generate() { - return this._generateAll(); - } - - /** - * Generates a table for each call of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generateEach() { - this.checkParams("generateEach"); - - if (this._isProf) { - return this.generateFromReport(); - } else { - return this._generateEach(undefined); - } - } - - /** - * Generates a table for all calls of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generateAll() { - this.checkParams("generateAll"); - - if (this._isProf) { - return this.generateFromReport(); - } else { - return this._generateAll(undefined); - } - } - - private generateFromReport() { - const s = new Set(); - - const reportsMap = ClavaJavaTypes.MemoiReportsMap.fromNames( - this._profReportFiles - ); // maybe this needs list - - const siteMap = reportsMap.get(this._target.sig); - - if (siteMap === null || siteMap === undefined) { - throw ( - "Could not find report for target " + - this._target.sig + - " in files [" + - this._profReportFiles.join(", ") + - "]" - ); - } - - for (const site in siteMap) { - // merge all reports for this - const reportPathList = siteMap.get(site); - const report = ClavaJavaTypes.MemoiReport.mergeReportsFromNames( - reportPathList - ) as ClavaJavaClasses.MemoiReport; - - if (site === "global") { - const sTmp = this._generateAll(report); - for (const sT of sTmp.values()) { - s.add(sT); - } - } else { - const sTmp = this._generateEach(report); - for (const sT of sTmp.values()) { - s.add(sT); - } - } - } - - return s; - } - - private _generateEach(report?: ClavaJavaClasses.MemoiReport) { - const s = new Set(); - - const cSig = MemoiUtils.cSig(this._target.sig); - - const filter = { - signature: (s: Call["signature"]) => - this._target.sig === MemoiUtils.normalizeSig(s), - location: (l: Call["location"]) => - report !== undefined ? report.callSites[0] === l : true, // if there is a report, we also filter by site - }; - - for (const $call of Query.search(Call, filter)) { - const wrapperName = IdGenerator.next("mw_" + cSig); - s.add(wrapperName); - - $call.wrap(wrapperName); - - this.generateGeneric(wrapperName, report); - } - - return s; - } - - private _generateAll(report?: ClavaJavaClasses.MemoiReport) { - const s = new Set(); - - const cSig = MemoiUtils.cSig(this._target.sig); - const wrapperName = "mw_" + cSig; - s.add(wrapperName); - - for (const $call of Query.search(Call, { - signature: (s: Call["signature"]) => - this._target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - this.generateGeneric(wrapperName, report); - - return s; - } - - generatePerfectInst() { - const cSig = MemoiUtils.cSig(this._target.sig); - const wrapperName = "mw_" + cSig; - const globalName = "memoi_target_timer"; - const printName = "print_perfect_inst"; - - // wrap every call to the target - for (const $call of Query.search(Call, { - signature: (s: string) => this._target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - - // change the wrapper by timing around the original call - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain()) { - const $file = chain["file"] as FileJp; - const $function = chain["function"] as FunctionJp; - const $call = chain["call"] as Call; - - const t = new Timer(TimerUnit.SECONDS); - - $file.addGlobal(globalName, ClavaJoinPoints.builtinType("double"), "0.0"); - - const tVar = t.time($call); - $function.insertReturn(`memoi_target_timer += ${tVar};`); - } - - // if print_perfect_inst function is found, some other target has dealt with the main code and we're done - for (const chain of Query.search(FileJp, { hasMain: true }) - .search(FunctionJp, { name: printName }) - .chain()) { - return; - } - - // change the main function to print the time to a file - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain()) { - const $file = chain["file"] as FileJp; - const $main = chain["function"] as FunctionJp; - - $file.addGlobal(globalName, ClavaJoinPoints.builtinType("double"), "0.0"); - $file.addInclude("stdio.h", true); - $file.addInclude("sys/stat.h", true); - $file.addInclude("sys/types.h", true); - $file.addInclude("errno.h", true); - $file.addInclude("string.h", true); - $file.addInclude("libgen.h", true); - - $main.insertReturn(printName + "(argv[0]);"); - $main.insertBefore("void " + printName + "(char*);"); - - const $function = $file.addFunction(printName) as FunctionJp; - $function.setParamsFromStrings(["char* name"]); - - $function.insertReturn(` - - - errno = 0; - char* prog_name = basename(name); - char* file_name = malloc(strlen(prog_name) + strlen("${globalName}.txt") + 1 + 1); - sprintf(file_name, "%s.%s", prog_name, "${globalName}.txt"); - - FILE * ${globalName}_file = fopen (file_name,"a"); - if(${globalName}_file == NULL) { - perror("Could not create file for memoi perfect instrumentation"); - } else { - fprintf(${globalName}_file, "%f\n", ${globalName}); - fclose(${globalName}_file); - } - `); - } - } - - private generateGeneric( - wrapperName: string, - report?: ClavaJavaClasses.MemoiReport - ) { - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain()) { - const $file = chain["file"] as FileJp; - const $function = chain["function"] as FunctionJp; - const $call = chain["call"] as Call; - - let dmt: any | undefined = undefined; - if (report !== undefined) { - // build the DMT and test the apply policy - dmt = ClavaJavaTypes.MemoiCodeGen.generateDmt( - this._tableSize, - report, - this._applyPolicy - ); - if (!dmt.testPolicy()) { - console.log( - this._target.sig + - "[" + - report.callSites[0] + - "]" + - " fails the apply policy " + - this._applyPolicy + - ". Not applying memoization." - ); - return; - } - } - - let updatesName: string | undefined = undefined; - if (this._isDebug) { - const totalName = wrapperName + "_total_calls"; - const missesName = wrapperName + "_total_misses"; - $file.addGlobal( - totalName, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - $file.addGlobal( - missesName, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - $call.insert("before", `${totalName}++;`); - $call.insert("after", `${missesName}++;`); - - if (this._isOnline) { - updatesName = wrapperName + "_total_updates"; - $file.addGlobal( - updatesName, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - } - - this.addMainDebug(totalName, missesName, updatesName, wrapperName); - } - - // generate the table (and reset) code and add it before the wrapper - const tableCode = ClavaJavaTypes.MemoiCodeGen.generateTableCode( - dmt.getTable(), - this._tableSize, - this._target.numInputs, - this._target.numOutputs, - this._isOnline, - this._isResetFunc, - this._isZeroSim ? true : this._isEmpty, // whether this is an empty table - wrapperName - ) as string; - $function.insert("before", tableCode); - - // generate the logic code and add it before the original call - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - const logicCode = ClavaJavaTypes.MemoiCodeGen.generateLogicCode( - this._tableSize, - paramNames, - this._approxBits, - this._target.numInputs, - this._target.numOutputs, - this._target.inputTypes, - this._target.outputTypes, - wrapperName - ) as string; - $call.insert("before", logicCode); - - if (this._isOnline) { - const updateCode = ClavaJavaTypes.MemoiCodeGen.generateUpdateCode( - this._tableSize, - paramNames, - this._isUpdateAlways, - this._target.numInputs, - this._target.numOutputs, - updatesName, - this._isZeroSim, - wrapperName - ) as string; - $call.insert("after", updateCode); - } - - $file.addInclude("stdint.h", true); - } - } - - private addMainDebug( - totalName: string, - missesName: string, - updatesName: string | undefined, - wrapperName: string - ) { - const chain = Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain(); - const firstAndOnly = chain[0]; - - if (firstAndOnly === undefined) { - console.log( - "Could not find a main function. It may be impossible to print debug stats if this is a library code." - ); - return; - } - - const $file = firstAndOnly["file"] as FileJp; - const $function = firstAndOnly["function"] as FunctionJp; - - $file.addGlobal( - totalName, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - $file.addGlobal( - missesName, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - if (this._isOnline) { - $file.addGlobal( - updatesName!, - ClavaJoinPoints.builtinType("unsigned int"), - "0" - ); - } - - $file.addInclude("stdio.h", true); - $file.addInclude("sys/stat.h", true); - $file.addInclude("sys/types.h", true); - $file.addInclude("errno.h", true); - - let updatesStringCode = ""; - let updatesValuesCode = ""; - - if (this._isOnline) { - updatesStringCode = ', \\"updates\\": %u'; - updatesValuesCode = ", " + updatesName!; - } - - const json = ` - { - errno = 0; - int dir_result = mkdir("memoi-exec-report", 0755); - if(dir_result != 0 && errno != EEXIST){ - perror("Could not create directory for memoi execution reports"); - } - else{ - errno = 0; - FILE * _memoi_rep_file = fopen ("memoi-exec-report/${wrapperName}.json","w"); - if(_memoi_rep_file == NULL) { - perror("Could not create file for memoi execution report"); - } else { - fprintf(_memoi_rep_file, "{"name": "${wrapperName}", "total": %u, "hits": %u, "misses": %u${updatesStringCode}}\n", ${totalName}, ${totalName} - ${missesName}, ${missesName}${updatesValuesCode}); - fclose(_memoi_rep_file); - } - } - } - `; - - $function.insertReturn(json); - } - - private checkParams(source: string) { - if (!((this._isEmpty && this._isOnline) || !this._isEmpty)) { - throw new Error( - `MemoiGen.${source}: Can't have empty and offline table.` - ); - } - - if (!(this._isEmpty ? !this._isProf : this._isProf)) { - throw new Error( - "MemoiGen.${source}: Empty table and profile are mutually exclusive table." - ); - } - } -} - -namespace MemoiGen { - export enum ApplyPolicy { - ALWAYS = "ALWAYS", - NOT_EMPTY = "NOT_EMPTY", - OVER_25_PCT = "OVER_25_PCT", - OVER_50_PCT = "OVER_50_PCT", - OVER_75_PCT = "OVER_75_PCT", - OVER_90_PCT = "OVER_90_PCT", - } -} - -export default MemoiGen; diff --git a/Clava-JS/src-api/clava/memoi/MemoiProf.ts b/Clava-JS/src-api/clava/memoi/MemoiProf.ts deleted file mode 100644 index 0388da5cb6..0000000000 --- a/Clava-JS/src-api/clava/memoi/MemoiProf.ts +++ /dev/null @@ -1,353 +0,0 @@ -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp, Scope, Type } from "../../Joinpoints.js"; -import Clava from "../Clava.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiTarget from "./MemoiTarget.js"; -import MemoiUtils from "./MemoiUtils.js"; - -/** - * Library to instrument applications with the memoiprof profiling library. - * - * @param targetSig - The signature of the target funtion - * @param id - Unique ID representing this function - * @param reportDir - Path to the directory where the report will be saved (does not need trailing /) - */ -export default class MemoiProf { - private target: MemoiTarget; - private id: string; - private reportDir: string; - - /** - * Options for memoiprof. - */ - private memoiprofOptions: MemoiprofOptions = new MemoiprofOptions(); - - constructor(target: MemoiTarget, id: string, reportDir: string) { - this.target = target; - this.id = id.replace(" ", "_"); - this.reportDir = reportDir; - - // Deal with dependecy to memoiprof - PrintOnce.message( - "Woven code has dependency to project memoiprof, which can be found at https://github.com/cc187/memoiprof" - ); - Clava.getProgram().addProjectFromGit( - "https://github.com/cc187/memoiprof.git", - ["mp"] - ); - } - - setSampling(samplingKind: SamplingKind, samplingRate: number) { - this.memoiprofOptions.setSampling(samplingKind, samplingRate); - } - - setPeriodicReporting( - periodicReportKind: boolean, - periodicReportRate: number - ) { - this.memoiprofOptions.setPeriodicReporting( - periodicReportKind, - periodicReportRate - ); - } - - setCulling(cullingKind: boolean, cullingRatio: number) { - this.memoiprofOptions.setCulling(cullingKind, cullingRatio); - } - - setApprox(approxKind: boolean, approxBits: number) { - this.memoiprofOptions.setApprox(approxKind, approxBits); - } - - /** - * Profiles all calls of the target function. This includes making a single - * wrapper for all calls and adding the memoization profiling code inside this - * wrapper. - * */ - profAll() { - const cSig = MemoiUtils.cSig(this.target.sig); - const wrapperName = "mw_" + cSig; - const monitorName = "mp_" + cSig; - const monitorType = ClavaJoinPoints.typeLiteral("MemoiProf*"); - - // make the wrapper - for (const $call of Query.search(Call, { - signature: (s: string) => this.target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - - // instrument the wrapper - this.memoiInstrumentWrapper(wrapperName, monitorName, monitorType); - - // setup - this.memoiSetup(monitorName, monitorType, this.id, ["global"]); - } - - /** - * Profiles each call to the target function separately. This includes - * making a wrapper for each call and adding the memoization profiling code - * inside the wrapper. - * */ - profEach() { - const cSig = MemoiUtils.cSig(this.target.sig); - const wrapperNameBase = "mw_" + cSig; - const monitorNameBase = "mp_" + cSig; - const monitorType = ClavaJoinPoints.typeLiteral("MemoiProf*"); - - for (const $call of Query.search(Call, { - signature: (s: string) => this.target.sig === MemoiUtils.normalizeSig(s), - })) { - // make the wrapper - const wrapperName = IdGenerator.next(wrapperNameBase); - $call.wrap(wrapperName); - - // instrument the wrapper - const monitorName = IdGenerator.next(monitorNameBase); - this.memoiInstrumentWrapper(wrapperName, monitorName, monitorType); - - const callSiteInfo = $call.location; - - // setup - const id = IdGenerator.next(this.id + "_"); - this.memoiSetup(monitorName, monitorType, id, [callSiteInfo]); - } - } - - private memoiInstrumentWrapper( - wrapperName: string, - monitorName: string, - monitorType: Type - ) { - const numInputs = this.target.numInputs; - const numOutputs = this.target.numOutputs; - - const query = Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain(); - - for (const row of query) { - let code = "mp_inc(" + monitorName; - - const $params = (row["function"] as FunctionJp).params; - - for (let i = 0; i < numInputs; i++) { - code += ", &" + $params[i].name; - } - - if (numOutputs == 1) { - code += ", &result"; - } else { - for (let o = numInputs; o < $params.length; o++) { - code += ", " + $params[o].name; - } - } - - code += ");"; - - const $call = row["call"] as Call; - $call.insert("after", code); - $call.insert("after", "#pragma omp critical"); // needed for correct semantics under OpenMP - - const $file = row["file"] as FileJp; - $file.addGlobal(monitorName, monitorType, "NULL"); - $file.addInclude("MemoiProfiler.h", false); - $file.addInclude("stdlib.h", true); - } - } - - private memoiSetup( - monitorName: string, - monitorType: Type, - id: string, - callSiteInfo: string[] - ) { - const inputsCode = this.target.inputTypes - .map(function (e) { - return "mp_" + e; - }) - .join(",") - .toUpperCase(); - const outputsCode = this.target.outputTypes - .map(function (e) { - return "mp_" + e; - }) - .join(",") - .toUpperCase(); - - const query = Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .children(Scope) - .chain()[0]; - - if (query !== undefined) { - throw new Error( - "MemoiProf: Could not find main function needed for setup" - ); - } - - const memoiReportPath = "path_" + monitorName; - - const $body = query["scope"] as Scope; - - // memoiprof options - if (this.memoiprofOptions.samplingKind !== SamplingKind.OFF) { - const samplingKind = - "MP_SAMPLING_" + this.memoiprofOptions.samplingKind.toUpperCase(); - $body.insertBegin( - `mp_set_sampling(${monitorName}, ${samplingKind}, ${this.memoiprofOptions.samplingRate});` - ); - } - - if (this.memoiprofOptions.periodicReportKind) { - $body.insertBegin( - `mp_set_periodic_reporting(${monitorName}, MP_PERIODIC_ON, ${this.memoiprofOptions.periodicReportRate});` - ); - } - - if (this.memoiprofOptions.cullingKind) { - $body.insertBegin( - `mp_set_culling(${monitorName}, MP_CULLING_ON, ${this.memoiprofOptions.cullingRatio});` - ); - } - - if (this.memoiprofOptions.approxKind) { - $body.insertBegin( - `mp_set_approx(${monitorName}, MP_APPROX_ON, ${this.memoiprofOptions.approxBits});` - ); - } - - this.memoiAddCallSiteInfo($body, callSiteInfo, monitorName); - $body.insertBegin(`free(${memoiReportPath});`); // can free here, since mp_init duped it - $body.insertBegin( - `${monitorName} = mp_init("${this.target.sig}", "${id}", ${memoiReportPath}, ${this.target.inputTypes.length}, ${this.target.outputTypes.length}, ${inputsCode}, ${outputsCode});` - ); - $body.insertBegin( - `char* ${memoiReportPath} = mp_make_report_path("${this.reportDir}", "${monitorName}");` - ); - - /* add functions to print and clean up at every return on main */ - const $function = query["function"] as FunctionJp; - $function.insertReturn(`mp_to_json(${monitorName});`); - $function.insertReturn(`${monitorName} = mp_destroy(${monitorName});`); - - const $file = query["file"] as FileJp; - $file.addGlobal(monitorName, monitorType, "NULL"); - $file.addInclude("MemoiProfiler.h", false); - $file.addInclude("stdlib.h", true); - } - - private memoiAddCallSiteInfo( - $mainBody: Scope, - callSiteInfo: string[] = ["global"], - monitorName: string - ) { - const length = callSiteInfo.length; - - $mainBody.insertBegin( - "mp_set_call_sites(" + - monitorName + - ", " + - length + - ", " + - callSiteInfo.map((i) => `"${i}"`).join(", ") + - ");" - ); - } -} - -export enum SamplingKind { - RANDOM = "random", - FIXED = "fixed", - OFF = "off", -} - -/** - * Class used to store memoiprof options. - * */ -export class MemoiprofOptions { - private _samplingKind: SamplingKind = SamplingKind.OFF; - private _samplingRate: number = 0; - - private _periodicReportKind: boolean = false; - private _periodicReportRate: number = 0; - - private _cullingKind: boolean = false; - private _cullingRatio: number = 0.0; - - private _approxKind: boolean = false; - private _approxBits: number = 0; - - get samplingKind() { - return this._samplingKind; - } - - get samplingRate() { - return this._samplingRate; - } - - get periodicReportKind() { - return this._periodicReportKind; - } - - get periodicReportRate() { - return this._periodicReportRate; - } - - get cullingKind() { - return this._cullingKind; - } - - get cullingRatio() { - return this._cullingRatio; - } - - get approxKind() { - return this._approxKind; - } - - get approxBits() { - return this._approxBits; - } - - /** - * Supported samplingKind values are: 'random', 'fixed', 'off'. - * For 1/x sampling, samplingRate should be x. - * */ - setSampling(samplingKind: SamplingKind, samplingRate: number) { - this._samplingKind = samplingKind; - this._samplingRate = samplingRate; - } - - /** - * Supported periodicReportKind values are: true, false. - * periodicReportRate is the number of calls between writes of periodic reports. - * */ - setPeriodicReporting( - periodicReportKind: boolean, - periodicReportRate: number - ) { - this._periodicReportKind = periodicReportKind; - this._periodicReportRate = periodicReportRate; - } - - /** - * Supported cullingKind values are: true, false. - * cullingRatio is the threshold (% of calls) for printing to the JSON. - * */ - setCulling(cullingKind: boolean, cullingRatio: number) { - this._cullingKind = cullingKind; - this._cullingRatio = cullingRatio; - } - - /** - * Supported approxKind values are: true, false. - * */ - setApprox(approxKind: boolean, approxBits: number) { - this._approxKind = approxKind; - this._approxBits = approxBits; - } -} diff --git a/Clava-JS/src-api/clava/memoi/MemoiTarget.ts b/Clava-JS/src-api/clava/memoi/MemoiTarget.ts deleted file mode 100644 index c6aec50190..0000000000 --- a/Clava-JS/src-api/clava/memoi/MemoiTarget.ts +++ /dev/null @@ -1,155 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FunctionJp } from "../../Joinpoints.js"; -import MemoiUtils from "./MemoiUtils.js"; - -export default class MemoiTarget { - sig: string; - private $func: FunctionJp; - private isUser: boolean; - numInputs: number; - numOutputs: number; - inputTypes: string[]; - outputTypes: string[]; - private numCallSites: number; - - constructor( - sig: string, - $func: FunctionJp, - isUser: boolean, - numInputs: number = $func.params.length, - numOuputs: number = 1, - inputTypes?: string[], - outputTypes?: string[], - numCallSites?: number - ) { - this.sig = MemoiUtils.normalizeSig(sig); - this.$func = $func; - this.isUser = isUser; - this.numInputs = numInputs; - this.numOutputs = numOuputs; - - if (inputTypes === undefined || outputTypes === undefined) { - [this.inputTypes, this.outputTypes] = this.findDataTypes(); - } else { - this.inputTypes = inputTypes; - this.outputTypes = outputTypes; - } - - this.numCallSites = numCallSites ?? this.findNumCallSites(); - - this.checkDataTypes(); - } - - static fromFunction($func: FunctionJp) { - const sig = MemoiUtils.normalizeSig($func.signature); - const isUser = !MemoiUtils.isWhiteListed(sig); - const numInputs = $func.params.length; - const numOutputs = 1; - - // input types, output types, and num of call sites are found in the constructor - return new MemoiTarget( - sig, - $func, - isUser, - numInputs, - numOutputs, - undefined, - undefined - ); - } - - static fromCall($call: Call) { - const $func = $call.function; - if ($func === undefined) { - throw `Could not find function of call '${$call.code}'`; - } - - return MemoiTarget.fromFunction($func); - } - - static fromSig(sig: string) { - sig = MemoiUtils.normalizeSig(sig); - - const $func = Query.search(FunctionJp, { - signature: (signature: string) => - sig === MemoiUtils.normalizeSig(signature), - }).first(); - - if ($func === undefined) { - const $call = Query.search(Call, { - signature: (signature: string) => - sig === MemoiUtils.normalizeSig(signature), - }).first(); - - if ($call === undefined) { - throw `Could not find function of sig '${sig}'`; - } - - return MemoiTarget.fromCall($call); - } - - return MemoiTarget.fromFunction($func); - } - - private findNumCallSites(): number { - return Query.search(Call, { - signature: (signature: string) => - this.sig === MemoiUtils.normalizeSig(signature), - }).get().length; - } - - private findDataTypes() { - const inputTypes: string[] = []; - const outputTypes: string[] = []; - - const $functionType = this.$func.functionType; - - if (this.numOutputs == 1) { - outputTypes.push($functionType.returnType.code); - $functionType.paramTypes.forEach(function (e) { - inputTypes.push(e.code); - }); - } else { - const typeCodes = $functionType.paramTypes.map(function (e) { - return e.code; - }); - - typeCodes.forEach((e, i) => { - if (i < this.numInputs) { - inputTypes.push(e); - } else { - outputTypes.push(e); - } - }); - } - - return [inputTypes, outputTypes]; - } - - private checkDataTypes() { - const normalTypes = ["double", "float", "int"]; - const pointerTypes = ["double *", "float *", "int *"]; - - const inputsInvalid = this.inputTypes.some(function (e) { - return !normalTypes.includes(e); - }); - - if (inputsInvalid) { - throw `The inputs of the target function '${this.sig}' are not supported.`; - } - - const outputTestArray = this.numOutputs == 1 ? normalTypes : pointerTypes; - const outputsInvalid = this.outputTypes.some(function (e) { - return !outputTestArray.includes(e); - }); - - if (outputsInvalid) { - throw `The outputs of the target function '${this.sig}' are not supported.`; - } - - // if the output are valid, drop the pointer from the type - this.outputTypes = this.outputTypes.map(function (e) { - return e.replace(/\*/, "").trim(); - }); - } -} diff --git a/Clava-JS/src-api/clava/memoi/MemoiUtils.ts b/Clava-JS/src-api/clava/memoi/MemoiUtils.ts deleted file mode 100644 index 3ffae3973a..0000000000 --- a/Clava-JS/src-api/clava/memoi/MemoiUtils.ts +++ /dev/null @@ -1,149 +0,0 @@ -/** - * The C data types the memoization instrumentation library can handle. - */ -export enum MemoiDataType { - INT = "INT", - DOUBLE = "DOUBLE", - FLOAT = "FLOAT", -} - -export default class MemoiUtils { - private static mathFunctionSigs: Set = new Set([ - /* double, 1 parameter */ - "acos(double)", - "acosh(double)", - "asin(double)", - "asinh(double)", - "atan(double)", - "atanh(double)", - "cbrt(double)", - "ceil(double)", - "cos(double)", - "cosh(double)", - "erf(double)", - "erfc(double)", - "exp(double)", - "exp2(double)", - "expm1(double)", - "fabs(double)", - "floor(double)", - "j0(double)", - "j1(double)", - "lgamma(double)", - "log(double)", - "log10(double)", - "log1p(double)", - "log2(double)", - "logb(double)", - "nearbyint(double)", - "rint(double)", - "round(double)", - "sin(double)", - "sinh(double)", - "sqrt(double)", - "tan(double)", - "tanh(double)", - "tgamma(double)", - "trunc(double)", - /* float, 1 parameter */ - "acosf(float)", - "acoshf(float)", - "asinf(float)", - "asinhf(float)", - "atanf(float)", - "atanhf(float)", - "cbrtf(float)", - "ceilf(float)", - "cosf(float)", - "coshf(float)", - "erfcf(float)", - "erff(float)", - "exp2f(float)", - "expf(float)", - "expm1f(float)", - "fabsf(float)", - "floorf(float)", - "lgammaf(float)", - "log10f(float)", - "log1pf(float)", - "log2f(float)", - "logbf(float)", - "logf(float)", - "nearbyintf(float)", - "rintf(float)", - "roundf(float)", - "sinf(float)", - "sinhf(float)", - "sqrtf(float)", - "tanf(float)", - "tanhf(float)", - "tgammaf(float)", - "truncf(float)", - /* double,2 parameters */ - "atan2(double,double)", - "copysign(double,double)", - "fdim(double,double)", - "fmax(double,double)", - "fmin(double,double)", - "fmod(double,double)", - "hypot(double,double)", - "nextafter(double,double)", - "pow(double,double)", - "remainder(double,double)", - "scalb(double,double)", - /* float, 2 parameters */ - "atan2f(float,float)", - "copysignf(float,float)", - "fdimf(float,float)", - "fmaxf(float,float)", - "fminf(float,float)", - "fmodf(float,float)", - "hypotf(float,float)", - "nextafterf(float,float)", - "powf(float,float)", - "remainderf(float,float)", - ]); - - /** - * Tests whether the function with the given signature is whitelisted. - * */ - static isWhiteListed(sig: string) { - if (MemoiUtils.isMathFunction(sig)) { - return true; - } - - return false; - } - - /** - * Tests whether the function with the given signature is a math.h function. - * */ - static isMathFunction(sig: string) { - return MemoiUtils.mathFunctionSigs.has(sig); - } - - static cSig(sig: string) { - return sig - .replace(/\(/g, "_") - .replace(/\*/g, "_p") - .replace(/ /g, "_") - .replace(/,/g, "_") - .replace(/\)/g, "_"); - } - - static normalizeSig(sig: string) { - return sig.replace(/ /g, ""); - } - - /** - * @deprecated Use javascript's array.includes method instead - * - */ - static arrayContains(a: T[], e: T) { - return a.includes(e); - } - - static average(values: number[], count: number = values.length) { - return values.reduce((a, b) => a + b, 0) / count; - } -} diff --git a/Clava-JS/src-api/clava/memoi/_MemoiGenHelper.ts b/Clava-JS/src-api/clava/memoi/_MemoiGenHelper.ts deleted file mode 100644 index bb6452cad5..0000000000 --- a/Clava-JS/src-api/clava/memoi/_MemoiGenHelper.ts +++ /dev/null @@ -1,507 +0,0 @@ -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp, Statement } from "../../Joinpoints.js"; -import ClavaJavaTypes, { ClavaJavaClasses } from "../ClavaJavaTypes.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiUtils from "./MemoiUtils.js"; - -/** - * BE VERY CAREFULL WHEN USING FUNCTIONS FROM THIS FILE. - * WHEN REFACTORING THIS FILE I NOTICED THAT SOME JAVA FUNCTIONS BEING CALLED - * DO NOT APPEAR TO EXIST OR ARE INCORRECTLY CALLED. - * ALSO, THERE ARE NO TESTS COVERING THIS CODE. - */ - -/** - * Generates the table and supporting code for this report. - * - * Inserts elements in the table based on the predicate insertPred. - * */ -export function _generate( - insertPred: any, - countComparator: any, - report: ClavaJavaClasses.MemoiReport, - isMemoiDebug: boolean, - isMemoiOnline: boolean, - isMemoiEmpty: boolean, - isMemoiUpdateAlways: boolean, - memoiApproxBits: number, - tableSize: number, - signature: string, - callSite: string -) { - let wt; - - if (callSite === "global") { - wt = _Memoi_WrapGlobalTarget(signature); - } else { - wt = _Memoi_WrapSingleTarget(signature, callSite); - } - _Memoi_InsertTableCode( - insertPred, - countComparator, - report, - wt.wrapperName, - isMemoiDebug, - isMemoiOnline, - isMemoiEmpty, - isMemoiUpdateAlways, - memoiApproxBits, - tableSize - ); -} - -export function _Memoi_WrapGlobalTarget(signature: string) { - const wrapperName = `mw_${MemoiUtils.normalizeSig(signature)}`; - - for (const chain of Query.search(Statement) - .search(Call, { - signature: (sig: string) => sig.replace(/ /g, "") == signature, - }) - .chain()) { - const $call = chain["call"] as Call; - $call.wrap(wrapperName); - debug("wrapped"); - } - - return { wrapperName }; -} - -export function _Memoi_WrapSingleTarget(signature: string, location: string) { - for (const chain of Query.search(Statement) - .search(Call, { - signature: (sig: string) => sig.replace(/ /g, "") == signature, - }) - .chain()) { - const $call = chain["call"] as Call; - - const wrapperName = IdGenerator.next( - `mw_${MemoiUtils.normalizeSig(signature)}` - ); - $call.wrap(wrapperName); - debug("wrapped"); - return { wrapperName }; - } - - throw `Did not find call to ${signature} at ${location}`; -} - -export function _Memoi_InsertTableCode( - insertPred: any, - countComparator: any, - report: ClavaJavaClasses.MemoiReport, - wrapperName: string, - isMemoiDebug: boolean, - isMemoiOnline: boolean, - isMemoiEmpty: boolean, - isMemoiUpdateAlways: boolean, - memoiApproxBits: number, - tableSize: number -) { - Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain() - .forEach((chain) => { - const $file = chain["file"] as FileJp; - const $function = chain["function"] as FunctionJp; - const $call = chain["call"] as Call; - - if (isMemoiDebug) { - const totalName = wrapperName + "_total_calls"; - const missesName = wrapperName + "_total_misses"; - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("int"), "0"); - $call.insertBefore(`${totalName}++;`); - $call.insertAfter(`${missesName}++;`); - - _Memoi_AddMainDebug(totalName, missesName, wrapperName); - } - - const tableCode = _makeTableCode( - insertPred, - countComparator, - report, - $function, - tableSize, - isMemoiEmpty, - isMemoiOnline, - memoiApproxBits - ); - $call.insertBefore(tableCode); - - if (isMemoiOnline) { - const updateCode = _makeUpdateCode( - report, - $function, - tableSize, - isMemoiUpdateAlways - ); - $call.insertAfter(updateCode); - } - - $file.addInclude("stdint.h", true); - }); -} - -export function _Memoi_AddMainDebug( - totalName: string, - missesName: string, - wrapperName: string -) { - Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain() - .forEach((chain) => { - const $file = chain["file"] as FileJp; - const $function = chain["function"] as FunctionJp; - - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addInclude("stdio.h", true); - - $function.insertReturn(` - printf("${wrapperName}\t%d / %d (%.2f%%)\n", - ${totalName} - ${missesName}, - ${totalName}, - (${totalName} - ${missesName}) * 100.0 / ${totalName}); - `); - }); -} - -export function _baseLog(num: number, base: number) { - return Math.log(num) / Math.log(base); -} - -export function _makeTableCode( - insertPred: any, - countComparator: any, - report: ClavaJavaClasses.MemoiReport, - $function: FunctionJp, - tableSize: number, - isMemoiEmpty: boolean, - isMemoiOnline: boolean, - memoiApproxBits: number -) { - const indexBits = _baseLog(tableSize, 2); - - debug("table size: " + tableSize); - debug("index bits: " + indexBits); - - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - - const code = ClavaJavaTypes.MemoiCodeGen.generateDmtCode( - report, - tableSize, - paramNames, - isMemoiEmpty, - isMemoiOnline, - memoiApproxBits - ) as string; - - return code; -} - -export function _makeUpdateCode( - report: ClavaJavaClasses.MemoiReport, - $function: FunctionJp, - tableSize: number, - isMemoiUpdateAlways: boolean -) { - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - - const code = ClavaJavaTypes.MemoiCodeGen.generateUpdateCode( - report, - tableSize, - paramNames, - isMemoiUpdateAlways - ) as string; - - return code; -} - -export const sizeMap: Record = { - float: 32, - int: 32, - double: 64, -}; - -export function _printTable(table: Record[], tableSize: number) { - for (let i = 0; i < tableSize; i++) { - if (table[i] !== undefined) { - let code = ""; - - const fullKey = table[i].fullKey as string; - const keys = fullKey.split("#"); - for (let k = 0; k < keys.length; k++) { - code += "0x" + keys[k] + ", "; - } - code += "0x" + table[i].output; - - console.log(code); - } - } -} - -export function _printTableReport( - collisions: number, - totalElements: number, - maxCollision: number, - report: ClavaJavaClasses.MemoiReport, - tableSize: number, - table: Record[] -) { - let tableCalls = 0; - let tableElements = 0; - for (let i = 0; i < tableSize; i++) { - if (table[i] != undefined) { - tableCalls += mean(table[i].counter, report.reportCount); - tableElements++; - } - } - const totalCalls = mean(report.calls, report.reportCount); - const collisionPercentage = (collisions / totalElements) * 100; - const elementsCoverage = (tableElements / totalElements) * 100; - const callCoverage = (tableCalls / totalCalls) * 100; - - console.log( - "collisions: " + collisions + " (" + collisionPercentage.toFixed(2) + "%)" - ); - console.log("largest collision: " + maxCollision); - console.log( - "element coverage: " + - tableElements + - "/" + - totalElements + - " (" + - elementsCoverage.toFixed(2) + - ")%" - ); - console.log( - "call coverage: " + - tableCalls + - "/" + - totalCalls + - " (" + - callCoverage.toFixed(2) + - ")%" - ); -} - -export function _hashFunctionHalf(bits64: string): string { - const len = bits64.length; - let hashString = ""; - - for (let i = 0; i < len / 2; i++) { - const number = - parseInt(bits64.charAt(i), 16) ^ parseInt(bits64.charAt(i + len / 2), 16); - hashString += number.toString(16); - } - - return hashString; -} - -export function _hashFunctionOld(bits64: string, indexBits: number): string { - switch (indexBits) { - case 8: { - const bits32 = _hashFunctionHalf(bits64); - const bits16 = _hashFunctionHalf(bits32); - const bits8 = _hashFunctionHalf(bits16); - return String(parseInt(bits8, 16)); - } - case 16: { - const bits32 = _hashFunctionHalf(bits64); - const bits16 = _hashFunctionHalf(bits32); - return String(parseInt(bits16, 16)); - } - default: - return bits64; - break; - } -} - -export function _hashFunction(bits64: string, indexBits: number): string { - const varBits = 64; - let lastPower = varBits; - const iters = _baseLog(varBits / indexBits, 2); - const intIters = parseInt(String(iters), 10); - - let hash = bits64; - for (let i = 0; i < intIters; i++) { - hash = _hashFunctionHalf(hash); - lastPower = lastPower / 2; - } - - // if not integer, we need to mask bits at the end - if (iters !== intIters) { - // mask starts with 16 bits - let mask = parseInt("0xffff", 16); - const shift = 16 - indexBits; - mask = mask >> shift; - - hash = String(parseInt(hash, 16) & mask); - - return hash; - } - - hash = String(parseInt(hash, 16)); - return hash; -} - -/** - * Converts counts from a map to an array. - * */ -export function _convertCounts(newReport: ClavaJavaClasses.MemoiReport) { - const a = []; - - for (const countP in newReport.counts) { - const count = newReport.counts[countP]; - a.push(count); - } - - newReport.counts = a; -} - -// function -export function totalTopN( - report: ClavaJavaClasses.MemoiReport, - n: number, - reportCount: number -) { - let result = 0; - - const averageCounts = []; - - for (const count of report.counts) { - averageCounts.push(mean(count.counter, reportCount)); - } - - sortDescending(averageCounts); - - for (let i = 0; i < Math.min(n, averageCounts.length); i++) { - result += averageCounts[i]; - } - - return result; -} - -// function -export function elementsForRatio( - report: ClavaJavaClasses.MemoiReport, - total: number, - ratio: number, - reportCount: number -): number { - let sum = 0; - - const averageCounts = []; - - for (const count of report.counts) { - averageCounts.push(mean(count.counter, reportCount)); - } - - sortDescending(averageCounts); - - for (let elements = 0; elements < averageCounts.length; elements++) { - sum += averageCounts[elements]; - if (sum / total > ratio) { - return elements + 1; - } - } - - return report.elements; // ? -} - -// function -export function getQuartVal(counts: number[], idx: number) { - const floor = Math.floor(idx); - - let val; - if (idx == floor) { - val = (counts[idx] + counts[idx - 1]) / 2; - } else { - val = counts[floor]; - } - - return val; -} - -// function -export function bwp(report: ClavaJavaClasses.MemoiReport, reportCount: number) { - const averageCounts = []; - - for (const count of report.counts) { - averageCounts.push(average(count.counter, reportCount)); - } - - sortDescending(averageCounts); - - const length = averageCounts.length; - - const min = averageCounts[length - 1]; - const q1 = getQuartVal(averageCounts, (1 / 4) * length); - const q2 = getQuartVal(averageCounts, (2 / 4) * length); - const q3 = getQuartVal(averageCounts, (3 / 4) * length); - const max = averageCounts[0]; - const iqr = q3 - q1; - - return { - min, - q1, - q2, - q3, - max, - iqr, - }; -} - -// function -export function printBwp( - report: ClavaJavaClasses.MemoiReport, - reportCount: number -) { - const b = bwp(report, reportCount); - console.log( - `{ ${b.min}, ${b.q1}, ${b.q2}, ${b.q3}, ${b.max} } iqr: ${b.iqr}` - ); -} - -/** - * @deprecated This function does not calculate a mean, but an average. - */ -export function mean(values: number[], count: number) { - return average(values, count); -} - -export function average(values: number[], count: number) { - let sum = 0; - - for (const value of values) { - sum += value; - } - - if (count === undefined) { - return sum / values.length; - } else { - return sum / count; - } -} - -export function sortDescending(array: T[]) { - return array.sort(function (a, b) { - if (a < b) return 1; - else if (a > b) return -1; - else return 0; - }); -} - -export function sortAscending(array: T[]) { - return sortDescending(array).reverse(); -} diff --git a/Clava-JS/src-api/clava/util/ClavaDataStore.ts b/Clava-JS/src-api/clava/util/ClavaDataStore.ts index 5e1a6e87a4..20e0d5b648 100644 --- a/Clava-JS/src-api/clava/util/ClavaDataStore.ts +++ b/Clava-JS/src-api/clava/util/ClavaDataStore.ts @@ -47,14 +47,14 @@ export default class ClavaDataStore extends WeaverDataStore { * @returns A list with the current extra system includes. */ getSystemIncludes(): string[] { - return this.get("library includes").getFiles(); + return this.get("library includes").getFiles().toArray(); } /** * @returns A list with the current user includes. */ getUserIncludes(): string[] { - return this.get("header includes").getFiles(); + return this.get("header includes").getFiles().toArray(); } /** @@ -65,7 +65,11 @@ export default class ClavaDataStore extends WeaverDataStore { const filenames = arrayFromArgs(args); const files = filenames.map((filename: string) => Io.getPath(filename)); - this.put("library includes", JavaTypes.FileList.newInstance(files)); + if (files.length === 0) { + this.put("library includes", JavaTypes.FileList.newInstance()); + } else { + this.put("library includes", JavaTypes.FileList.newInstance(...files)); + } } /** @@ -75,8 +79,12 @@ export default class ClavaDataStore extends WeaverDataStore { setUserIncludes(...args: string[]) { const filenames = arrayFromArgs(args); const files = filenames.map((filename: string) => Io.getPath(filename)); + if(files.length === 0) { + this.put("header includes", JavaTypes.FileList.newInstance()); + } else { + this.put("header includes", JavaTypes.FileList.newInstance(...files)); + } - this.put("header includes", JavaTypes.FileList.newInstance(files)); } /** diff --git a/Clava-JS/src-api/clava/vitishls/VitisHls.ts b/Clava-JS/src-api/clava/vitishls/VitisHls.ts deleted file mode 100644 index 3db78031db..0000000000 --- a/Clava-JS/src-api/clava/vitishls/VitisHls.ts +++ /dev/null @@ -1,189 +0,0 @@ -import Clava from "../Clava.js"; -import ProcessExecutor from "@specs-feup/lara/api/lara/util/ProcessExecutor.js"; -import VitisHlsReportParser from "./VitisHlsReportParser.js"; -import Tool from "@specs-feup/lara/api/lara/tool/Tool.js"; -import ToolUtils from "@specs-feup/lara/api/lara/tool/ToolUtils.js"; -import Io from "@specs-feup/lara/api/lara/Io.js"; - -export default class VitisHls extends Tool { - topFunction: string; - platform: string; - clock!: number; - vitisDir: string = "VitisHLS"; - vitisProjName: string = "VitisHLSClavaProject"; - sourceFiles: string[] = []; - flowTarget: "vitis" | "vivado" = "vivado"; - - constructor( - topFunction: string, - clock: number = 10, - platform: string = "xcvu5p-flva2104-1-e", - disableWeaving: boolean = false - ) { - super("VITIS-HLS", disableWeaving); - - this.topFunction = topFunction; - this.platform = platform; - this.setClock(clock); - } - - setTopFunction(topFunction: string) { - this.topFunction = topFunction; - return this; - } - - setPlatform(platform: string) { - this.platform = platform; - return this; - } - - setClock(clock: number) { - if (clock <= 0) { - throw new Error( - `${this.getTimestamp()} Clock value must be a positive integer!` - ); - } else { - this.clock = clock; - } - return this; - } - - setFlowTarget(target: "vitis" | "vivado") { - this.flowTarget = target; - return this; - } - - addSource(file: string) { - this.sourceFiles.push(file); - return this; - } - - private getTimestamp() { - const curr = new Date(); - const res = `[${ - this.toolName - } ${curr.getHours()}:${curr.getMinutes()}:${curr.getSeconds()}]`; - return res; - } - - synthesize(verbose: boolean = true) { - console.log(`${this.getTimestamp()} Setting up Vitis HLS executor`); - - this.clean(); - this.generateTclFile(); - this.executeVitis(verbose); - return Io.isFile(this.getSynthesisReportPath()); - } - - clean() { - Io.deleteFolderContents(this.vitisDir); - } - - private getSynthesisReportPath() { - return ( - this.vitisDir + - "/" + - this.vitisProjName + - "/solution1/syn/report/csynth.xml" - ); - } - - private executeVitis(verbose: boolean) { - console.log(`${this.getTimestamp()} Executing Vitis HLS`); - - const pe = new ProcessExecutor(); - pe.setWorkingDir(this.vitisDir); - pe.setPrintToConsole(verbose); - pe.execute("vitis_hls", "-f", "script.tcl"); - - console.log(`${this.getTimestamp()} Finished executing Vitis HLS`); - } - - private getTclInputFiles() { - let str = ""; - const weavingFolder = ToolUtils.parsePath(Clava.getWeavingFolder()); - - // make sure the files are woven - Io.deleteFolderContents(weavingFolder); - Clava.writeCode(weavingFolder); - - // if no files were added, we assume that every woven file should be used - if (this.sourceFiles.length == 0) { - console.log( - `${this.getTimestamp()} No source files specified, assuming current AST is the input` - ); - for (const file of Io.getFiles(Clava.getWeavingFolder())) { - const exts = [".c", ".cpp", ".h", ".hpp"]; - const res = exts.some((ext) => file.name.includes(ext)); - if (res) str += "add_files " + weavingFolder + "/" + file.name + "\n"; - } - } else { - for (const file of this.sourceFiles) { - str += "add_files " + weavingFolder + "/" + file + "\n"; - } - } - return str; - } - - private generateTclFile() { - const cmd = ` -open_project ${this.vitisProjName} -set_top ${this.topFunction} -${this.getTclInputFiles()} -open_solution "solution1" -flow_target ${this.flowTarget} -set_part { ${this.platform}} -create_clock -period ${this.clock} -name default -csynth_design -exit - `; - - Io.writeFile(this.vitisDir + "/script.tcl", cmd); - } - - getSynthesisReport() { - console.log(`${this.getTimestamp()} Processing synthesis report`); - - const parser = new VitisHlsReportParser(this.getSynthesisReportPath()); - const json = parser.getSanitizedJSON(); - - console.log(`${this.getTimestamp()} Finished processing synthesis report`); - return json; - } - - preciseStr(n: number, decimalPlaces?: number) { - return (+n).toFixed(decimalPlaces); - } - - prettyPrintReport( - report: ReturnType - ) { - const period = this.preciseStr(report["clockEstim"], 2); - const freq = this.preciseStr(report["fmax"], 2); - - const out = ` ----------------------------------------- -Vitis HLS synthesis report - -Targeted a ${report["platform"]} with target clock ${freq} ns - -Achieved an estimated clock of ${period} ns (${freq} MHz) - -Estimated latency for top function ${report["topFun"]}: -Worst case: ${report["latencyWorst"]} cycles - Avg case: ${report["latencyAvg"]} cycles - Best case: ${report["latencyBest"]} cycles - -Estimated execution time: -Worst case: ${report["execTimeWorst"]} s - Avg case: ${report["execTimeAvg"]} s - Best case: ${report["execTimeBest"]} s - -Resource usage: -FF: ${report["FF"]} (${this.preciseStr(report["perFF"] * 100, 2)}%) -LUT: ${report["LUT"]} (${this.preciseStr(report["perLUT"] * 100, 2)}%) -BRAM: ${report["BRAM"]} (${this.preciseStr(report["perBRAM"] * 100, 2)}%) -DSP: ${report["DSP"]} (${this.preciseStr(report["perDSP"] * 100, 2)}%) -----------------------------------------`; - console.log(out); - } -} diff --git a/Clava-JS/src-api/clava/vitishls/VitisHlsReportParser.ts b/Clava-JS/src-api/clava/vitishls/VitisHlsReportParser.ts deleted file mode 100644 index 22cc46bed6..0000000000 --- a/Clava-JS/src-api/clava/vitishls/VitisHlsReportParser.ts +++ /dev/null @@ -1,91 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; - -export default class VitisHlsReportParser { - private reportPath: string; - - constructor(reportPath: string) { - this.reportPath = reportPath; - } - - private xmlToJson(xml: string) { - //parses only the "leaves" of the XML string, which is enough for us. For now. - const regex = - /(?:<([a-zA-Z'-\d_]*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<([a-zA-Z'-]*)(?:\s*)*\/>/gm; - - const json: Record = {}; - for (const match of xml.matchAll(regex)) { - const key = match[1] || match[3]; - const val = match[2] && this.xmlToJson(match[2]); - json[key] = (val && Object.keys(val).length ? val : match[2]) || null; - } - return json; - } - - getSanitizedJSON() { - const raw = this.getRawJSON(); - - const fmax = this.calculateMaxFrequency( - raw["EstimatedClockPeriod"] as number - ); - const execTimeWorst = this.calculateExecutionTime( - raw["Worst-caseLatency"] as number, - fmax - ); - const execTimeAvg = this.calculateExecutionTime( - raw["Average-caseLatency"] as number, - fmax - ); - const execTimeBest = this.calculateExecutionTime( - raw["Best-caseLatency"] as number, - fmax - ); - const hasFixedLatency: boolean = - raw["Best-caseLatency"] === raw["Worst-caseLatency"]; - - return { - platform: raw["Part"] as string, - topFun: raw["TopModelName"] as string, - - clockTarget: raw["TargetClockPeriod"] as number, - clockEstim: raw["EstimatedClockPeriod"] as number, - fmax: fmax, - - latencyWorst: raw["Worst-caseLatency"] as number, - latencyAvg: raw["Average-caseLatency"] as number, - latencyBest: raw["Best-caseLatency"] as number, - hasFixedLatency: hasFixedLatency, - execTimeWorst: execTimeWorst, - execTimeAvg: execTimeAvg, - execTimeBest: execTimeBest, - - FF: raw["FF"] as number, - LUT: raw["LUT"] as number, - BRAM: raw["BRAM_18K"] as number, - DSP: raw["DSP"] as number, - - availFF: raw["AVAIL_FF"] as number, - availLUT: raw["AVAIL_LUT"] as number, - availBRAM: raw["AVAIL_BRAM"] as number, - availDSP: raw["AVAIL_DSP"] as number, - - perFF: (raw["FF"] as number) / (raw["AVAIL_FF"] as number), - perLUT: (raw["LUT"] as number) / (raw["AVAIL_LUT"] as number), - perBRAM: (raw["BRAM_18K"] as number) / (raw["AVAIL_BRAM"] as number), - perDSP: (raw["DSP"] as number) / (raw["AVAIL_DSP"] as number), - }; - } - - private getRawJSON() { - const xml = Io.readFile(this.reportPath); - return this.xmlToJson(xml); - } - - calculateMaxFrequency(clockEstim: number): number { - return (1 / clockEstim) * 1000; - } - - calculateExecutionTime(latency: number, freqMHz: number): number { - const freqHz = freqMHz * 1e6; - return latency / freqHz; - } -} diff --git a/Clava-JS/src-api/clava/vitishls/VitisHlsUtils.ts b/Clava-JS/src-api/clava/vitishls/VitisHlsUtils.ts deleted file mode 100644 index 866519e2a8..0000000000 --- a/Clava-JS/src-api/clava/vitishls/VitisHlsUtils.ts +++ /dev/null @@ -1,30 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { WrapperStmt } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; - -export default class VitisHlsUtils { - static activateAllDirectives(turnOn: boolean) { - const pragmas = Query.search(WrapperStmt, { - code: (code: string) => - code.includes("#pragma HLS") || code.includes("#pragma hls"), - }).get() as WrapperStmt[] | undefined; - - if (pragmas == undefined) { - console.log("No pragmas found"); - return; - } - - for (const pragma of pragmas) { - console.log(pragma.code); - if (turnOn) { - if (pragma.code.startsWith("//")) { - pragma.replaceWith( - ClavaJoinPoints.stmtLiteral(pragma.code.replace("//", "")) - ); - } - } else { - pragma.replaceWith(ClavaJoinPoints.stmtLiteral("//" + pragma.code)); - } - } - } -} diff --git a/Clava-JS/src-api/jest.config.js b/Clava-JS/src-api/jest.config.js index 1a3bc058a0..c5e1ae31c2 100644 --- a/Clava-JS/src-api/jest.config.js +++ b/Clava-JS/src-api/jest.config.js @@ -6,6 +6,7 @@ const config = { globalSetup: "@specs-feup/lara/jest/jestGlobalSetup.js", globalTeardown: "@specs-feup/lara/jest/jestGlobalTeardown.js", setupFiles: ["@specs-feup/lara/jest/setupFiles/sharedJavaModule.js"], + setupFilesAfterEnv: ["@specs-feup/lara/jest/setupFiles/importSideEffects.js"], moduleNameMapper: { "@specs-feup/clava/api/(.+).js": "@specs-feup/clava/src-api/$1", "(.+)\\.js": "$1", diff --git a/Clava-JS/src-api/lara/code/Logger.ts b/Clava-JS/src-api/lara/code/Logger.ts index e7aa0c9378..59a1aaeba5 100644 --- a/Clava-JS/src-api/lara/code/Logger.ts +++ b/Clava-JS/src-api/lara/code/Logger.ts @@ -1,7 +1,6 @@ import LoggerBase from "@specs-feup/lara/api/lara/code/LoggerBase.js"; import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Clava from "../../clava/Clava.js"; import { Expression, FileJp, @@ -11,11 +10,13 @@ import { } from "../../Joinpoints.js"; export default class Logger extends LoggerBase { - private _isCxx: boolean = false; + private _useSpecsLogger: boolean; - constructor(isGlobal = false, filename?: string) { + constructor(isGlobal = false, filename?: string, useSpecsLogger = false) { super(isGlobal, filename); + this._useSpecsLogger = useSpecsLogger; + // Adds C/C++ specific types this.Type.set("LONGLONG", 100); @@ -40,8 +41,6 @@ export default class Logger extends LoggerBase { const $file = $function.getAncestor("file") as FileJp; - this._isCxx = $file.isCxx; - let code = undefined; if ($file.isCxx) { code = this._log_cxx($file, $function); @@ -101,7 +100,7 @@ export default class Logger extends LoggerBase { } _log_cxx($file: FileJp, $function: FunctionJp) { - if (Clava.useSpecsLogger) { + if (this._useSpecsLogger) { return this._log_cxx_specslogger($file, $function); } else { return this._log_cxx_stdcpp($file, $function); diff --git a/Clava-JS/src-api/lara/code/Timer.ts b/Clava-JS/src-api/lara/code/Timer.ts index bc0b040469..d224445929 100644 --- a/Clava-JS/src-api/lara/code/Timer.ts +++ b/Clava-JS/src-api/lara/code/Timer.ts @@ -201,7 +201,7 @@ export default class Timer extends TimerBase { $timingResultDecl.type ); } else { - throw "Timer Exception: Platform not supported (Windows and Linux only)"; + throw new Error("Timer Exception: Platform not supported (Windows and Linux only)"); } // Build message diff --git a/Clava-JS/src-code/sideEffects.ts b/Clava-JS/src-code/sideEffects.ts index f72cdfb725..c62eac57fa 100644 --- a/Clava-JS/src-code/sideEffects.ts +++ b/Clava-JS/src-code/sideEffects.ts @@ -1,11 +1,43 @@ import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -import { Weaver } from "@specs-feup/lara/code/Weaver.js"; +import Weaver from "@specs-feup/lara/api/weaver/Weaver.js"; + +import path from "node:path"; +import os from "node:os"; +import pkg from "../package.json" with { type: "json" }; const CxxWeaverOptions = JavaTypes.getType( "pt.up.fe.specs.clava.weaver.options.CxxWeaverOption" ); -const datastore = Weaver.getDatastore(); +const CodeParser = JavaTypes.getType( + "pt.up.fe.specs.clang.codeparser.CodeParser" +); + +const datastore = Weaver.getWeaverEngine().getData().get(); -datastore.set(CxxWeaverOptions.PARSE_INCLUDES, true); datastore.set(CxxWeaverOptions.DISABLE_CLAVA_INFO, true); +datastore.set( + CodeParser.DUMPER_FOLDER, + new JavaTypes.File(getVersionedCacheDir()) +); + +/** Code to obtain temporary folder **/ + +function getVersionedCacheDir(): string { + // Use name+version to isolate different installed versions + return path.join(getCacheBaseDir(), pkg.name, pkg.version); +} + +function getCacheBaseDir(): string { + // OS conventions + if (process.platform === "win32") { + return ( + process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local") + ); + } + if (process.platform === "darwin") { + return path.join(os.homedir(), "Library", "Caches"); + } + // Linux / others + return process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache"); +} diff --git a/Clava-JS/tsconfig.jest.json b/Clava-JS/tsconfig.jest.json index 5c534f4053..dd7eedda34 100644 --- a/Clava-JS/tsconfig.jest.json +++ b/Clava-JS/tsconfig.jest.json @@ -1,5 +1,5 @@ { "extends": "./tsconfig.json", "include": ["**/*.spec.ts", "**/*.test.ts"], - "exclude": ["node_modules"], + "exclude": ["node_modules"] } diff --git a/Clava-JS/tsconfig.json b/Clava-JS/tsconfig.json index 1344342deb..c05308dc10 100644 --- a/Clava-JS/tsconfig.json +++ b/Clava-JS/tsconfig.json @@ -9,7 +9,7 @@ //"checkJs": true, "sourceMap": true, "declarationMap": true, - "allowSyntheticDefaultImports": true, + "allowSyntheticDefaultImports": true //"esModuleInterop": true - } + } } diff --git a/ClavaAst/.classpath b/ClavaAst/.classpath deleted file mode 100644 index 5e80ed9fd7..0000000000 --- a/ClavaAst/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ClavaAst/.project b/ClavaAst/.project deleted file mode 100644 index 47f4fb1f1d..0000000000 --- a/ClavaAst/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - ClavaAst - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598936 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaAst/.settings/org.eclipse.jdt.core.prefs b/ClavaAst/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f6c5ea36f6..0000000000 --- a/ClavaAst/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled diff --git a/ClavaAst/build.gradle b/ClavaAst/build.gradle index 39de27405c..61c35906ae 100644 --- a/ClavaAst/build.gradle +++ b/ClavaAst/build.gradle @@ -1,46 +1,35 @@ plugins { - id 'distribution' + id 'distribution' + id 'java' } -// Java project -apply plugin: 'java' - java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - // Repositories providers repositories { mavenCentral() } dependencies { - testImplementation "junit:junit:4.13.1" - - implementation ':GitPlus' - implementation ':GsonPlus' implementation ':jOptions' implementation ':SpecsUtils' implementation ':SymjaPlus' - implementation ':tdrcLibrary' - implementation group: 'com.google.guava', name: 'guava', version: '19.0' - implementation group: 'com.google.code.gson', name: 'gson', version: '2.4' - -} - -java { - withSourcesJar() + implementation 'com.google.guava:guava:33.4.0-jre' + implementation 'com.google.code.gson:gson:2.12.1' } // Project sources sourceSets { - main { - java { - srcDir 'src' - } - } + main { + java { + srcDir 'src' + } + } } diff --git a/ClavaAst/ivy.xml b/ClavaAst/ivy.xml deleted file mode 100644 index 4a2558f8d3..0000000000 --- a/ClavaAst/ivy.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/ClavaAst/settings.gradle b/ClavaAst/settings.gradle index c15e01e03d..78cf357d69 100644 --- a/ClavaAst/settings.gradle +++ b/ClavaAst/settings.gradle @@ -1,8 +1,8 @@ rootProject.name = 'ClavaAst' -includeBuild("../../specs-java-libs/GitPlus") -includeBuild("../../specs-java-libs/GsonPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/SymjaPlus") -includeBuild("../../specs-java-libs/tdrcLibrary") \ No newline at end of file +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' + +includeBuild("${specsJavaLibsRoot}/GitPlus") +includeBuild("${specsJavaLibsRoot}/jOptions") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") +includeBuild("${specsJavaLibsRoot}/SymjaPlus") diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ClavaId.java b/ClavaAst/src/pt/up/fe/specs/clava/ClavaId.java index c48b1ab2dd..bc4004a84a 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ClavaId.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ClavaId.java @@ -13,10 +13,9 @@ package pt.up.fe.specs.clava; +import java.util.Objects; import java.util.Optional; -import com.google.common.base.Preconditions; - public class ClavaId { public static enum RelationType { @@ -103,15 +102,7 @@ public Optional getParent() { // System.out.println("START GET PARENT:"); ClavaId currentId = this; while (currentId.next != null) { - Preconditions.checkNotNull(currentId.nextType); - // System.out.println("CURRENT ID:" + currentId.id); - // System.out.println("NEXT ID:" + currentId.next); - // System.out.println("NEXT TYPE:" + currentId.nextType); - // if (currentId.nextType == null) { - // System.out.println("NODE WHERE NEXT IS NOT NULL BUT TYPE IS:" + currentId); - // currentId = currentId.next; - // continue; - // } + Objects.requireNonNull(currentId.nextType); if (currentId.nextType == RelationType.PARENT) { return Optional.of(currentId.next); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ClavaNode.java b/ClavaAst/src/pt/up/fe/specs/clava/ClavaNode.java index 3add8c18af..d1de08d272 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ClavaNode.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ClavaNode.java @@ -334,8 +334,6 @@ public ClavaNode copy(boolean keepId) { public ClavaNode copy(boolean keepId, boolean copyChildren) { - get(CONTEXT).get(ClavaContext.METRICS).incrementNumCopies(); - // Re-implements ATreeNode copy, in order to specify if IDs should change or not // return super.copy(); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ClavaOptions.java b/ClavaAst/src/pt/up/fe/specs/clava/ClavaOptions.java index e75cb73faf..a9d9c632e4 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ClavaOptions.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ClavaOptions.java @@ -13,6 +13,9 @@ package pt.up.fe.specs.clava; +import java.util.ArrayList; +import java.util.List; + import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.Datakey.KeyFactory; import org.suikasoft.jOptions.storedefinition.StoreDefinition; @@ -20,7 +23,6 @@ import org.suikasoft.jOptions.storedefinition.StoreDefinitionProvider; import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.util.utilities.StringList; public interface ClavaOptions extends StoreDefinitionProvider { @@ -29,7 +31,8 @@ public interface ClavaOptions extends StoreDefinitionProvider { DataKey FLAGS = KeyFactory.string("Compiler Flags", ""); - DataKey FLAGS_LIST = KeyFactory.stringList("Compiler Flags in list format") + DataKey> FLAGS_LIST = KeyFactory.list("Compiler Flags in list format", String.class) + .setDefault(() -> new ArrayList()) .setLabel("Compiler Flags in list format"); DataKey CUSTOM_RESOURCES = KeyFactory.bool("Clava Custom Resources") @@ -38,14 +41,8 @@ public interface ClavaOptions extends StoreDefinitionProvider { DataKey DISABLE_REMOTE_DEPENDENCIES = KeyFactory.bool("Disable Remote Dependencies") .setLabel("Disable remote dependencies (e.g., git repositories)"); - // DataKey DISABLE_CLAVA_DATA_NODES = KeyFactory.bool("Disable Clava Data nodes") - // .setLabel("Disables new method for parsing nodes (only uses 'legacy' nodes)"); - StoreDefinition STORE_DEFINITION = new StoreDefinitionBuilder("Clava") - // .addKeys(STANDARD, FLAGS, CUSTOM_RESOURCES, DISABLE_REMOTE_DEPENDENCIES, DISABLE_CLAVA_DATA_NODES) - .addKeys(STANDARD, FLAGS, FLAGS_LIST, CUSTOM_RESOURCES, - // CUDA_GPU_ARCH, CUDA_PATH, - DISABLE_REMOTE_DEPENDENCIES) + .addKeys(STANDARD, FLAGS, FLAGS_LIST, CUSTOM_RESOURCES, DISABLE_REMOTE_DEPENDENCIES) .build(); @Override diff --git a/ClavaAst/src/pt/up/fe/specs/clava/Include.java b/ClavaAst/src/pt/up/fe/specs/clava/Include.java index f07738b68b..141e40229c 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/Include.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/Include.java @@ -36,7 +36,6 @@ public Include(File sourceFile, String include, int line, boolean isAngled) { } private static String normalizeInclude(String include) { - // Preconditions.checkNotNull(include); if (include == null) { return null; } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/SourceRange.java b/ClavaAst/src/pt/up/fe/specs/clava/SourceRange.java index a59e69861a..40dcb98276 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/SourceRange.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/SourceRange.java @@ -148,7 +148,6 @@ public Optional getFilenameTry() { if (start.getFilepath() == null) { return Optional.empty(); } - // Preconditions.checkNotNull(start.getFilepath()); return Optional.of(new File(start.getFilepath()).getName()); } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/control/ControlFlowGraph.java b/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/control/ControlFlowGraph.java index a62694f7c0..a204e2faa2 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/control/ControlFlowGraph.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/control/ControlFlowGraph.java @@ -93,81 +93,82 @@ private void findEdges() { BasicBlockNode bb = (BasicBlockNode) node; switch (bb.getType()) { - case EXIT: - // no out edges if this is an exit bb - break; - case IF: - IfStmt lastIf = (IfStmt) bb.last(); - // from IfStmt to its Then - Stmt firstOfThen = (Stmt) lastIf.getThen().get().getChild(0); - BasicBlockNode thenBB = bbs.get(firstOfThen); - this.addEdge(BasicBlockEdge.newTrueEdge(bb, thenBB)); - - // from IfStmt to its Else, or SE - Optional possibleElse = lastIf.getElse(); - if (possibleElse.isPresent()) { - Stmt firstOfElse = (Stmt) possibleElse.get().getChild(0); - BasicBlockNode elseBB = bbs.get(firstOfElse); - this.addEdge(BasicBlockEdge.newFalseEdge(bb, elseBB)); - } else { - Optional ifSe = getSE(lastIf); - if (ifSe.isPresent()) { - BasicBlockNode elseBB = bbs.get(ifSe.get()); + case EXIT: + // no out edges if this is an exit bb + break; + case IF: + IfStmt lastIf = (IfStmt) bb.last(); + // from IfStmt to its Then + Stmt firstOfThen = (Stmt) lastIf.getThen().get().getChild(0); + BasicBlockNode thenBB = bbs.get(firstOfThen); + this.addEdge(BasicBlockEdge.newTrueEdge(bb, thenBB)); + + // from IfStmt to its Else, or SE + Optional possibleElse = lastIf.getElse(); + if (possibleElse.isPresent()) { + Stmt firstOfElse = (Stmt) possibleElse.get().getChild(0); + BasicBlockNode elseBB = bbs.get(firstOfElse); this.addEdge(BasicBlockEdge.newFalseEdge(bb, elseBB)); - // this.addEdge(BasicBlockEdge.newEdge(bb, elseBB)); - } // else: there is no SE so it must mean this is the last stmt of the function - } + } else { + Optional ifSe = getSE(lastIf); + if (ifSe.isPresent()) { + BasicBlockNode elseBB = bbs.get(ifSe.get()); + this.addEdge(BasicBlockEdge.newFalseEdge(bb, elseBB)); + // this.addEdge(BasicBlockEdge.newEdge(bb, elseBB)); + } // else: there is no SE so it must mean this is the last stmt of the function + } - break; - case LOOP: - LoopStmt lastLoop = (LoopStmt) bb.last(); - // from LoopStmt to its Body - Stmt firstOfBody = (Stmt) lastLoop.getBody().getChild(0); - BasicBlockNode bodyBB = bbs.get(firstOfBody); - this.addEdge(BasicBlockEdge.newLoopEdge(bb, bodyBB)); - // from LoopStmt to its SE - Optional loopSe = getSE(lastLoop); - if (loopSe.isPresent()) { - BasicBlockNode loopSeBB = bbs.get(loopSe.get()); - this.addEdge(BasicBlockEdge.newNoLoopEdge(bb, loopSeBB)); - } - break; - case NORMAL: - Stmt lastStmt = bb.last(); - - // DoWhile follows this BB - List rightSiblings = lastStmt.getRightSiblings(); - if (!rightSiblings.isEmpty()) { - ClavaNode clavaNode = rightSiblings.get(0); - if (clavaNode instanceof DoStmt) { - - Stmt firstDo = (Stmt) ((DoStmt) clavaNode).getBody().getChild(0); - BasicBlockNode firstDoBB = bbs.get(firstDo); - this.addEdge(BasicBlockEdge.newEdge(bb, firstDoBB)); - continue; + break; + case LOOP: + LoopStmt lastLoop = (LoopStmt) bb.last(); + // from LoopStmt to its Body + Stmt firstOfBody = (Stmt) lastLoop.getBody().getChild(0); + BasicBlockNode bodyBB = bbs.get(firstOfBody); + this.addEdge(BasicBlockEdge.newLoopEdge(bb, bodyBB)); + // from LoopStmt to its SE + Optional loopSe = getSE(lastLoop); + if (loopSe.isPresent()) { + BasicBlockNode loopSeBB = bbs.get(loopSe.get()); + this.addEdge(BasicBlockEdge.newNoLoopEdge(bb, loopSeBB)); + } + break; + case NORMAL: + Stmt lastStmt = bb.last(); + + // DoWhile follows this BB + List rightSiblings = lastStmt.getRightSiblings(); + if (!rightSiblings.isEmpty()) { + ClavaNode clavaNode = rightSiblings.get(0); + if (clavaNode instanceof DoStmt) { + + Stmt firstDo = (Stmt) ((DoStmt) clavaNode).getBody().getChild(0); + BasicBlockNode firstDoBB = bbs.get(firstDo); + this.addEdge(BasicBlockEdge.newEdge(bb, firstDoBB)); + continue; + } } - } - // everything else - Optional possibleSe = getSE(lastStmt); - if (possibleSe.isPresent()) { + // everything else + Optional possibleSe = getSE(lastStmt); + if (possibleSe.isPresent()) { - Stmt se = possibleSe.get(); + Stmt se = possibleSe.get(); - BasicBlockNode seBB = bbs.get(se); - this.addEdge(BasicBlockEdge.newEdge(bb, seBB)); - } + BasicBlockNode seBB = bbs.get(se); + this.addEdge(BasicBlockEdge.newEdge(bb, seBB)); + } - break; - default: - throw new RuntimeException("This BB has type '" + BasicBlockNodeType.UNDEFINED - + "' and that shouldn't happen. BB info: \n" + bb.toString()); + break; + default: + throw new RuntimeException("This BB has type '" + BasicBlockNodeType.UNDEFINED + + "' and that shouldn't happen. BB info: \n" + bb.toString()); } } } /** - * Gets the SE, or Sibling Equivalent. This is either the first right sibling, or the equivalent for CFG purposes, + * Gets the SE, or Sibling Equivalent. This is either the first right sibling, + * or the equivalent for CFG purposes, * e.g., a scoped statement that is the parent of the stmt. * * @param stmt @@ -219,9 +220,11 @@ private void fillBBs() { } if (leaderSet.contains(stmt)) { - current = bbs.get(stmt); } else { + if (current == null) { + throw new RuntimeException("BasicBlockNode for leader statement not found: " + stmt); + } current.addStmt(stmt); } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/data/DataFlowGraph.java b/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/data/DataFlowGraph.java index a711b5f21b..6026200cde 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/data/DataFlowGraph.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/analysis/flow/data/DataFlowGraph.java @@ -375,6 +375,9 @@ private ArrayList buildGraphTopLevelConditional(BasicBlockNode blo } } // Set multiplexer as top level + if (condition == null) { + throw new IllegalStateException("Condition node is null in IF block"); + } condition.setTopLevel(false); DataFlowNode mux = new DataFlowNode(DataFlowNodeType.OP_COND, "mux", condition.getClavaNode()); this.addNode(mux); @@ -490,6 +493,9 @@ private ArrayList buildGraphLoop(BasicBlockNode loopBlock) { if (edge.getType() == BasicBlockEdgeType.LOOP) topBlock = (BasicBlockNode) edge.getDest(); } + if (topBlock == null) { + throw new IllegalStateException("Loop block has no top block"); + } // Get top basic blocks ArrayList blocks = new ArrayList<>(); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/Decl.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/Decl.java index 9abe842555..45778bd580 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/Decl.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/Decl.java @@ -84,27 +84,21 @@ public boolean hasAttribute(AttributeKind kind) { } public String getAttributesCode() { - // return getAttributesCode(get(ATTRIBUTES), true, true); - // } - // - // public String getAttributesCode(List attrs, boolean addNewline, boolean ignoreGenericAttrs) { - List attrs = get(ATTRIBUTES); var code = new StringBuilder(); - for (Attribute attr : attrs) { + for (Attribute attr : get(ATTRIBUTES)) { // If generic class, do not generated code for it - // if (ignoreGenericAttrs && attr.getClass().equals(Attribute.class)) { if (attr.getClass().equals(Attribute.class)) { ClavaLog.info( "Attribute '" + attr.getKind() + "' not implemented, not generating code for it"); continue; } + code.append(attr.getCode()); if (attr.getKind().isInline()) { code.append(" "); - // } else if (addNewline) { } else { code.append("\n"); } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/RecordDecl.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/RecordDecl.java index a8a23b45dc..003634ba34 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/RecordDecl.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/RecordDecl.java @@ -85,12 +85,6 @@ protected String getCode(List bases, List te code.append(getTagKind().getCode()); // Add attributes - // var preAttributes = get(ATTRIBUTES).stream() - // .filter(attr -> !attr.isPostAttr()) - // .collect(Collectors.toList()); - // - // String preAttributesCode = getAttributesCode(preAttributes, false, false); - String preAttributesCode = get(ATTRIBUTES).stream() .filter(attr -> !attr.isPostAttr()) .map(Attribute::getCode) diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/TemplateArgumentTemplate.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/TemplateArgumentTemplate.java index 68764e2460..088571a144 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/TemplateArgumentTemplate.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/TemplateArgumentTemplate.java @@ -64,7 +64,7 @@ public static TemplateArgumentTemplate newInstance(TemplateNameKind nameKind) { // case Template: // TemplateDecl templateDecl = get(TEMPLATE_DECL).get(); // Decl decl = templateDecl.getTemplateDecl(); - // SpecsCheck.checkNotNull(decl instanceof NamedDecl, () -> "Check if this should always be a NamedDecl"); + // Objects.requireNonNull(decl instanceof NamedDecl, () -> "Check if this should always be a NamedDecl"); // return ((NamedDecl) decl).getDeclName(); // default: // throw new RuntimeException("Case not implemented: " + get(TEMPLATE_NAME_KIND)); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/template/Template.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/template/Template.java index 1d7c45f34b..b648305547 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/template/Template.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/data/templates/template/Template.java @@ -13,6 +13,7 @@ package pt.up.fe.specs.clava.ast.decl.data.templates.template; +import java.util.Objects; import java.util.Optional; import org.suikasoft.jOptions.Datakey.DataKey; @@ -26,7 +27,6 @@ import pt.up.fe.specs.clava.ast.decl.TemplateDecl; import pt.up.fe.specs.clava.ast.decl.data.templates.TemplateArgumentTemplate; import pt.up.fe.specs.clava.ast.type.enums.TemplateNameKind; -import pt.up.fe.specs.util.SpecsCheck; public class Template extends TemplateArgumentTemplate { @@ -51,7 +51,7 @@ public String getCode(ClavaNode node) { return ""; } - SpecsCheck.checkNotNull(decl instanceof NamedDecl, () -> "Check if this should always be a NamedDecl"); + Objects.requireNonNull(decl instanceof NamedDecl, () -> "Check if this should always be a NamedDecl"); return ((NamedDecl) decl).getDeclName(); } } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/enums/LanguageId.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/enums/LanguageId.java index 53fd91ddde..fc6a82e0d0 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/enums/LanguageId.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/decl/enums/LanguageId.java @@ -13,15 +13,12 @@ package pt.up.fe.specs.clava.ast.decl.enums; -import pt.up.fe.specs.util.enums.EnumHelperProvider; import pt.up.fe.specs.util.providers.StringProvider; public enum LanguageId implements StringProvider { C("C"), CXX("C++"); - public static final EnumHelperProvider HELPER = new EnumHelperProvider<>(LanguageId.class); - private final String code; private LanguageId(String code) { diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/extra/TranslationUnit.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/extra/TranslationUnit.java index dcebdb2d1c..84ee33b16b 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/extra/TranslationUnit.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/extra/TranslationUnit.java @@ -13,9 +13,17 @@ package pt.up.fe.specs.clava.ast.extra; +import java.io.File; +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.Datakey.KeyFactory; import org.suikasoft.jOptions.Interfaces.DataStore; + import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.SourceRange; import pt.up.fe.specs.clava.ast.decl.IncludeDecl; @@ -31,13 +39,6 @@ import pt.up.fe.specs.util.utilities.LineStream; import pt.up.fe.specs.util.utilities.StringLines; -import java.io.File; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - /** * Represents a source file. * diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIfClause.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIfClause.java index cd4e758410..b8af98a4d0 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIfClause.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIfClause.java @@ -13,10 +13,9 @@ package pt.up.fe.specs.clava.ast.omp.clauses; +import java.util.Objects; import java.util.Optional; -import com.google.common.base.Preconditions; - public class OmpIfClause implements OmpClause { private final String directiveName; @@ -30,7 +29,7 @@ public OmpIfClause(String directiveName, String expression) { this.directiveName = directiveName; this.expression = expression; - Preconditions.checkNotNull(expression); + Objects.requireNonNull(expression); } public String getExpression() { diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIntegerExpressionClause.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIntegerExpressionClause.java index 4e84b56e8f..0f873eb5ce 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIntegerExpressionClause.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpIntegerExpressionClause.java @@ -13,7 +13,7 @@ package pt.up.fe.specs.clava.ast.omp.clauses; -import com.google.common.base.Preconditions; +import java.util.Objects; public class OmpIntegerExpressionClause implements OmpClause { @@ -31,7 +31,7 @@ public OmpIntegerExpressionClause(OmpClauseKind kind, String expression, boolean this.isConstantPositive = isConstantPositive; if (!isOptional) { - Preconditions.checkNotNull(expression, "Expected expression to be present, since it is not optional"); + Objects.requireNonNull(expression, () -> "Expected expression to be present, since it is not optional"); } // TODO: Verify if positive constant integer expression with Symja? diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpNumThreadsClause.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpNumThreadsClause.java index a743fcd4dd..f2faf80d47 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpNumThreadsClause.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpNumThreadsClause.java @@ -13,7 +13,7 @@ package pt.up.fe.specs.clava.ast.omp.clauses; -import com.google.common.base.Preconditions; +import java.util.Objects; public class OmpNumThreadsClause implements OmpClause { @@ -22,7 +22,7 @@ public class OmpNumThreadsClause implements OmpClause { public OmpNumThreadsClause(String expression) { this.expression = expression; - Preconditions.checkNotNull(expression); + Objects.requireNonNull(expression); } public String getExpression() { diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpReductionClause.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpReductionClause.java index 2e5463489e..8c23aee947 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpReductionClause.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/omp/clauses/OmpReductionClause.java @@ -14,6 +14,7 @@ package pt.up.fe.specs.clava.ast.omp.clauses; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import com.google.common.base.Preconditions; @@ -67,7 +68,7 @@ public OmpReductionClause(ReductionKind reductionKind, List variables) { this.reductionKind = reductionKind; this.variables = variables; - Preconditions.checkNotNull(variables); + Objects.requireNonNull(variables); Preconditions.checkArgument(variables.size() > 0); } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/stmt/SwitchCase.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/stmt/SwitchCase.java index ff61f6e690..81788e1695 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/stmt/SwitchCase.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/stmt/SwitchCase.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Objects; import java.util.Optional; import org.suikasoft.jOptions.Interfaces.DataStore; @@ -23,7 +24,6 @@ import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; import pt.up.fe.specs.clava.ast.expr.Expr; -import pt.up.fe.specs.util.SpecsCheck; /** * Represents a switch case. @@ -43,7 +43,7 @@ public Optional getSubStmt() { public boolean isEmptyCase() { var nextStmt = getSubStmt().orElse(null); - SpecsCheck.checkNotNull(nextStmt, () -> "Case has no sub statement, is this correct?"); + Objects.requireNonNull(nextStmt, () -> "Case has no sub statement, is this correct?"); return nextStmt instanceof SwitchCase; } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/ArraySizeType.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/ArraySizeType.java index 2c84d29361..98bf7c8ef1 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/ArraySizeType.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/ArraySizeType.java @@ -18,6 +18,7 @@ * @author JoaoBispo * */ +@Deprecated public enum ArraySizeType { NORMAL(""), STATIC("static"), diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/BuiltinKind.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/BuiltinKind.java index 324e9200f0..d75b927bed 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/BuiltinKind.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/BuiltinKind.java @@ -336,15 +336,6 @@ public enum BuiltinKind { // Manually add certain cases BUILTIN_CODE.put(Char_S, "char"); BUILTIN_CODE.put(WChar_U, "wchar_t"); - - /* - BUILTIN_CODE.put(Void, "void"); - BUILTIN_CODE.put(Int, "int"); - BUILTIN_CODE.put(Long, "long"); - BUILTIN_CODE.put(LongLong, "long long"); - BUILTIN_CODE.put(Float, "float"); - BUILTIN_CODE.put(Double, "double"); - */ } /** @@ -405,7 +396,6 @@ private String getCodePrivate(ClavaNode sourceNode) { case Half: return getCodeHalf(sourceNode); default: - // return null; throw new NotImplementedException(this); } } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/UnaryTransformTypeKind.java b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/UnaryTransformTypeKind.java index 24cd60df66..48018fc8d0 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/UnaryTransformTypeKind.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/ast/type/enums/UnaryTransformTypeKind.java @@ -15,6 +15,7 @@ public enum UnaryTransformTypeKind { + Decay, EnumUnderlyingType; } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaContext.java b/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaContext.java index f8ef983318..26079774a0 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaContext.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaContext.java @@ -47,62 +47,26 @@ public class ClavaContext extends ADataClass { public final static DataKey FACTORY = KeyFactory .object("factory", ClavaFactory.class); - // public final static DataKey APP = KeyFactory - // .object("app", App.class); - - public final static DataKey METRICS = KeyFactory - .object("metrics", ClavaMetrics.class); - public final static DataKey> CACHED_FILEPATHS = KeyFactory .generic("cachedFilepaths", () -> new CachedItems(string -> string, true)); - /** - * If set, represents the root folder where we are working on. - */ - // public final static DataKey> ROOT_FOLDER = KeyFactory.optional("rootFolder"); - - /** - * Temporary measure due to TextParser being called more than once over the same nodes. - */ - // public final static DataKey> ASSOCIATED_COMMENTS = KeyFactory.generic( - // "associatedComments", (Set) new HashSet()); - - /// DATAKEYS END - - // private final DataStore data; - // private final Standard standard; - // private final List arguments; - // private final ClavaIdGenerator idGenerator; - // private final ClavaFactory factory; - private final List appStack; public ClavaContext() { - - // this.data = DataStore.newInstance(getClass()); - // Set arguments set(ARGUMENTS, new HashMap<>()); + // Set IDs generator + set(ID_GENERATOR, new IdGenerator()); + // Initialize factory set(FACTORY, new ClavaFactory(this)); - set(METRICS, new ClavaMetrics()); - set(CACHED_FILEPATHS, new CachedItems<>(string -> string, true)); appStack = new ArrayList<>(); } - // public ClavaContext(ClavaContext context) { - // set(ARGUMENTS, ARGUMENTS.copy(context.get(ARGUMENTS))); - // set(ID_GENERATOR, ID_GENERATOR.copy(context.get(ID_GENERATOR))); - // set(METRICS, METRICS.copy(context.get(METRICS))); - // - // // Initialize factory - // set(FACTORY, new ClavaFactory(this)); - // } - public ClavaContext addArguments(File sourceFile, List arguments) { get(ARGUMENTS).put(sourceFile, arguments); return this; @@ -118,8 +82,6 @@ public Optional pushApp(App newApp) { Optional previousApp = SpecsCollections.lastTry(appStack); appStack.add(newApp); - // ClavaLog.info("APP PUSH: " + appStack.size() + " pushed app: " + newApp.hashCode()); - return previousApp; } @@ -139,8 +101,6 @@ public void clearAppHistory() { public App popApp() { App app = appStack.remove(appStack.size() - 1); - // ClavaLog.info("APP POP: " + appStack.size() + " popped app: " + app.hashCode()); - return app; } @@ -175,31 +135,4 @@ public Optional getApp(int index) { return Optional.of(appStack.get(appStack.size() - index - 1)); } - - // public T get(DataKey key) { - // return this.data.get(key); - // } - - // public Standard getStandard() { - // return standard; - // } - - /* - public ClavaIdGenerator getIds() { - return idGenerator; - // return data.get(ID_GENERATOR); - } - - - - public List getParsingArguments() { - return arguments; - // return data.get(ARGUMENTS); - } - */ - - // @Override - // public String toString() { - // return "ClavaContext:" + Integer.toString(hashCode()); - // } } diff --git a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaFactory.java b/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaFactory.java index 89deed82fa..0f511bb215 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaFactory.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaFactory.java @@ -492,7 +492,6 @@ public InitListExpr initListExpr(List values) { return new InitListExpr(data, values); } - public UnaryExprOrTypeTraitExpr sizeof(Type typeArg) { DataStore data = newDataStore(UnaryExprOrTypeTraitExpr.class) .put(UnaryExprOrTypeTraitExpr.KIND, UnaryExprOrTypeTrait.SizeOf) @@ -790,7 +789,7 @@ public ExprStmt exprStmtAssignment(Expr lhs, Expr rhs) { */ public IfStmt ifStmt(Expr condition, CompoundStmt thenBody, CompoundStmt elseBody) { - SpecsCheck.checkNotNull(condition, () -> "Condition of IfStmt must exist"); + Objects.requireNonNull(condition, () -> "Condition of IfStmt must exist"); // If null, create empty CompoundStmt ClavaNode thenStmt = thenBody != null ? thenBody : compoundStmt(); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaMetrics.java b/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaMetrics.java deleted file mode 100644 index c9c0cca1c8..0000000000 --- a/ClavaAst/src/pt/up/fe/specs/clava/context/ClavaMetrics.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2018 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.context; - -public class ClavaMetrics { - - private long numCopies; - - public ClavaMetrics() { - } - - public ClavaMetrics(ClavaMetrics clavaMetrics) { - this.numCopies = clavaMetrics.numCopies; - } - - public long getNumCopies() { - return numCopies; - } - - public void incrementNumCopies() { - numCopies++; - } -} diff --git a/ClavaAst/src/pt/up/fe/specs/clava/language/TagKind.java b/ClavaAst/src/pt/up/fe/specs/clava/language/TagKind.java index 736d74fa63..217069c8f9 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/language/TagKind.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/language/TagKind.java @@ -51,6 +51,5 @@ public String getCode() { @Override public String getString() { return SpecsStrings.toCamelCase(name()); - // return getCode(); } } \ No newline at end of file diff --git a/ClavaAst/src/pt/up/fe/specs/clava/parsing/omp/OmpClauseParsers.java b/ClavaAst/src/pt/up/fe/specs/clava/parsing/omp/OmpClauseParsers.java index 2bee898bae..79f006aa0d 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/parsing/omp/OmpClauseParsers.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/parsing/omp/OmpClauseParsers.java @@ -22,6 +22,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; @@ -139,7 +140,7 @@ private static OmpClause parse(StringParser pragmaParser, OmpClauseKind clauseKi ClavaLog.info("Clause not implemented yet: " + clauseKind.getString()); return null; } - // Preconditions.checkNotNull(clauseParser, "Clause not implemented yet: " + clauseKind); + // Objects.requireNonNull(clauseParser, () -> "Clause not implemented yet: " + clauseKind); // Remove unused spaces // without this, the next call will fail to match any OmpClauseKind when parseClauseName is called @@ -392,8 +393,8 @@ private static OmpIfClause parseIf(StringParser clauses, OmpClauseKind kind, Omp // If has colon, directive name must not be null, and this is an if clause with directive name if (hasColon) { - Preconditions.checkNotNull(directiveName, - "Since it has a colon, expected the directive name preceeding the colon:" + clauses.toString()); + Objects.requireNonNull(directiveName, + () -> "Since it has a colon, expected the directive name preceeding the colon:" + clauses.toString()); String expression = clause.clear(); return new OmpIfClause(directiveName, expression); diff --git a/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextElements.java b/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextElements.java index 5a6237a9db..430deeb9ff 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextElements.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextElements.java @@ -13,11 +13,11 @@ package pt.up.fe.specs.clava.parsing.snippet; +import java.util.List; + import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.comment.InlineComment; -import java.util.List; - public class TextElements { private List standaloneElements; diff --git a/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextParser.java b/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextParser.java index 364eb58039..a4020a39fe 100644 --- a/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextParser.java +++ b/ClavaAst/src/pt/up/fe/specs/clava/parsing/snippet/TextParser.java @@ -13,7 +13,25 @@ package pt.up.fe.specs.clava.parsing.snippet; +import static pt.up.fe.specs.clava.context.ClavaContext.FACTORY; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NavigableMap; +import java.util.Optional; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; +import java.util.stream.Collectors; + import com.google.common.base.Preconditions; + import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; import pt.up.fe.specs.clava.SourceRange; @@ -35,12 +53,6 @@ import pt.up.fe.specs.util.treenode.transform.TransformQueue; import pt.up.fe.specs.util.utilities.LineStream; -import java.io.File; -import java.util.*; -import java.util.stream.Collectors; - -import static pt.up.fe.specs.clava.context.ClavaContext.FACTORY; - /** * Parses text elements from C/C++ files, such as comments and pragmas. * diff --git a/ClavaHls/.classpath b/ClavaHls/.classpath deleted file mode 100644 index ac581d2d65..0000000000 --- a/ClavaHls/.classpath +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ClavaHls/.project b/ClavaHls/.project deleted file mode 100644 index 3dc3776609..0000000000 --- a/ClavaHls/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - ClavaHls - - - ClavaAst - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598940 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaHls/.settings/org.eclipse.jdt.core.prefs b/ClavaHls/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f6c5ea36f6..0000000000 --- a/ClavaHls/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled diff --git a/ClavaHls/.settings/org.eclipse.ltk.core.refactoring.prefs b/ClavaHls/.settings/org.eclipse.ltk.core.refactoring.prefs deleted file mode 100644 index b196c64a34..0000000000 --- a/ClavaHls/.settings/org.eclipse.ltk.core.refactoring.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/ClavaHls/build.gradle b/ClavaHls/build.gradle deleted file mode 100644 index 7634b52ec5..0000000000 --- a/ClavaHls/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id 'distribution' -} - -// Java project -apply plugin: 'java' - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} - - -// Repositories providers -repositories { - mavenCentral() -} - -dependencies { - testImplementation "junit:junit:4.13.1" - implementation ':SpecsUtils' - implementation ':GitPlus' - implementation ':GsonPlus' - implementation ':jOptions' - implementation ':tdrcLibrary' - implementation ':ClavaAst' - -} - -java { - withSourcesJar() -} - - -// Project sources -sourceSets { - main { - java { - srcDir 'src' - } - - } - -} diff --git a/ClavaHls/settings.gradle b/ClavaHls/settings.gradle deleted file mode 100644 index 47137a75f2..0000000000 --- a/ClavaHls/settings.gradle +++ /dev/null @@ -1,9 +0,0 @@ -rootProject.name = 'ClavaHls' - -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/GitPlus") -includeBuild("../../specs-java-libs/GsonPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/tdrcLibrary") - -includeBuild("../../clava/ClavaAst") diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLS.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLS.java deleted file mode 100644 index 9b2c6338b1..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLS.java +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls; - -import java.io.File; -import java.util.ArrayList; - -import pt.up.fe.specs.clava.ClavaLog; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowSubgraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowSubgraphMetrics; -import pt.up.fe.specs.clava.hls.heuristics.InlineHeuristic; -import pt.up.fe.specs.clava.hls.heuristics.PipelineHeuristic; -import pt.up.fe.specs.clava.hls.strategies.ArrayStreamDetector; -import pt.up.fe.specs.clava.hls.strategies.CodeRegionPipelining; -import pt.up.fe.specs.clava.hls.strategies.FunctionInlining; -import pt.up.fe.specs.clava.hls.strategies.LoadStores; -import pt.up.fe.specs.clava.hls.strategies.NestedLoopUnrolling; -import pt.up.fe.specs.util.SpecsIo; - -public class ClavaHLS { - private DataFlowGraph dfg; - private File weavingFolder; - private boolean verbose = false; - private final String separator = new String(new char[75]).replace('\0', '-'); - - public ClavaHLS(DataFlowGraph dfg, File weavingFolder) { - this.dfg = dfg; - this.weavingFolder = weavingFolder; - preprocessDfg(); - } - - public void applyFunctionInlining(double B) { - log(separator); - log("detecting if function calls can be inlined"); - FunctionInlining inliner = new FunctionInlining(dfg, B); - inliner.analyze(); - inliner.apply(); - - log(separator); - } - - public void applyArrayStreaming() { - log(separator); - log("detecting if arrays can be turned into streams"); - ArrayStreamDetector arrayStream = new ArrayStreamDetector(dfg); - arrayStream.analyze(); - if (arrayStream.detectedCases() > 0) { - log("found " + arrayStream.detectedCases() + " parameter(s) that can be declared as stream"); - arrayStream.apply(); - } - log(separator); - } - - public void applyLoopStrategies(int p) { - log(separator); - log("defining unrolling factor for nested loops"); - NestedLoopUnrolling loopUnfolding = new NestedLoopUnrolling(dfg); - loopUnfolding.analyze(); - loopUnfolding.apply(); - - log("detecting if code regions can be pipelined"); - CodeRegionPipelining pipelining = new CodeRegionPipelining(dfg, loopUnfolding.getLoopsToUnroll(), p); - pipelining.analyze(); - pipelining.apply(); - log(separator); - } - - public void applyLoadStoresStrategy(int N) { - log(separator); - log("applying load/stores strategy only"); - LoadStores ls = new LoadStores(dfg, N); - ls.analyze(); - if (ls.isSimpleLoop()) { - log("function is a simple loop, applying directives"); - log("chosen Load/Stores factor is " + ls.getLsFactor()); - ls.apply(); - } else { - log("function is not a simple loop, Load/Stores strategy cannot be applied"); - } - log(separator); - } - - public void applyGenericStrategies(ClavaHLSOptions options) { - log(separator); - if (dfg.hasConditionals()) { - this.verbose = true; - printDfg(); - return; - } - log("applying HLS optimization with all generic strategies"); - printDfg(); - printSubgraphCosts(); - - this.applyArrayStreaming(); - this.applyFunctionInlining(InlineHeuristic.DEFAULT_B); - this.applyLoopStrategies(PipelineHeuristic.DEFAULT_FACTOR); - - log("finished HLS optimization"); - log(separator); - } - - public boolean canBeInstrumented() { - log("checking if function can be turned into a trace"); - TracingValidator valid = new TracingValidator(dfg); - boolean able = valid.validate(); - if (able) - log("function can be turned into a trace!"); - else - log("function cannot be turned into a trace"); - return able; - } - - public static void log(String msg) { - ClavaLog.info("HLS: " + msg); - } - - private void printDfg() { - StringBuilder sb = new StringBuilder(); - sb.append(dfg.getFunctionName()).append(".dot"); - String dot = dfg.toDot(); - saveFile(weavingFolder, "graphs", sb.toString(), dfg.toDot()); - - if (verbose) { - log("using the following DFG as input:"); - log("----------------------------------"); - ClavaHLS.log("\n" + dot); - log("----------------------------------"); - } - } - - private void printSubgraphCosts() { - log("reporting the cost of each subgraph"); - StringBuilder sb = new StringBuilder(); - String NL = "\n"; - sb.append(DataFlowSubgraphMetrics.HEADER).append(NL); - for (DataFlowNode node : dfg.getSubgraphRoots()) { - DataFlowSubgraph sub = dfg.getSubgraph(node); - DataFlowSubgraphMetrics m = sub.getMetrics(); - m.setIterations(DFGUtils.estimateNodeFrequency(sub.getRoot())); - sb.append(m.toString()).append(NL); - } - StringBuilder fileName = new StringBuilder(); - fileName.append("features_").append(dfg.getFunctionName()).append(".csv"); - saveFile(weavingFolder, "reports", fileName.toString(), sb.toString()); - } - - private void preprocessDfg() { - for (DataFlowNode node : dfg.getSubgraphRoots()) { - // Identify indexes - DataFlowSubgraph sub = dfg.getSubgraph(node); - ArrayList loads = DFGUtils.getVarLoadsOfSubgraph(sub); - for (DataFlowNode load : loads) { - if (DFGUtils.isIndex(load)) - load.setType(DataFlowNodeType.LOAD_INDEX); - } - // Merge loads and stores of the same var - String storeLabel = sub.getRoot().getLabel(); - ArrayList nodesToMerge = new ArrayList<>(); - nodesToMerge.add(sub.getRoot()); - for (DataFlowNode n : sub.getNodes()) { - if (n.getLabel().contentEquals(storeLabel)) { - nodesToMerge.add(n); - } - } - dfg.mergeNodes(nodesToMerge); - } - } - - public void saveFile(File weavingFolder, String reportType, String fileName, String fileContents) { - SpecsIo.mkdir(weavingFolder); - StringBuilder path = new StringBuilder(); - path.append(weavingFolder.getPath().toString()).append(File.separator).append("_HLS_").append(reportType) - .append(File.separator).append(fileName); - if (SpecsIo.write(new File(path.toString()), fileContents)) - ClavaHLS.log("file \"" + fileName + "\" saved to \"" + path.toString() + "\""); - else - ClavaHLS.log("failed to save file \"" + fileName + "\""); - } - - @Deprecated - public void run(ClavaHLSOptions mode) { - if (mode.decide) { - if (canBeInstrumented()) { - mode.trace = true; - } else { - mode.directives = true; - } - } - mode.directives = true; // JUST FOR DEBUG - if (mode.trace) { - // Call LARA? - } - if (mode.directives) { - applyGenericStrategies(mode); - } - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLSOptions.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLSOptions.java deleted file mode 100644 index b5f0ff4dc7..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/ClavaHLSOptions.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls; - -public class ClavaHLSOptions { - public boolean unsafe = false; - public boolean decide = false; - public boolean trace = false; - public boolean directives = false; - - public ClavaHLSOptions() { - - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/TracingValidator.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/TracingValidator.java deleted file mode 100644 index 8b278dc257..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/TracingValidator.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls; - -import java.util.ArrayList; - -import pt.up.fe.specs.clava.analysis.flow.FlowEdge; -import pt.up.fe.specs.clava.analysis.flow.FlowNode; -import pt.up.fe.specs.clava.analysis.flow.control.BasicBlockEdge; -import pt.up.fe.specs.clava.analysis.flow.control.BasicBlockEdgeType; -import pt.up.fe.specs.clava.analysis.flow.control.BasicBlockNode; -import pt.up.fe.specs.clava.analysis.flow.control.BasicBlockNodeType; -import pt.up.fe.specs.clava.analysis.flow.control.ControlFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; - -public class TracingValidator { - private DataFlowGraph dfg; - - public TracingValidator(DataFlowGraph dfg) { - this.dfg = dfg; - } - - public boolean validate() { - if (!checkConditionals()) - return false; - if (!checkCalls()) - return false; - if (!checkAccessPatterns()) - return false; - return true; - } - - private boolean checkConditionals() { - ControlFlowGraph cfg = dfg.getCfg(); - for (FlowNode n : cfg.getNodes()) { - BasicBlockNode node = (BasicBlockNode) n; - if (node.getType() == BasicBlockNodeType.IF) - return false; - for (FlowEdge e : node.getOutEdges()) { - BasicBlockEdge edge = (BasicBlockEdge) e; - if (edge.getType() == BasicBlockEdgeType.FALSE || edge.getType() == BasicBlockEdgeType.TRUE) - return false; - } - } - return true; - } - - private boolean checkCalls() { - for (DataFlowNode node : DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.OP_CALL)) { - if (node.getInEdges().size() != 1) - return false; - } - return true; - } - - private boolean checkAccessPatterns() { - for (DataFlowNode node : DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.LOAD_ARRAY)) { - if (!matchesTemplate(node)) - return false; - } - for (DataFlowNode node : DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.STORE_ARRAY)) { - if (!matchesTemplate(node)) - return false; - } - return true; - } - - private boolean matchesTemplate(DataFlowNode node) { - ArrayList idx = DFGUtils.getIndexesOfArray(node); - for (DataFlowNode n : idx) { - ArrayList expr = DFGUtils.getIndexExpr(n); - for (DataFlowNode i : expr) { - if (i.getType() != DataFlowNodeType.LOAD_INDEX && i.getType() != DataFlowNodeType.CONSTANT - && i.getType() != DataFlowNodeType.OP_ARITH) - return false; - if (i.getType() == DataFlowNodeType.OP_ARITH) { - if (!i.getLabel().equals("+") && !i.getLabel().equals("-")) - return false; - } - } - } - return true; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSArrayPartition.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSArrayPartition.java deleted file mode 100644 index 8dcd6f3dcb..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSArrayPartition.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSArrayPartition extends HLSDirective { - private PartitionType type; - private String variable; - private int factor = -1; - private int dim = -1; - - public enum PartitionType { - CYCLIC, BLOCK, COMPLETE - } - - public HLSArrayPartition(PartitionType type, String variable, int factor) { - this.type = type; - this.variable = variable; - this.factor = factor; - } - - public void setDim(int dim) { - this.dim = dim; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(super.toString()).append("array_partition variable=").append(variable) - .append(" ").append(type.toString().toLowerCase()); - if (factor != -1) - sb.append(" factor=").append(factor); - if (dim != -1) - sb.append(" dim=").append(dim); - return sb.toString(); - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSDirective.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSDirective.java deleted file mode 100644 index fcd4a3893e..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSDirective.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public abstract class HLSDirective { - @Override - public String toString() { - return "#pragma HLS "; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSExpressionBalance.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSExpressionBalance.java deleted file mode 100644 index 4c34b3559a..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSExpressionBalance.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSExpressionBalance extends HLSDirective { - boolean off = false; - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(super.toString()).append("expression_balance"); - if (off) - sb.append(" off"); - return sb.toString(); - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSInline.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSInline.java deleted file mode 100644 index 129364faf9..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSInline.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSInline extends HLSDirective { - private InlineType type = InlineType.NONE; - - public enum InlineType { - REGION, RECURSIVE, OFF, NONE - }; - - public HLSInline(InlineType type) { - this.type = type; - } - - @Override - public String toString() { - String s = super.toString(); - s += "inline "; - if (type != InlineType.NONE) - s += type.toString().toLowerCase(); - return s; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSPipeline.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSPipeline.java deleted file mode 100644 index 1b37fdb737..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSPipeline.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSPipeline extends HLSDirective { - private int ii = 0; - private boolean enable_flush = false; - private boolean rewind = false; - - public void setII(int ii) { - this.ii = ii; - } - - public void setEnableFlush(boolean enableFlush) { - this.enable_flush = enableFlush; - } - - public void setRewind(boolean rewind) { - this.rewind = rewind; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()); - sb.append("pipeline"); - if (ii > 0) - sb.append(" II=").append(ii); - if (enable_flush) - sb.append(" enable_flush"); - if (rewind) - sb.append(" rewind"); - return sb.toString(); - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSStream.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSStream.java deleted file mode 100644 index 1eabcbcaf0..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSStream.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSStream extends HLSDirective { - private String variable; - private int depth = -1; - private int dim = -1; - private boolean isOff = false; - - public HLSStream(String variable) { - this.variable = variable; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()).append("stream variable=").append(variable); - if (depth != -1) - sb.append(" depth=").append(depth); - if (dim != -1) - sb.append(" dim=").append(dim); - if (isOff) - sb.append(" off"); - return sb.toString(); - } - - public void setDepth(int depth) { - this.depth = depth; - } - - public void setDim(int dim) { - this.dim = dim; - } - - public void setOff(boolean isOff) { - this.isOff = isOff; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSUnroll.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSUnroll.java deleted file mode 100644 index ad47d5118e..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/directives/HLSUnroll.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.directives; - -public class HLSUnroll extends HLSDirective { - private int factor = 0; - private boolean region = false; - private boolean skip = false; - - public void setFactor(int factor) { - this.factor = factor; - } - - public void setRegion(boolean region) { - this.region = region; - } - - public void setSkip(boolean skip) { - this.skip = skip; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(super.toString()).append("unroll"); - if (factor > 0) - sb.append(" factor=").append(factor); - if (region) - sb.append(" region"); - if (skip) - sb.append(" skip_exit_check"); - return sb.toString(); - } - -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/InlineHeuristic.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/InlineHeuristic.java deleted file mode 100644 index c8558ccad1..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/InlineHeuristic.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.heuristics; - -import pt.up.fe.specs.clava.hls.ClavaHLS; - -public class InlineHeuristic { - public static double DEFAULT_B = 2; - - public static boolean calculate(long callFreq, long funCost, long mainCost, double b) { - ClavaHLS.log("callFreq = " + callFreq + ", funCost = " + funCost + ", mainCost = " + mainCost + "N = " + b); - long x = callFreq * funCost; - boolean res = mainCost > (x / b); - ClavaHLS.log(mainCost + " > (" + callFreq + "*" + funCost + ") / " + b + " -> " + res); - return res; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/MergeMetrics.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/MergeMetrics.java deleted file mode 100644 index fe88d8cc99..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/MergeMetrics.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.heuristics; - -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowSubgraphMetrics; - -public class MergeMetrics { - public static DataFlowSubgraphMetrics merge(DataFlowSubgraphMetrics... metrics) { - DataFlowSubgraphMetrics merged = new DataFlowSubgraphMetrics(null); - int nStores = 0; - int nLoads = 0; - int nOps = 0; - for (DataFlowSubgraphMetrics metricsObj : metrics) { - nStores += metricsObj.getNumArrayStores(); - nLoads += metricsObj.getNumArrayStores(); - nOps += metricsObj.getNumOp(); - } - merged.setNumArrayLoads(nLoads); - merged.setNumArrayStores(nStores); - merged.setNumOp(nOps); - return merged; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/PipelineHeuristic.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/PipelineHeuristic.java deleted file mode 100644 index f4d0d93845..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/PipelineHeuristic.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.heuristics; - -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowParam; -import pt.up.fe.specs.clava.hls.directives.HLSArrayPartition; -import pt.up.fe.specs.clava.hls.directives.HLSArrayPartition.PartitionType; - -/** - * Returns II number for pipeline directive - Integer.MAX_VALUE if II can't be - * determined, but pipelining is possible - 1..N if II is determined - 0 if - * pipelining is not possible - * - * @author Tiago - * - */ -public class PipelineHeuristic { - private static int limit = 1024 * 4; - public static int DEFAULT_FACTOR = 64; - - public static int calculate(DataFlowNode node) { - return Integer.MAX_VALUE; - } - - public static HLSArrayPartition partition(DataFlowParam p, int factor) { - int nElems = 1; - for (Integer i : p.getDim()) - nElems *= i; - - if (p.getDataTypeSize() * nElems <= limit) { - HLSArrayPartition dir = new HLSArrayPartition(PartitionType.COMPLETE, p.getName(), -1); - return dir; - } else { - HLSArrayPartition dir = new HLSArrayPartition(PartitionType.CYCLIC, p.getName(), factor); - return dir; - } - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/UnrollHeuristic.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/UnrollHeuristic.java deleted file mode 100644 index c1af1b98de..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/heuristics/UnrollHeuristic.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.heuristics; - -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; - -public class UnrollHeuristic { - public static final int UPPER_BOUND = 4; - - public static boolean calculate(DataFlowNode parent, DataFlowNode child) { - long pIter = parent.getIterations(); - long cIter = parent.getIterations(); - if (pIter < cIter) - return false; - if (pIter > cIter) { - return false; - } - if (pIter == cIter) { - return pIter < UPPER_BOUND; - } - return false; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/ArrayStreamDetector.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/ArrayStreamDetector.java deleted file mode 100644 index f87892bc2e..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/ArrayStreamDetector.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import java.util.ArrayList; -import java.util.HashMap; - -import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.analysis.flow.FlowEdge; -import pt.up.fe.specs.clava.analysis.flow.FlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowEdge; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowEdgeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowParam; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSStream; - -public class ArrayStreamDetector extends RestructuringStrategy { - private HashMap isStream = new HashMap<>(); - private final int OVERFLOW = 100000; - - public ArrayStreamDetector(DataFlowGraph dfg) { - super(dfg); - for (DataFlowParam param : dfg.getParams()) { - if (param.isArray()) - isStream.put(param.getName(), false); - } - - } - - @Override - public void analyze() { - for (String variable : isStream.keySet()) { - ArrayList loads = findLoads(variable); - if (loads.size() > 0) { - boolean detected = analyzeLoads(loads); - if (detected) - isStream.put(variable, true); - } - } - } - - private ArrayList findLoads(String variable) { - ArrayList nodes = new ArrayList<>(); - boolean invalid = false; - for (FlowNode n : dfg.getNodes()) { - DataFlowNode node = (DataFlowNode) n; - if (node.getLabel() == variable) { - if (DataFlowNodeType.isStore(node.getType())) { - invalid = true; - } - if (DataFlowNodeType.isLoad(node.getType())) { - nodes.add(node); - } - } - } - if (invalid) - nodes.clear(); - return nodes; - } - - private boolean analyzeLoads(ArrayList nodes) { - // TODO: edge case of more than one load - if (nodes.size() != 1) - return false; - DataFlowNode node = nodes.get(0); - - // undetermined iterations -> undetermined access pattern - if (node.getIterations() == Integer.MAX_VALUE) - return false; - - // Get indexes of access - ArrayList indexes = new ArrayList<>(); - for (FlowEdge e : node.getInEdges()) { - DataFlowEdge edge = (DataFlowEdge) e; - if (edge.getType() == DataFlowEdgeType.DATAFLOW_INDEX) { - DataFlowNode idx = (DataFlowNode) edge.getSource(); - if (idx.getType() == DataFlowNodeType.LOAD_INDEX) { - indexes.add(idx.getLabel()); - } else - return false; - } - } - if (indexes.size() == 0) - return false; - - // Check if each index matches the parent loops - // Collections.reverse(indexes); - for (int i = indexes.size() - 1; i >= 0; i--) { - int dist = getDistanceToLoop(indexes.get(i), node); - if (dist != i) - return false; - } - return true; - - } - - private int getDistanceToLoop(String idx, DataFlowNode node) { - DataFlowNode loop = DFGUtils.getLoopOfNode(node); - if (loop == node) - return OVERFLOW; - if (loop.getLabel().equals("loop " + idx)) - return 0; - else - return 1 + getDistanceToLoop(idx, loop); - } - - public int detectedCases() { - int count = 0; - for (boolean b : isStream.values()) { - count += b ? 1 : 0; - } - return count; - } - - @Override - public void apply() { - ClavaNode node = dfg.getFirstStmt(); - - for (String variable : isStream.keySet()) { - if (isStream.get(variable)) { - HLSStream directive = new HLSStream(variable); - insertDirective(node, directive); - DataFlowParam param = DFGUtils.getParamByName(dfg, variable); - param.setStream(true); - ClavaHLS.log("declaring parameter array \"" + variable + "\" as stream"); - } - } - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/CodeRegionPipelining.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/CodeRegionPipelining.java deleted file mode 100644 index 7d7c550a39..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/CodeRegionPipelining.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import java.util.HashMap; - -import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowParam; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSArrayPartition; -import pt.up.fe.specs.clava.hls.directives.HLSPipeline; -import pt.up.fe.specs.clava.hls.heuristics.PipelineHeuristic; - -public class CodeRegionPipelining extends RestructuringStrategy { - private HashMap toPipeline; - private HashMap unrolledLoops; - private boolean pipelineFunction = false; - private int factor; - - public CodeRegionPipelining(DataFlowGraph dfg, HashMap unrolledLoops, int factor) { - super(dfg); - toPipeline = new HashMap<>(); - this.unrolledLoops = unrolledLoops; - this.factor = factor; - } - - @Override - public void analyze() { - this.unrolledLoops.forEach((k, v) -> { - if (v == Integer.MAX_VALUE && toPipeline.get(k) == null) { - DataFlowNode loop = DFGUtils.getLoopOfLoop(k); - if (!loop.equals(k)) { - int II = PipelineHeuristic.calculate(loop); - if (II != 0) - toPipeline.put(loop, II); - } else { - if (DFGUtils.getTopLoopCount(dfg) == 1) { - // pipelineFunction = true; - } - } - } - }); - } - - @Override - public void apply() { - - if (pipelineFunction) { - HLSPipeline directive = new HLSPipeline(); - insertDirective(dfg.getFirstStmt(), directive); - ClavaHLS.log("pipelining the whole function"); - } else { - toPipeline.forEach((k, v) -> { - StringBuilder sb = new StringBuilder("pipelining body of loop \"").append(k.getLabel()) - .append("\" with "); - HLSPipeline directive = new HLSPipeline(); - if (v != Integer.MAX_VALUE) { - directive.setII(v); - sb.append("II = ").append(v); - } else - sb.append(" undetermined II"); - insertDirective(k.getStmt(), directive); - ClavaHLS.log(sb.toString()); - }); - } - ClavaNode firstStmt = dfg.getFirstStmt(); - for (DataFlowParam param : dfg.getParams()) { - if (param.isArray() && !param.isStream()) { - HLSArrayPartition dir = PipelineHeuristic.partition(param, factor); - this.insertDirective(firstStmt, dir); - } - } - } - -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/DataflowRegion.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/DataflowRegion.java deleted file mode 100644 index edda6b902b..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/DataflowRegion.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; - -public class DataflowRegion extends RestructuringStrategy { - - protected DataflowRegion(DataFlowGraph dfg) { - super(dfg); - } - - @Override - public void analyze() { - - } - - @Override - public void apply() { - // TODO Auto-generated method stub - - } - -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/FunctionInlining.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/FunctionInlining.java deleted file mode 100644 index 5307fdec55..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/FunctionInlining.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import java.util.ArrayList; -import java.util.HashMap; - -import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowSubgraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowSubgraphMetrics; -import pt.up.fe.specs.clava.ast.decl.FunctionDecl; -import pt.up.fe.specs.clava.ast.expr.CallExpr; -import pt.up.fe.specs.clava.ast.stmt.CompoundStmt; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSInline; -import pt.up.fe.specs.clava.hls.directives.HLSInline.InlineType; -import pt.up.fe.specs.clava.hls.heuristics.InlineHeuristic; - -public class FunctionInlining extends RestructuringStrategy { - private HashMap callFreq; - private HashMap functions; - private HashMap isFunctionInlinable; - private HashMap functionCosts; - private HashMap canInline; - private double B; - - public FunctionInlining(DataFlowGraph dfg, double B) { - super(dfg); - callFreq = new HashMap<>(); - functions = new HashMap<>(); - isFunctionInlinable = new HashMap<>(); - functionCosts = new HashMap<>(); - isFunctionInlinable = new HashMap<>(); - canInline = new HashMap<>(); - this.B = B; - } - - @Override - public void analyze() { - ArrayList calls = DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.OP_CALL); - - // Check if called functions are inlinable, and get their costs - long mainFunCost = analyzeFunction(dfg); - findDistinctFunctions(calls); - - // Remove calls to non-inlinable functions - isFunctionInlinable.forEach((k, v) -> { - if (!v) - calls.removeIf(n -> n.getLabel() == k); - }); - - // Check if each call is inlinable - estimateCallFrequencies(calls); - - for (String funName : functions.keySet()) { - Long freq = callFreq.get(funName); - Long cost = functionCosts.get(funName); - boolean inline = InlineHeuristic.calculate(freq, cost, mainFunCost, B); - canInline.put(funName, inline); - } - } - - private void findDistinctFunctions(ArrayList calls) { - for (DataFlowNode call : calls) { - String funName = call.getLabel(); - if (!functions.containsKey(funName)) { - DataFlowGraph dfg = getCallDfg(call); - if (dfg != null) { - functions.put(funName, dfg); - functionCosts.put(funName, analyzeFunction(funName)); - } else - isFunctionInlinable.put(call.getLabel(), false); - } - } - } - - private DataFlowGraph getCallDfg(DataFlowNode call) { - CallExpr callNode = (CallExpr) call.getClavaNode(); - if (!callNode.getDefinition().isPresent()) { - ClavaHLS.log("function defininion of \"" + call.getLabel() + "\" not found (cannot be inlined)"); - return null; - } - FunctionDecl fun = callNode.getDefinition().get(); - - if (!fun.getBody().isPresent()) { - ClavaHLS.log("function body of \"" + call.getLabel() + "\" not found (cannot be inlined)"); - return null; - } - CompoundStmt scope = fun.getBody().get(); - ClavaHLS.log("function body of \"" + call.getLabel() + "\" found (can be inlined)"); - DataFlowGraph funDFG = new DataFlowGraph(scope); - return funDFG; - } - - private void estimateCallFrequencies(ArrayList calls) { - for (DataFlowNode call : calls) { - String funName = call.getLabel(); - long freq = DFGUtils.estimateNodeFrequency(call); - if (callFreq.containsKey(funName)) { - if (callFreq.get(funName) < freq) - callFreq.put(funName, freq); - } else - callFreq.put(funName, freq); - } - } - - public long analyzeFunction(String fun) { - DataFlowGraph dfg = functions.get(fun); - return analyzeFunction(dfg); - } - - public long analyzeFunction(DataFlowGraph dfg) { - ArrayList metrics = new ArrayList<>(); - for (DataFlowNode root : dfg.getSubgraphRoots()) { - DataFlowSubgraph sub = dfg.getSubgraph(root); - DataFlowSubgraphMetrics m = sub.getMetrics(); - m.setIterations(DFGUtils.estimateNodeFrequency(root)); - metrics.add(m); - } - return DFGUtils.sumArrayLoads(metrics); - } - - @Override - public void apply() { - canInline.forEach((funName, canInline) -> { - if (canInline) { - HLSInline pragma = new HLSInline(InlineType.NONE); - ClavaNode astNode = functions.get(funName).getFirstStmt(); - insertDirective(astNode, pragma); - ClavaHLS.log("inlining function \"" + funName + "\""); - } else - ClavaHLS.log("function \"" + funName + "\" is not fit to be inlined"); - }); - } - -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/LoadStores.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/LoadStores.java deleted file mode 100644 index 61b08517be..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/LoadStores.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowParam; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSArrayPartition; -import pt.up.fe.specs.clava.hls.directives.HLSArrayPartition.PartitionType; -import pt.up.fe.specs.clava.hls.directives.HLSPipeline; -import pt.up.fe.specs.clava.hls.directives.HLSUnroll; - -public class LoadStores extends RestructuringStrategy { - private boolean isSimpleLoop = false; - private int lsFactor; - public static int DEFAULT_LS = 32; - - public LoadStores(DataFlowGraph dfg, int lsFactor) { - super(dfg); - this.lsFactor = lsFactor; - } - - @Override - public void analyze() { - ClavaHLS.log("checking if the function is a simple loop..."); - this.isSimpleLoop = false; - if (DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.LOOP).size() != 1) { - return; - } - DataFlowNode loop = DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.LOOP).get(0); - if (loop.getOutNodes().size() != 1) { - return; - } - this.isSimpleLoop = true; - } - - @Override - public void apply() { - if (isSimpleLoop) { - ClavaNode loopNode = DFGUtils.getAllNodesOfType(dfg, DataFlowNodeType.LOOP).get(0).getClavaNode(); - ClavaNode funNode = dfg.getFirstStmt(); - - // Partitioning arrays - for (DataFlowParam p : dfg.getParams()) { - if (p.isArray()) { - var part = new HLSArrayPartition(PartitionType.CYCLIC, p.getName(), lsFactor); - insertDirective(funNode, part); - } - } - - // Unroll loop - HLSUnroll unroll = new HLSUnroll(); - unroll.setFactor(lsFactor); - insertDirective(loopNode, unroll); - - // Pipeline loop - HLSPipeline pip = new HLSPipeline(); - insertDirective(loopNode, pip); - } - } - - public int getLsFactor() { - return lsFactor; - } - - public void setLsFactor(int lsFactor) { - this.lsFactor = lsFactor; - } - - public boolean isSimpleLoop() { - return isSimpleLoop; - } - - public void setSimpleLoop(boolean isSimpleLoop) { - this.isSimpleLoop = isSimpleLoop; - } - -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/NestedLoopUnrolling.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/NestedLoopUnrolling.java deleted file mode 100644 index d524c51c6a..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/NestedLoopUnrolling.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Stack; - -import pt.up.fe.specs.clava.analysis.flow.FlowEdge; -import pt.up.fe.specs.clava.analysis.flow.FlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DFGUtils; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowEdge; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowEdgeType; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNode; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowNodeType; -import pt.up.fe.specs.clava.ast.stmt.Stmt; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSUnroll; -import pt.up.fe.specs.clava.hls.heuristics.UnrollHeuristic; - -public class NestedLoopUnrolling extends RestructuringStrategy { - private HashMap loopsToUnroll = new HashMap<>(); - - public NestedLoopUnrolling(DataFlowGraph dfg) { - super(dfg); - - } - - @Override - public void analyze() { - ArrayList masterLoops = findMasterLoops(); - for (DataFlowNode masterLoop : masterLoops) { - ArrayList bottomLoops = getBottomLoops(masterLoop); - for (DataFlowNode bottomLoop : bottomLoops) { - ClavaHLS.log("trying to unroll loop nest starting by bottom loop \"" + bottomLoop.getLabel() - + "\" (trip count = " + bottomLoop.getIterations() + ")"); - evaluateLoopNest(bottomLoop); - } - } - } - - private void evaluateLoopNest(DataFlowNode loop) { - this.loopsToUnroll.put(loop, Integer.MAX_VALUE); - DataFlowNode parent = DFGUtils.getLoopOfLoop(loop); - while (parent != loop) { - if (UnrollHeuristic.calculate(parent, loop)) { - this.loopsToUnroll.put(parent, Integer.MAX_VALUE); - loop = parent; - parent = DFGUtils.getLoopOfLoop(loop); - } else - return; - } - } - - @Override - public void apply() { - ClavaHLS.log("unrolling " + loopsToUnroll.size() + " loops"); - for (DataFlowNode node : loopsToUnroll.keySet()) { - int factor = loopsToUnroll.get(node); - Stmt stmt = node.getStmt(); - HLSUnroll directive = new HLSUnroll(); - StringBuilder sb = new StringBuilder("unrolling \""); - sb.append(node.getLabel()).append("\" (trip count = ").append(node.getIterations()).append(") "); - - if (factor != Integer.MAX_VALUE) { - directive.setFactor(factor); - sb.append("with factor = ").append(factor); - } else { - sb.append("fully"); - } - insertDirective(stmt, directive); - ClavaHLS.log(sb.toString()); - } - } - - private ArrayList findMasterLoops() { - ArrayList loops = new ArrayList<>(); - for (FlowNode n : dfg.getNodes()) { - DataFlowNode node = (DataFlowNode) n; - if (node.getType() == DataFlowNodeType.LOOP) { - boolean isNested = false; - for (FlowEdge e : node.getInEdges()) { - DataFlowEdge edge = (DataFlowEdge) e; - if (edge.repeating > 0) - isNested = true; - } - if (!isNested) { - loops.add(node); - StringBuilder sb = new StringBuilder(); - sb.append("found master loop \"").append(node.getLabel()).append("\""); - if (node.getIterations() != Integer.MAX_VALUE) { - sb.append(" (trip count = ").append(node.getIterations()).append(")"); - } else - sb.append(" (undetermined trip count)"); - ClavaHLS.log(sb.toString()); - } - } - } - return loops; - } - - private ArrayList getBottomLoops(DataFlowNode masterLoop) { - ArrayList loops = new ArrayList<>(); - Stack nodes = new Stack<>(); - nodes.add(masterLoop); - while (!nodes.isEmpty()) { - DataFlowNode node = nodes.pop(); - int cnt = 0; - for (FlowEdge e : node.getOutEdges()) { - DataFlowEdge edge = (DataFlowEdge) e; - if (edge.getType() == DataFlowEdgeType.REPEATING) { - if (((DataFlowNode) edge.getDest()).getType() == DataFlowNodeType.LOOP) { - cnt++; - nodes.add((DataFlowNode) edge.getDest()); - } - } - } - if (cnt == 0) - loops.add(node); - } - return loops; - } - - public HashMap getLoopsToUnroll() { - return loopsToUnroll; - } -} diff --git a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/RestructuringStrategy.java b/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/RestructuringStrategy.java deleted file mode 100644 index 1703125349..0000000000 --- a/ClavaHls/src/pt/up/fe/specs/clava/hls/strategies/RestructuringStrategy.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.hls.strategies; - -import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.ClavaNodes; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.directives.HLSDirective; -import pt.up.fe.specs.clava.utils.NodePosition; - -public abstract class RestructuringStrategy { - protected DataFlowGraph dfg; - - protected RestructuringStrategy(DataFlowGraph dfg) { - this.dfg = dfg; - } - - public void insertDirective(ClavaNode node, HLSDirective directive) { - try { - ClavaNodes.insertAsStmt(node, directive.toString(), NodePosition.BEFORE); - } catch (NullPointerException e) { - ClavaHLS.log("error - could not insert directive \"" + directive.toString() + "\""); - } - } - - public abstract void analyze(); - - public abstract void apply(); -} diff --git a/ClavaLaraApi/.classpath b/ClavaLaraApi/.classpath deleted file mode 100644 index 967c335a4f..0000000000 --- a/ClavaLaraApi/.classpath +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ClavaLaraApi/.project b/ClavaLaraApi/.project deleted file mode 100644 index 7c5c6ded28..0000000000 --- a/ClavaLaraApi/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - ClavaLaraApi - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598980 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaLaraApi/.settings/org.eclipse.jdt.core.prefs b/ClavaLaraApi/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f6c5ea36f6..0000000000 --- a/ClavaLaraApi/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled diff --git a/ClavaLaraApi/build.gradle b/ClavaLaraApi/build.gradle index bd754b0211..72aa192167 100644 --- a/ClavaLaraApi/build.gradle +++ b/ClavaLaraApi/build.gradle @@ -1,52 +1,29 @@ plugins { - id 'distribution' + id 'distribution' + id 'java' } -// Java project -apply plugin: 'java' - java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } - // Repositories providers repositories { mavenCentral() } dependencies { - testImplementation "junit:junit:4.13.1" - - implementation ':SpecsUtils' - implementation ':CommonsLangPlus' - implementation ':JacksonPlus' implementation ':SymjaPlus' - implementation ':LaraApi' - implementation ':LaraUtils' - implementation ':ClavaAst' - - implementation group: 'com.google.code.gson', name: 'gson', version: '2.4' } -java { - withSourcesJar() -} - - // Project sources sourceSets { - main { - java { - srcDir 'src-java' - } - - resources { - srcDir 'src-lara' - srcDir 'src-lara-clava' - srcDir 'src-js' - } - - } + main { + java { + srcDir 'src-java' + } + } } diff --git a/ClavaLaraApi/ivy.xml b/ClavaLaraApi/ivy.xml deleted file mode 100644 index ea90ebd2cf..0000000000 --- a/ClavaLaraApi/ivy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/ClavaLaraApi/settings.gradle b/ClavaLaraApi/settings.gradle index af680875a7..df58ad75a3 100644 --- a/ClavaLaraApi/settings.gradle +++ b/ClavaLaraApi/settings.gradle @@ -1,11 +1,6 @@ rootProject.name = 'ClavaLaraApi' -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/JacksonPlus") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/SymjaPlus") +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' +def laraFrameworkRoot = System.getenv('LARA_FRAMEWORK_HOME') ?: '../../lara-framework' -includeBuild("../../lara-framework/LaraApi") -includeBuild("../../lara-framework/LaraUtils") - -includeBuild("../../clava/ClavaAst") \ No newline at end of file +includeBuild("${specsJavaLibsRoot}/SymjaPlus") diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiJsResource.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiJsResource.java deleted file mode 100644 index 72d7f7073c..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiJsResource.java +++ /dev/null @@ -1,178 +0,0 @@ - -/** - * Copyright 2025 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -/** - * This file has been automatically generated. - * - * @author Joao Bispo, Luis Sousa - * - */ -public enum ClavaApiJsResource implements LaraResourceProvider { - - JOINPOINTS_JS("Joinpoints.js"), - CLAVA_JS("clava/Clava.js"), - CLAVACODE_JS("clava/ClavaCode.js"), - CLAVAJAVATYPES_JS("clava/ClavaJavaTypes.js"), - CLAVAJOINPOINTS_JS("clava/ClavaJoinPoints.js"), - CLAVATYPE_JS("clava/ClavaType.js"), - FORMAT_JS("clava/Format.js"), - MATHEXTRA_JS("clava/MathExtra.js"), - ANALYSER_JS("clava/analysis/Analyser.js"), - ANALYSERRESULT_JS("clava/analysis/AnalyserResult.js"), - CHECKBASEDANALYSER_JS("clava/analysis/CheckBasedAnalyser.js"), - CHECKRESULT_JS("clava/analysis/CheckResult.js"), - CHECKER_JS("clava/analysis/Checker.js"), - FIX_JS("clava/analysis/Fix.js"), - MESSAGEGENERATOR_JS("clava/analysis/MessageGenerator.js"), - RESULTFORMATMANAGER_JS("clava/analysis/ResultFormatManager.js"), - RESULTLIST_JS("clava/analysis/ResultList.js"), - BOUNDSANALYSER_JS("clava/analysis/analysers/BoundsAnalyser.js"), - BOUNDSRESULT_JS("clava/analysis/analysers/BoundsResult.js"), - DOUBLEFREEANALYSER_JS("clava/analysis/analysers/DoubleFreeAnalyser.js"), - DOUBLEFREERESULT_JS("clava/analysis/analysers/DoubleFreeResult.js"), - CHGRPCHECKER_JS("clava/analysis/checkers/ChgrpChecker.js"), - CHMODCHECKER_JS("clava/analysis/checkers/ChmodChecker.js"), - CHOWNCHECKER_JS("clava/analysis/checkers/ChownChecker.js"), - CINCHECKER_JS("clava/analysis/checkers/CinChecker.js"), - EXECCHECKER_JS("clava/analysis/checkers/ExecChecker.js"), - FPRINTFCHECKER_JS("clava/analysis/checkers/FprintfChecker.js"), - FSCANFCHECKER_JS("clava/analysis/checkers/FscanfChecker.js"), - GETSCHECKER_JS("clava/analysis/checkers/GetsChecker.js"), - LAMBDACHECKER_JS("clava/analysis/checkers/LambdaChecker.js"), - MEMCPYCHECKER_JS("clava/analysis/checkers/MemcpyChecker.js"), - PRINTFCHECKER_JS("clava/analysis/checkers/PrintfChecker.js"), - SCANFCHECKER_JS("clava/analysis/checkers/ScanfChecker.js"), - SPRINTFCHECKER_JS("clava/analysis/checkers/SprintfChecker.js"), - STRCATCHECKER_JS("clava/analysis/checkers/StrcatChecker.js"), - STRCPYCHECKER_JS("clava/analysis/checkers/StrcpyChecker.js"), - SYSLOGCHECKER_JS("clava/analysis/checkers/SyslogChecker.js"), - SYSTEMCHECKER_JS("clava/analysis/checkers/SystemChecker.js"), - CMAKER_JS("clava/cmake/CMaker.js"), - CMAKERSOURCES_JS("clava/cmake/CMakerSources.js"), - CMAKERUTILS_JS("clava/cmake/CMakerUtils.js"), - CMAKECOMPILER_JS("clava/cmake/compilers/CMakeCompiler.js"), - GENERICCMAKECOMPILER_JS("clava/cmake/compilers/GenericCMakeCompiler.js"), - DECOMPOSERESULT_JS("clava/code/DecomposeResult.js"), - DOTOWHILESTMT_JS("clava/code/DoToWhileStmt.js"), - FORTOWHILESTMT_JS("clava/code/ForToWhileStmt.js"), - GLOBALVARIABLE_JS("clava/code/GlobalVariable.js"), - INLINER_JS("clava/code/Inliner.js"), - OUTLINER_JS("clava/code/Outliner.js"), - REMOVESHADOWING_JS("clava/code/RemoveShadowing.js"), - SIMPLIFYASSIGNMENT_JS("clava/code/SimplifyAssignment.js"), - SIMPLIFYTERNARYOP_JS("clava/code/SimplifyTernaryOp.js"), - STATEMENTDECOMPOSER_JS("clava/code/StatementDecomposer.js"), - GPROFER_JS("clava/gprofer/Gprofer.js"), - CONTROLFLOWGRAPH_JS("clava/graphs/ControlFlowGraph.js"), - STATICCALLGRAPH_JS("clava/graphs/StaticCallGraph.js"), - CFGBUILDER_JS("clava/graphs/cfg/CfgBuilder.js"), - CFGEDGE_JS("clava/graphs/cfg/CfgEdge.js"), - CFGEDGETYPE_JS("clava/graphs/cfg/CfgEdgeType.js"), - CFGNODEDATA_JS("clava/graphs/cfg/CfgNodeData.js"), - CFGNODETYPE_JS("clava/graphs/cfg/CfgNodeType.js"), - CFGUTILS_JS("clava/graphs/cfg/CfgUtils.js"), - NEXTCFGNODE_JS("clava/graphs/cfg/NextCfgNode.js"), - CASEDATA_JS("clava/graphs/cfg/nodedata/CaseData.js"), - DATAFACTORY_JS("clava/graphs/cfg/nodedata/DataFactory.js"), - GOTODATA_JS("clava/graphs/cfg/nodedata/GotoData.js"), - HEADERDATA_JS("clava/graphs/cfg/nodedata/HeaderData.js"), - IFDATA_JS("clava/graphs/cfg/nodedata/IfData.js"), - INSTLISTNODEDATA_JS("clava/graphs/cfg/nodedata/InstListNodeData.js"), - LABELDATA_JS("clava/graphs/cfg/nodedata/LabelData.js"), - LOOPDATA_JS("clava/graphs/cfg/nodedata/LoopData.js"), - RETURNDATA_JS("clava/graphs/cfg/nodedata/ReturnData.js"), - SCOPENODEDATA_JS("clava/graphs/cfg/nodedata/ScopeNodeData.js"), - SWITCHDATA_JS("clava/graphs/cfg/nodedata/SwitchData.js"), - SCGEDGEDATA_JS("clava/graphs/scg/ScgEdgeData.js"), - SCGNODEDATA_JS("clava/graphs/scg/ScgNodeData.js"), - STATICCALLGRAPHBUILDER_JS("clava/graphs/scg/StaticCallGraphBuilder.js"), - HDF5_JS("clava/hdf5/Hdf5.js"), - HLSANALYSIS_JS("clava/hls/HLSAnalysis.js"), - MATHANALYSIS_JS("clava/hls/MathAnalysis.js"), - MATHHINFO_JS("clava/hls/MathHInfo.js"), - TRACEINSTRUMENTATION_JS("clava/hls/TraceInstrumentation.js"), - LIVENESSANALYSER_JS("clava/liveness/LivenessAnalyser.js"), - LIVENESSANALYSIS_JS("clava/liveness/LivenessAnalysis.js"), - LIVENESSUTILS_JS("clava/liveness/LivenessUtils.js"), - MEMOIANALYSIS_JS("clava/memoi/MemoiAnalysis.js"), - MEMOIGEN_JS("clava/memoi/MemoiGen.js"), - MEMOIPROF_JS("clava/memoi/MemoiProf.js"), - MEMOITARGET_JS("clava/memoi/MemoiTarget.js"), - MEMOIUTILS_JS("clava/memoi/MemoiUtils.js"), - _MEMOIGENHELPER_JS("clava/memoi/_MemoiGenHelper.js"), - MPIACCESSPATTERN_JS("clava/mpi/MpiAccessPattern.js"), - MPISCATTERGATHERLOOP_JS("clava/mpi/MpiScatterGatherLoop.js"), - MPIUTILS_JS("clava/mpi/MpiUtils.js"), - ITERATIONVARIABLEPATTERN_JS("clava/mpi/patterns/IterationVariablePattern.js"), - MPIACCESSPATTERNS_JS("clava/mpi/patterns/MpiAccessPatterns.js"), - SCALARPATTERN_JS("clava/mpi/patterns/ScalarPattern.js"), - KERNELREPLACER_JS("clava/opencl/KernelReplacer.js"), - KERNELREPLACERAUTO_JS("clava/opencl/KernelReplacerAuto.js"), - OPENCLCALL_JS("clava/opencl/OpenCLCall.js"), - OPENCLCALLVARIABLES_JS("clava/opencl/OpenCLCallVariables.js"), - INLINING_JS("clava/opt/Inlining.js"), - NORMALIZETOSUBSET_JS("clava/opt/NormalizeToSubset.js"), - PREPAREFORINLINING_JS("clava/opt/PrepareForInlining.js"), - BATCHPARSER_JS("clava/parser/BatchParser.js"), - DECOMPOSEDECLSTMT_JS("clava/pass/DecomposeDeclStmt.js"), - DECOMPOSEVARDECLARATIONS_JS("clava/pass/DecomposeVarDeclarations.js"), - LOCALSTATICTOGLOBAL_JS("clava/pass/LocalStaticToGlobal.js"), - SIMPLIFYLOOPS_JS("clava/pass/SimplifyLoops.js"), - SIMPLIFYRETURNSTMTS_JS("clava/pass/SimplifyReturnStmts.js"), - SIMPLIFYSELECTIONSTMTS_JS("clava/pass/SimplifySelectionStmts.js"), - SINGLERETURNFUNCTION_JS("clava/pass/SingleReturnFunction.js"), - TRANSFORMSWITCHTOIF_JS("clava/pass/TransformSwitchToIf.js"), - OPSBLOCK_JS("clava/stats/OpsBlock.js"), - OPSCOST_JS("clava/stats/OpsCost.js"), - OPSCOUNTER_JS("clava/stats/OpsCounter.js"), - STATICOPSCOUNTER_JS("clava/stats/StaticOpsCounter.js"), - CLAVADATASTORE_JS("clava/util/ClavaDataStore.js"), - CODEINSERTER_JS("clava/util/CodeInserter.js"), - FILEITERATOR_JS("clava/util/FileIterator.js"), - VITISHLS_JS("clava/vitishls/VitisHls.js"), - VITISHLSREPORTPARSER_JS("clava/vitishls/VitisHlsReportParser.js"), - VITISHLSUTILS_JS("clava/vitishls/VitisHlsUtils.js"), - CORE_JS("core.js"), - CLAVABENCHMARKINSTANCE_JS("lara/benchmark/ClavaBenchmarkInstance.js"), - ENERGY_JS("lara/code/Energy.js"), - LOGGER_JS("lara/code/Logger.js"), - TIMER_JS("lara/code/Timer.js"), - ENERGYMETRIC_JS("lara/metrics/EnergyMetric.js"), - EXECUTIONTIMEMETRIC_JS("lara/metrics/ExecutionTimeMetric.js"), - WEAVERLAUNCHER_JS("weaver/WeaverLauncher.js"); - - private final String resource; - - private static final String WEAVER_PACKAGE = "clava/"; - - /** - * @param resource - */ - private ClavaApiJsResource (String resource) { - this.resource = WEAVER_PACKAGE + getSeparatorChar() + resource; - } - - /* (non-Javadoc) - * @see org.suikasoft.SharedLibrary.Interfaces.ResourceProvider#getResource() - */ - @Override - public String getOriginalResource() { - return resource; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiWebResource.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiWebResource.java deleted file mode 100644 index 77f78cfe6d..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaApiWebResource.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import pt.up.fe.specs.util.providers.WebResourceProvider; - -public interface ClavaApiWebResource { - - static WebResourceProvider create(String resourceUrl, String version) { - return WebResourceProvider.newInstance("https://specs.fe.up.pt/resources/clava_api/", resourceUrl, version); - } - - static WebResourceProvider create(String resourceUrl) { - return WebResourceProvider.newInstance("https://specs.fe.up.pt/resources/clava_api/", resourceUrl); - } - - WebResourceProvider PETIT_UBUNTU = create("linux_ubuntu_14/petit"); - WebResourceProvider PETIT_CENTOS6 = create("centos6/petit"); -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaLaraApis.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaLaraApis.java deleted file mode 100644 index 9b980f936c..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/ClavaLaraApis.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import java.util.List; - -import pt.up.fe.specs.util.providers.ResourceProvider; - -public class ClavaLaraApis { - - private static final List CLAVA_LARA_API = ResourceProvider - .getResourcesFromEnum(LaraWeaverApiResource.class, LaraApiResource.class); - - // .getResourcesFromEnum(ClavaApiJsResource.class, LaraWeaverApiResource.class, LaraApiResource.class); - public static List getApis() { - return CLAVA_LARA_API; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/JsApiResource.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/JsApiResource.java deleted file mode 100644 index c778ffa07b..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/JsApiResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import pt.up.fe.specs.util.providers.ResourceProvider; - -public enum JsApiResource implements ResourceProvider { - - // AUTOPAR - AUTOPAR_1("autopar/Add_msgError.js"), - AUTOPAR_2("autopar/allReplace.js"), - AUTOPAR_3("autopar/GetLoopIndex.js"), - AUTOPAR_4("autopar/orderedVarrefs3.js"), - // AUTOPAR_5("autopar/print_obj.js"), - AUTOPAR_6("autopar/RemoveStruct.js"), - AUTOPAR_7("autopar/SafeFunctionCalls.js"), - AUTOPAR_8("autopar/SearchStruct.js"); - - // OTHER - - //DATA_HANDLER("DataHandler.js"), - //HDF5("HDF5.js"), - //TYPES("Types.js"); - - private final static String BASE_PACKAGE = "clava/js/"; - - private final String resource; - - private JsApiResource(String resource) { - this.resource = BASE_PACKAGE + resource; - } - - @Override - public String getResource() { - return resource; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraApiResource.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraApiResource.java deleted file mode 100644 index 3c62c94d58..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraApiResource.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2013 SuikaSoft. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -/** - * @author Joao Bispo - * - */ -public enum LaraApiResource implements LaraResourceProvider { - - // AUTOPAR - ADDITIONAL_CONDITIONS_CHECK("autopar/additionalConditionsCheck.lara"), - ADD_OPENMP_DIRECTIVES("autopar/AddOpenMPDirectivesForLoop.lara"), - ADD_PRAGMA_LOOP_INDEX("autopar/AddPragmaLoopIndex.lara"), - AUTOPAR_STATS("autopar/AutoParStats.lara"), - AUTOPAR_UTILS("autopar/AutoParUtils.lara"), - AUTOPAR_1("autopar/BuildPetitFileInput.lara"), - AUTOPAR_2("autopar/checkForFunctionCalls.lara"), - AUTOPAR_3("autopar/checkForInvalidStmts.lara"), - AUTOPAR_4("autopar/checkForOpenMPCanonicalForm.lara"), - AUTOPAR_4_1("autopar/CheckForSafeFunctionCall.lara"), - AUTOPAR_5("autopar/checkvarreReduction.lara"), - AUTOPAR_6("autopar/ExecPetitDependencyTest.lara"), - AUTOPAR_7("autopar/FindReductionArrays.lara"), - AUTOPAR_8("autopar/get_varTypeAccess.lara"), - AUTOPAR_9("autopar/InlineFunctionCalls.lara"), - AUTOPAR_9_1("autopar/LoopInductionVariables.lara"), - AUTOPAR_10("autopar/NormalizedBinaryOp.lara"), - AUTOPAR_10_1("autopar/OmegaConfig.lara"), - AUTOPAR_17("autopar/Parallelize.lara"), - AUTOPAR_11("autopar/ParallelizeLoop.lara"), - AUTOPAR_12("autopar/RemoveNakedloops.lara"), - AUTOPAR_12_1("autopar/RemoveOpenMPfromInnerloop.lara"), - AUTOPAR_12_2("autopar/RunInlineFunctionCalls.lara"), - AUTOPAR_13("autopar/SetArrayAccessOpenMPscoping.lara"), - AUTOPAR_14("autopar/SetMemberAccessOpenMPscoping.lara"), - AUTOPAR_15("autopar/SetVariableAccess.lara"), - AUTOPAR_16("autopar/SetVarrefOpenMPscoping.lara"); - - private final String resource; - - private static final String WEAVER_PACKAGE = "clava/"; - private static final String BASE_PACKAGE = "clava/"; - - /** - * @param resource - */ - private LaraApiResource(String resource) { - this.resource = WEAVER_PACKAGE + getSeparatorChar() + BASE_PACKAGE + resource; - } - - /* - * (non-Javadoc) - * - * @see org.suikasoft.SharedLibrary.Interfaces.ResourceProvider#getResource() - */ - @Override - public String getOriginalResource() { - return resource; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraWeaverApiResource.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraWeaverApiResource.java deleted file mode 100644 index 9d70dbbf91..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/LaraWeaverApiResource.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2013 SuikaSoft. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import org.lara.interpreter.weaver.utils.LaraResourceProvider; - -/** - * @author Joao Bispo - * - */ -public enum LaraWeaverApiResource implements LaraResourceProvider { - CLAVA_ELSE_JP("jp/ClavaElseJp.lara"), - CLAVA_FILE_JP("jp/ClavaFileJp.lara"), - CLAVA_LOOP_JP("jp/ClavaLoopJp.lara"), - CLAVA_IF_JP("jp/ClavaIfJp.lara"), - CLAVA_BINARY_JP("jp/ClavaBinaryJp.lara"), - CLAVA_CONSTRUCTOR_CALL_JP("jp/ClavaConstructorCallJp.lara"), - CLAVA_CONSTRUCTOR_JP("jp/ClavaConstructorJp.lara"), - CLAVA_PARAM_JP("jp/ClavaParamJp.lara"), - CLAVA_VAR_REF_JP("jp/ClavaVarRefJp.lara"), - CLAVA_VAR_DECL_JP("jp/ClavaVarDeclJp.lara"), - CLAVA_DECL_JP("jp/ClavaDeclJp.lara"), - CLAVA_TYPE_JP("jp/ClavaTypeJp.lara"), - CLAVA_FIELD_REF_JP("jp/ClavaFieldRefJp.lara"), - CLAVA_FIELD_JP("jp/ClavaFieldJp.lara"), - CLAVA_MEMBER_CALL_JP("jp/ClavaMemberCallJp.lara"), - CLAVA_CALL_JP("jp/ClavaCallJp.lara"), - CLAVA_FUNCTION_JP("jp/ClavaFunctionJp.js"), - CLAVA_METHOD_JP("jp/ClavaMethodJp.lara"), - CLAVA_CLASS_JP("jp/ClavaClassJp.lara"), - CLAVA_CLASS_TYPE_JP("jp/ClavaClassTypeJp.lara"), - CLAVA_INTERFACE_JP("jp/ClavaInterfaceJp.lara"), - CLAVA_JOIN_POINT("jp/ClavaJoinPoint.lara"), - COMMON_JOIN_POINTS("jp/CommonJoinPoints.lara"); - //JOIN_POINTS("JoinPoints.lara"), - //WEAVER_LAUNCHER("WeaverLauncher.lara"); - - private final String resource; - - private static final String WEAVER_PACKAGE = "clava/"; - private static final String BASE_PACKAGE = "weaver/"; - - /** - * @param resource - */ - private LaraWeaverApiResource(String resource) { - this.resource = WEAVER_PACKAGE + getSeparatorChar() + BASE_PACKAGE + resource; - } - - /* (non-Javadoc) - * @see org.suikasoft.SharedLibrary.Interfaces.ResourceProvider#getResource() - */ - @Override - public String getOriginalResource() { - return resource; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DirectMappedTable.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DirectMappedTable.java deleted file mode 100644 index 26bdcae2ce..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DirectMappedTable.java +++ /dev/null @@ -1,438 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi; - -import java.io.File; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.function.Predicate; - -import pt.up.fe.specs.JacksonPlus.SpecsJackson; -import pt.up.fe.specs.clava.weaver.memoi.comparator.MeanComparator; -import pt.up.fe.specs.clava.weaver.memoi.policy.apply.SimplePolicies; -import pt.up.fe.specs.clava.weaver.memoi.policy.insert.AlwaysInsert; -import pt.up.fe.specs.util.SpecsCheck; - -public class DirectMappedTable implements java.io.Serializable { - - private static final long serialVersionUID = 3951666310732380835L; - - private static final List ALLOWED_SIZES = Arrays.asList(256, 512, 1024, 2048, 4096, 8192, 16384, 32768, - 65536); - private static final int BASE = 16; - private static final int KEY_STRING_LENGTH = 16; - private MergedMemoiReport report; - private int indexBits; - private int numSets; - private Predicate insertPred; - private Comparator countComparator; - - private Map table; - int totalCollisions; - int totalElements; - int maxCollision; - - private boolean debug; - - private DmtStats stats; - - private Predicate applyPolicy; - - /** - * Defaults to using {@link AlwaysInsert}, {@link MeanComparator}, and {@link ApplyIfNotEmpty}. - * - * @param report - * @param numSets - */ - public DirectMappedTable(MergedMemoiReport report, int numSets) { - - this(report, numSets, new AlwaysInsert(), new MeanComparator(report), SimplePolicies.NOT_EMPTY); - } - - /** - * Defaults to using {@link MeanComparator} and {@link ApplyIfNotEmpty}. - * - * @param report - * @param numSets - * @param insertPred - * @return - */ - public static DirectMappedTable fromInsertPredicate(MergedMemoiReport report, int numSets, - Predicate insertPred) { - - return new DirectMappedTable(report, numSets, insertPred, new MeanComparator(report), SimplePolicies.NOT_EMPTY); - } - - /** - * Defaults to using {@link AlwaysInsert} and {@link ApplyIfNotEmpty}. - * - * @param report - * @param numSets - * @param countComparator - * @return - */ - public static DirectMappedTable fromCountComparator(MergedMemoiReport report, int numSets, - Comparator countComparator) { - - return new DirectMappedTable(report, numSets, new AlwaysInsert(), countComparator, SimplePolicies.NOT_EMPTY); - } - - /** - * Defaults to using {@link AlwaysInsert} and {@link MeanComparator}. - * - * @param report - * @param numSets - * @param applyPolicy - * @return - */ - public static DirectMappedTable fromApplyPolicy(MergedMemoiReport report, int numSets, - Predicate applyPolicy) { - - return new DirectMappedTable(report, numSets, new AlwaysInsert(), new MeanComparator(report), - applyPolicy); - } - - /** - * Full constructor. - * - * @param report - * @param numSets - * @param insertPred - * @param countComparator - * @param applyPolicy - */ - public DirectMappedTable(MergedMemoiReport report, int numSets, - Predicate insertPred, - Comparator countComparator, - Predicate applyPolicy) { - - int maxSize = ALLOWED_SIZES.get(ALLOWED_SIZES.size() - 1); - - SpecsCheck.checkArgument(numSets <= maxSize, () -> "TableGenerator: tableSize > " + maxSize); - SpecsCheck.checkArgument(ALLOWED_SIZES.contains(numSets), - () -> "TableGenerator: tableSize not allowed, choose one of " + ALLOWED_SIZES); - - this.report = report; - this.indexBits = (int) MemoiUtils.log2(numSets); - this.insertPred = insertPred; - this.countComparator = countComparator; - this.applyPolicy = applyPolicy; - this.numSets = numSets; - - this.debug = false; - - this.table = generateTable(); - this.stats = new DmtStats(this); - System.out.println(this.stats); - } - - public void setDebug() { - setDebug(true); - } - - public void setDebug(boolean debug) { - this.debug = debug; - } - - public boolean isDebug() { - return debug; - } - - public Map getTable() { - - return table; - } - - private HashMap generateTable() { - - var table = new HashMap(); - - List counts = report.getSortedCounts(countComparator.reversed()); - - for (var count : counts) { - - if (!insertPred.test(count)) { - continue; - } - - String combinedKey = makeHashKey(count); - - String hash = hash(combinedKey); - - if (!table.containsKey(hash)) { - - table.put(hash, count); - } else { - - // collisions in this position - table.get(hash).incCollisions(); - - int thisCollisions = table.get(hash).getCollisions(); - if (thisCollisions > maxCollision) { - maxCollision = thisCollisions; - } - - // overall collisions - totalCollisions++; - - continue; - } - } - - totalElements = (int) MemoiUtils.mean(report.getElements(), report.getReportCount()); - - return table; - } - - public void printTableReport() { - - int reportCount = report.getReportCount(); - - int tableElements = table.size(); - - double tableCalls = table.values().parallelStream() - .map(MergedMemoiEntry::getCounter) - .map(l -> MemoiUtils.mean(l, reportCount)) - .reduce(0.0, Double::sum); - - double capacity = 100.0 * table.size() / numSets; - double totalCalls = MemoiUtils.mean(report.getCalls(), reportCount); - double collisionPercentage = 100.0 * totalCollisions / totalElements; - double elementCoverage = 100.0 * tableElements / totalElements; - double callCoverage = 100.0 * tableCalls / totalCalls; - - Locale l = null; - System.out.println("\n\n=== table stats ==="); - System.out.println("table capacity: " + table.size() + "/" + numSets + " (" - + String.format(l, "%.2f", capacity) + "%)"); - System.out.println("collisions: " + totalCollisions + "/" + totalElements + " (" - + String.format(l, "%.2f", collisionPercentage) + "%)"); - System.out.println("largest collision: " + maxCollision); - System.out.println("element coverage: " + tableElements + "/" + totalElements + " (" - + String.format(l, "%.2f", elementCoverage) + "%)"); - System.out.println( - "call coverage: " + tableCalls + "/" + totalCalls + " (" + String.format(l, "%.2f", callCoverage) - + "%)"); - } - - // private void printTable(HashMap table) { - // - // table.forEach((k, v) -> { - // - // StringBuilder b = new StringBuilder(); - // - // for (String key : v.getKey().split("#")) { - // - // b.append("0x"); - // b.append(key); - // b.append(", "); - // } - // - // b.append("0x"); - // b.append(v.getOutput()); - // - // System.out.println(b); - // }); - // } - - private String hash(String key64bits) { - - int varBits = 64; - - double iters = MemoiUtils.log2(varBits / indexBits); - int intIters = (int) iters; - - String hash = key64bits; - - for (int i = 0; i < intIters; i++) { - hash = halfHash(hash); - } - - // if not integer, we need to mask bits at the end - if (iters != intIters) { - - // mask starts with 16 bits - var mask = Integer.parseUnsignedInt("0xffff", 16); - var shift = 16 - indexBits; - mask = mask >> (shift); - - var hashInt = Integer.parseUnsignedInt(hash, 16); - - hashInt = hashInt & mask; - return Integer.toString(hashInt, BASE); - } - - return hash; - } - - private String halfHash(String hash) { - - int length = hash.length(); - int halfLength = length / 2; - StringBuilder newHash = new StringBuilder(); - - for (int i = 0; i < halfLength; i++) { - - String highChar = hash.substring(i, i + 1); - Integer high = Integer.parseUnsignedInt(highChar, BASE); - String lowChar = hash.substring(i + halfLength, i + halfLength + 1); - Integer low = Integer.parseUnsignedInt(lowChar, BASE); - - newHash.append(Integer.toString(high ^ low, BASE)); - } - - return newHash.toString(); - } - - private String makeHashKey(MergedMemoiEntry count) { - - String fullKey = count.getKey(); - - var keys = fullKey.split("#"); - - if (keys.length == 1) { - return fullKey; - } else { - return combineKeys(keys); - } - } - - private String combineKeys(String[] keys) { - - StringBuilder combinedKey = new StringBuilder(); - - int numKeys = keys.length; - - for (int charIx = 0; charIx < KEY_STRING_LENGTH; charIx++) { - - String currentChar = keys[0].substring(charIx, charIx + 1); - Integer currentNumber = Integer.parseUnsignedInt(currentChar, BASE); - - for (int keyIx = 1; keyIx < numKeys; keyIx++) { - - String newChar = keys[keyIx].substring(charIx, charIx + 1); - Integer newNumber = Integer.parseUnsignedInt(newChar, BASE); - - currentNumber = currentNumber ^ newNumber; - } - - combinedKey.append(Integer.toString(currentNumber, BASE)); - } - - return combinedKey.toString(); - } - - public static DirectMappedTable load(File file) { - - // FileInputStream fileIn = new FileInputStream(file); - // ObjectInputStream in = new ObjectInputStream(fileIn); - // DirectMappedTable dmt = (DirectMappedTable) in.readObject(); - // in.close(); - // fileIn.close(); - - return SpecsJackson.fromFile(file, DirectMappedTable.class, true); - } - - public static void save(File file, DirectMappedTable dmt) { - - // FileOutputStream fileOut = new FileOutputStream(file); - // ObjectOutputStream out = new ObjectOutputStream(fileOut); - // out.writeObject(dmt); - // out.close(); - // fileOut.close(); - - SpecsJackson.toFile(dmt, file, true); - } - - public MergedMemoiReport getReport() { - return report; - } - - public void setReport(MergedMemoiReport report) { - this.report = report; - } - - public int getIndexBits() { - return indexBits; - } - - public void setIndexBits(int indexBits) { - this.indexBits = indexBits; - } - - public int getNumSets() { - return numSets; - } - - public void setNumSets(int numSets) { - this.numSets = numSets; - } - - public Predicate getInsertPred() { - return insertPred; - } - - public void setInsertPred(Predicate insertPred) { - this.insertPred = insertPred; - } - - public Comparator getCountComparator() { - return countComparator; - } - - public void setCountComparator(Comparator countComparator) { - this.countComparator = countComparator; - } - - public int getTotalCollisions() { - return totalCollisions; - } - - public void setTotalCollisions(int totalCollisions) { - this.totalCollisions = totalCollisions; - } - - public int getTotalElements() { - return totalElements; - } - - public void setTotalElements(int totalElements) { - this.totalElements = totalElements; - } - - public int getMaxCollision() { - return maxCollision; - } - - public void setMaxCollision(int maxCollision) { - this.maxCollision = maxCollision; - } - - public void setTable(Map table) { - this.table = table; - } - - public DmtStats getStats() { - return stats; - } - - public boolean testPolicy() { - - return applyPolicy.test(this); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DmtStats.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DmtStats.java deleted file mode 100644 index 495035fbe3..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/DmtStats.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi; - -import java.util.Locale; - -public class DmtStats { - - private int reportCount; - private int tableElements; - private double tableCalls; - private double capacity; - private double totalCalls; - private double collisionPercentage; - private double elementCoverage; - private double callCoverage; - private int tableSize; - private int numSets; - private int totalCollisions; - private int totalElements; - private int maxCollision; - - public DmtStats(DirectMappedTable dmt) { - - this.reportCount = dmt.getReport().getReportCount(); - - this.tableSize = dmt.getTable().size(); - this.tableElements = tableSize; - - this.tableCalls = dmt.getTable().values().parallelStream() - .map(MergedMemoiEntry::getCounter) - .map(l -> MemoiUtils.mean(l, reportCount)) - .reduce(0.0, Double::sum); - - this.numSets = dmt.getNumSets(); - this.totalCollisions = dmt.getTotalCollisions(); - this.totalElements = dmt.getTotalElements(); - this.maxCollision = dmt.getMaxCollision(); - - this.capacity = 100.0 * tableSize / numSets; - this.totalCalls = MemoiUtils.mean(dmt.getReport().getCalls(), reportCount); - this.collisionPercentage = 100.0 * totalCollisions / totalElements; - this.elementCoverage = 100.0 * tableElements / totalElements; - this.callCoverage = 100.0 * tableCalls / totalCalls; - } - - public int getReportCount() { - return reportCount; - } - - public int getTableElements() { - return tableElements; - } - - public double getTableCalls() { - return tableCalls; - } - - public double getCapacity() { - return capacity; - } - - public double getTotalCalls() { - return totalCalls; - } - - public double getCollisionPercentage() { - return collisionPercentage; - } - - public double getElementCoverage() { - return elementCoverage; - } - - public double getCallCoverage() { - return callCoverage; - } - - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - - Locale l = null; - builder.append(System.lineSeparator()); - builder.append(System.lineSeparator()); - builder.append("=== table stats ==="); - builder.append(System.lineSeparator()); - - builder.append("table capacity: " + tableSize + "/" + numSets + " (" - + String.format(l, "%.2f", capacity) + "%)"); - - builder.append(System.lineSeparator()); - - builder.append("collisions: " + totalCollisions + "/" + totalElements + " (" - + String.format(l, "%.2f", collisionPercentage) + "%)"); - builder.append(System.lineSeparator()); - - builder.append("largest collision: " + maxCollision); - builder.append(System.lineSeparator()); - - builder.append("element coverage: " + tableElements + "/" + totalElements + " (" - + String.format(l, "%.2f", elementCoverage) + "%)"); - builder.append(System.lineSeparator()); - - builder.append( - "call coverage: " + tableCalls + "/" + totalCalls + " (" + String.format(l, "%.2f", callCoverage) - + "%)"); - builder.append(System.lineSeparator()); - - return builder.toString(); - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiCodeGen.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiCodeGen.java deleted file mode 100644 index bce36ac609..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiCodeGen.java +++ /dev/null @@ -1,504 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import pt.up.fe.specs.clava.weaver.memoi.policy.apply.DmtRepetition; -import pt.up.fe.specs.clava.weaver.memoi.policy.apply.SimplePolicies; - -public class MemoiCodeGen { - - private static final String H = "0x"; - private static final String NAN_BITS = "0xfff8000000000000"; - private static Map> policyMap; - static { - policyMap = new HashMap<>(); - policyMap.put("ALWAYS", SimplePolicies.ALWAYS); - policyMap.put("NOT_EMPTY", SimplePolicies.NOT_EMPTY); - policyMap.put("OVER_25_PCT", DmtRepetition.OVER_25_PCT); - policyMap.put("OVER_50_PCT", DmtRepetition.OVER_50_PCT); - policyMap.put("OVER_75_PCT", DmtRepetition.OVER_75_PCT); - policyMap.put("OVER_90_PCT", DmtRepetition.OVER_90_PCT); - } - - /** - * Generates the {@link DirectMappedTable} based on the report. - * - * @param numSets - * @param report - * @param applyPolicyName - * @return - */ - public static DirectMappedTable generateDmt(int numSets, MergedMemoiReport report, String applyPolicyName) { - - Predicate applyPolicy = policyMap.get(applyPolicyName); - if (applyPolicy == null) { - - throw new RuntimeException("Could not translate the apply policy '" + applyPolicyName + "'."); - } - - return DirectMappedTable.fromApplyPolicy(report, numSets, applyPolicy); - } - - /** - * Generates the table code as a static global, which is defined above the wrapper that uses it. If necessary, a - * reset function is generated and defined below the table. - * - * @param table - * @param numSets - * @param inputCount - * @param outputCount - * @param isMemoiOnline - * @param isReset - * @param isEmpty - * @param tablePrefix - * @return - */ - public static String generateTableCode(Map table, int numSets, int inputCount, - int outputCount, boolean isMemoiOnline, boolean isReset, boolean isEmpty, String tablePrefix) { - - if (isEmpty) { - - table = new HashMap(); - } - - return dmtCode(table, inputCount, outputCount, numSets, isMemoiOnline, isReset, tablePrefix); - } - - /** - * Generates the logic code that uses the global static table. - * - * @param numSets - * @param paramNames - * @param memoiApproxBits - * @param inputCount - * @param outputCount - * @param inputTypes - * @param outputTypes - * @param tablePrefix - * @return - */ - public static String generateLogicCode(int numSets, - List paramNames, int memoiApproxBits, int inputCount, int outputCount, - List inputTypes, List outputTypes, String tablePrefix) { - - return dmtLogicCode(paramNames, numSets, memoiApproxBits, inputCount, outputCount, - inputTypes, outputTypes, tablePrefix); - } - - /** - * Generates a reset function that is defined after the table. - * - * @param tableSize - * @param tablePrefix - * @return - */ - private static String resetCode(int tableSize, String tablePrefix) { - - StringBuilder b = new StringBuilder("\nvoid "); - b.append(tablePrefix); - b.append("reset (void) {\n"); - b.append("for(int i = 0; i < "); - b.append(tableSize); - b.append("; i++) {\n"); - b.append(tablePrefix); - b.append("table[i][0] = "); - b.append(NAN_BITS); - b.append(";\n}\n"); - b.append("}\n"); - - return b.toString(); - } - - /** - * Generates the update logic. - * - * @param numSets - * @param paramNames - * @param isUpdateAlways - * @param inputCount - * @param outputCount - * @param updatesName - * @param isZeroSim - * @param tablePrefix - * @return - */ - public static String generateUpdateCode(int numSets, List paramNames, - boolean isUpdateAlways, int inputCount, int outputCount, String updatesName, boolean isZeroSim, - String tablePrefix) { - - int indexBits = (int) MemoiUtils.log2(numSets); - - return updateCode(inputCount, outputCount, indexBits, paramNames, isUpdateAlways, updatesName, isZeroSim, - tablePrefix); - } - - private static List makeVarNames(List paramNames) { - - return paramNames.stream().map(s -> s + "_bits").collect(Collectors.toList()); - } - - private static String dmtLogicCode(List paramNames, int numSets, - int memoiApproxBits, int inputCount, int outputCount, List inputTypes, List outputTypes, - String tablePrefix) { - - StringBuilder code = new StringBuilder(); - - int indexBits = (int) MemoiUtils.log2(numSets); - - int maxVarBits = varBitsCode(paramNames, code, memoiApproxBits, inputCount, inputTypes); - - mergeBitsCode(code, paramNames, maxVarBits, indexBits, inputCount); - - lookupCode(code, indexBits, paramNames, inputCount, outputCount, outputTypes, tablePrefix); - - return code.toString(); - } - - private static String updateCode(int inputCount, int outputCount, int indexBits, - List paramNames, boolean isUpdateAlways, String updatesName, boolean isZeroSim, - String tablePrefix) { - - String tableName = tablePrefix + "table"; - - StringBuilder code = new StringBuilder(); - - var varNames = makeVarNames(paramNames); - - List inputUpdates = new ArrayList<>(); - StringBuilder access = new StringBuilder(tableName).append("[hash_").append(indexBits).append("_bits]"); - - for (int v = 0; v < inputCount; v++) { - - StringBuilder inputUpdate = new StringBuilder(access); - inputUpdate.append("["); - inputUpdate.append(v); - inputUpdate.append("] = "); - if (isZeroSim) { - inputUpdate.append(NAN_BITS); // for 0% -> assign NaN - } else { - inputUpdate.append(varNames.get(v)); - } - inputUpdate.append(";"); - - inputUpdates.add(inputUpdate.toString()); - } - code.append(String.join("\n", inputUpdates)); - code.append("\n"); - - if (outputCount == 1) { - - code.append(access); - code.append("["); - code.append(inputCount); - code.append("] = *(uint64_t*) &result;"); - - code.append("\n"); - if (updatesName != null) { - code.append(updatesName); - code.append("++;\n"); - } - - } else { - - for (int o = 0; o < outputCount; o++) { - - int outputIndex = o + inputCount; - - code.append(access); - code.append("["); - code.append(outputIndex); - code.append("] = *(uint64_t*) "); - code.append(paramNames.get(outputIndex)); - code.append(";\n"); - } - - code.append("\n"); - if (updatesName != null) { - code.append(updatesName); - code.append("++;\n"); - } - - code.append("\treturn;\n\n"); - } - - if (!isUpdateAlways) { - StringBuilder condition = new StringBuilder("if("); - condition.append(access); - condition.append("[0] == "); - condition.append(NAN_BITS); - condition.append(") {\n"); - - code.insert(0, condition); - code.append("\n}\n"); - } - - return code.toString(); - } - - private static void lookupCode(StringBuilder code, int indexBits, - List paramNames, int inputCount, int outputCount, List outputTypes, String tablePrefix) { - - String tableName = tablePrefix + "table"; - - code.append("\nif("); - - List varNames = makeVarNames(paramNames); - - List testClauses = new ArrayList<>(); - StringBuilder access = new StringBuilder(tableName).append("[hash_").append(indexBits).append("_bits]"); - - for (int v = 0; v < inputCount; v++) { - - StringBuilder testClause = new StringBuilder(access); - testClause.append("["); - testClause.append(v); - testClause.append("] == "); - testClause.append(varNames.get(v)); - - testClauses.add(testClause.toString()); - } - code.append(String.join(" && ", testClauses)); - - code.append(") {\n"); - - if (outputCount == 1) { - - code.append("\treturn *("); - code.append(outputTypes.get(0)); - code.append(" *) &"); - code.append(tableName); - code.append("[hash_"); - code.append(indexBits); - code.append("_bits]["); - code.append(inputCount); - code.append("];\n}\n"); - } else { - - for (int o = 0; o < outputCount; o++) { - - code.append("\t*"); - code.append(paramNames.get(o + inputCount)); - code.append(" = *("); - code.append(outputTypes.get(o)); - code.append(" *) &"); - code.append(tableName); - code.append("[hash_"); - code.append(indexBits); - code.append("_bits]["); - code.append(o + inputCount); - code.append("];\n"); - } - code.append("\treturn;\n}\n"); - } - } - - private static void mergeBitsCode(StringBuilder code, List paramNames, - int maxVarBits, int indexBits, int inputCount) { - - List varNames = makeVarNames(paramNames).subList(0, inputCount); - - code.append("\n"); - code.append("uint"); - code.append(maxVarBits); - code.append("_t hash_"); - code.append(maxVarBits); - code.append("_bits = "); - code.append(String.join(" ^ ", varNames)); - code.append(";\n"); - - double iters = (int) MemoiUtils.log2(maxVarBits / indexBits); - int intIters = (int) Math.floor(iters); - - int large = maxVarBits; - int small = 0; - for (int i = 0; i < intIters; i++) { - - small = large / 2; - - code.append("uint"); - code.append(maxVarBits); // always use the same type and perform && at the end - code.append("_t hash_"); - code.append(small); - code.append("_bits = (hash_"); - code.append(large); - code.append("_bits ^ (hash_"); - code.append(large); - code.append("_bits >> "); - code.append(small); - code.append("));\n"); - - large /= 2; - } - - // if not integer, we need to mask bits at the end - if (iters != intIters) { - - code.append("uint"); - code.append(small); - code.append("_t mask = 0xffff >> (16 - "); - code.append(indexBits); - code.append(");\n"); - - code.append("uint"); - code.append(small); - code.append("_t hash_"); - code.append(indexBits); - code.append("_bits = hash_"); - code.append(small); - code.append("bits & mask;\n"); - } else { // mask for small, since a larger type is used and the values are not truncated - - StringBuilder mask = new StringBuilder(H); - for (int i = 0; i < indexBits / 4; i++) { - - mask.append("f"); - } - - code.append("hash_"); - code.append(indexBits); - code.append("_bits = hash_"); - code.append(indexBits); - code.append("_bits & "); - code.append(mask); - code.append(";\n"); - } - } - - private static int varBitsCode(List paramNames, StringBuilder code, - int memoiApproxBits, int inputCount, List inputTypes) { - - Map sizeMap = new HashMap<>(); - sizeMap.put("float", 32); - sizeMap.put("int", 32); - sizeMap.put("double", 64); - - List varNames = makeVarNames(paramNames); - - int maxVarBits = 0; - - for (int p = 0; p < inputCount; p++) { - - String paramName = paramNames.get(p); - - String paramType = inputTypes.get(p); - int varBits = sizeMap.get(paramType); - - if (varBits > maxVarBits) { - maxVarBits = varBits; - } - - code.append("uint"); - code.append(varBits); - code.append("_t "); - code.append(varNames.get(p)); - code.append(" = *(uint"); - code.append(varBits); - code.append("_t*)&"); - code.append(paramName); - code.append(";\n"); - - if (memoiApproxBits != 0) { - - code.append(varNames.get(p)); - code.append(" = "); - code.append(varNames.get(p)); - code.append(" & ("); - code.append("(0xffffffffffffffff >> "); - code.append(memoiApproxBits); - code.append(") << "); - code.append(memoiApproxBits); - code.append(");\n"); - } - } - - return maxVarBits; - } - - private static String dmtCode(Map table, int inputCount, int outputCount, int numSets, - boolean isMemoiOnline, boolean isReset, String tablePrefix) { - - StringBuilder code = new StringBuilder("static"); - if (!isMemoiOnline) { - code.append(" const"); - } - code.append(" uint64_t "); - code.append(tablePrefix); - code.append("table["); - - code.append(numSets); - code.append("]["); - code.append(inputCount + outputCount); - code.append("] = {\n"); - - for (int i = 0; i < numSets; i++) { - - code.append("\t{"); - - // String key = Integer.toString(i, BASE); - String key = String.format("%04x", i); - - MergedMemoiEntry entry = table.get(key); - - if (entry == null) { - - for (int ic = 0; ic < inputCount; ic++) { - code.append(NAN_BITS); - code.append(", "); - } - - code.append(0); - for (int oc = 1; oc < outputCount; oc++) { - code.append(", "); - code.append(0); - } - } else { - - String fullKey = entry.getKey(); - String[] keys = fullKey.split("#"); - for (int k = 0; k < keys.length; k++) { - code.append(H); - code.append(keys[k]); - code.append(", "); - } - - String fullOutputString = entry.getOutput(); - String[] outputStrings = fullOutputString.split("#"); - - code.append(H); - code.append(outputStrings[0]); - for (int o = 1; o < outputCount; o++) { - code.append(", "); - code.append(H); - code.append(outputStrings[o]); - } - } - code.append("},\n"); - } - code.append("};\n"); - - if (isReset) { - - code.append(resetCode(numSets, tablePrefix)); - } - - return code.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiEntry.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiEntry.java deleted file mode 100644 index e5982be934..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiEntry.java +++ /dev/null @@ -1,79 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MemoiEntry implements java.io.Serializable { - - private static final long serialVersionUID = -3537659135548907637L; - - private String key; - private String output; - private int counter; - - public MemoiEntry() { - this.key = ""; - this.output = ""; - this.counter = 0; - } - - public MemoiEntry(MemoiEntry otherEntry) { - - this.key = otherEntry.key; - this.output = otherEntry.output; - this.counter = otherEntry.counter; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getOutput() { - return output; - } - - public void setOutput(String output) { - this.output = output; - } - - public int getCounter() { - return counter; - } - - public void setCounter(int counter) { - this.counter = counter; - } - - public void inc(int newValue) { - - this.counter += newValue; - } - - @Override - public String toString() { - - StringBuilder builder = new StringBuilder("{"); - builder.append(key); - builder.append(", "); - builder.append(output); - builder.append(", "); - builder.append(counter); - builder.append("}"); - - return builder.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReport.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReport.java deleted file mode 100644 index 7fd3ae8282..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReport.java +++ /dev/null @@ -1,290 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -import java.io.File; -import java.util.List; -import java.util.Map; - -import com.google.gson.Gson; - -import pt.up.fe.specs.JacksonPlus.SpecsJackson; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.io.PathFilter; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MemoiReport implements java.io.Serializable { - - private static final long serialVersionUID = 2478911300859975647L; - - private String uuid; - private String id; - private String funcSig; - private int inputCount; - private int outputCount; - private List inputTypes; - private List outputTypes; - private List call_sites; - - private int elements; - private int calls; - private int hits; - private int misses; - - private Map counts; // maps a key to a memoi entry - - public static MergedMemoiReport mergeReportsFromNames(List fileNames) { - - return mergeReportsFromNames(fileNames, false); - } - - public static MergedMemoiReport mergeReportsFromNames(List fileNames, boolean check) { - - MergedMemoiReport report = null; - - for (String fileName : fileNames) { - - MemoiReport tempReport = mergePartsFromName(fileName); - - if (report == null) { - - report = new MergedMemoiReport(tempReport); - } else { - - report.mergeReport(tempReport, check); - } - } - - report.makeStats(); - report.printStats(); - return report; - } - - public static MemoiReport mergePartsFromName(String fileName) { - - File file = new File(fileName); - - SpecsCheck.checkArgument(file.exists(), () -> "the file " + fileName + " doesn't exist"); - - // get the final report - MemoiReport finalReport = fromFile(file, false); - - // get the other reports and merge them - File parentDir = SpecsIo.getParent(file); - String pattern = file.getName() + ".part*"; - List partFiles = SpecsIo.getPathsWithPattern(parentDir, pattern, false, PathFilter.FILES); - - for (var partFile : partFiles) { - - MemoiReport partReport = fromFile(partFile, false); - finalReport.mergePart(partReport); - } - - // calculate the correct number of elements, misses, and hits - finalReport.setElements(finalReport.getCounts().size()); - finalReport.setMisses(finalReport.getElements()); - finalReport.setHits(finalReport.getCalls() - finalReport.getMisses()); - - return finalReport; - } - - public static MemoiReport fromFile(File file) { - - return fromFile(file, false); - } - - public static MemoiReport fromFile(File file, boolean time) { - - SpecsCheck.checkArgument(file.exists(), () -> "the file " + file + " doesn't exist"); - - long start = 0; - if (time) { - start = System.currentTimeMillis(); - } - - // MemoiReport fromJson = null; - // FileReader fr = new FileReader(file); - // BufferedReader br = new BufferedReader(fr); - // fromJson = new Gson().fromJson(br, MemoiReport.class); - - MemoiReport fromJson = SpecsJackson.fromFile(file, MemoiReport.class, false); - - if (time) { - long end = System.currentTimeMillis(); - long delta = end - start; - SpecsLogs.info("fromFile took " + delta + "ms"); - } - - return fromJson; - } - - /** - * The number of calls is correct after each merge. The number of hits and misses is not and is calculated at the - * end based on the number of elements. - * - * @param otherReport - */ - private void mergePart(MemoiReport otherReport) { - - // Map tempMap = makeMap(); - // - // for (MemoiEntry entry : otherReport.counts) { - // - // var key = entry.getKey(); - // if (tempMap.containsKey(key)) { - // - // tempMap.get(key).inc(entry.getCounter()); - // } else { - // - // tempMap.put(key, new MemoiEntry(entry)); - // } - // } - // counts = new ArrayList(tempMap.values()); - - otherReport.counts.forEach( - (k, v) -> counts.merge( - k, - v, - (v1, v2) -> { - v1.inc(v2.getCounter()); - return v1; - })); - - this.calls += otherReport.calls; - // this.elements += otherReport.elements; - // this.misses += otherReport.misses; - // this.hits += otherReport.hits; - } - - // private Map makeMap() { - // - // Map map = new HashMap<>(this.counts.size()); - // - // counts.stream().forEach(e -> map.put(e.getKey(), e)); - // - // return map; - // } - - public void toJson(String fileName) { - - String json = new Gson().toJson(this); - SpecsIo.write(new File(fileName), json); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFuncSig() { - return funcSig; - } - - public void setFuncSig(String funcSig) { - this.funcSig = funcSig; - } - - public List getOutputTypes() { - return outputTypes; - } - - public void setOutputTypes(List outputTypes) { - this.outputTypes = outputTypes; - } - - public int getInputCount() { - return inputCount; - } - - public void setInputCount(int inputCount) { - this.inputCount = inputCount; - } - - public int getOutputCount() { - return outputCount; - } - - public void setOutputCount(int outputCount) { - this.outputCount = outputCount; - } - - public List getInputTypes() { - return inputTypes; - } - - public void setInputTypes(List inputTypes) { - this.inputTypes = inputTypes; - } - - public List getCall_sites() { - return call_sites; - } - - public void setCall_sites(List call_sites) { - this.call_sites = call_sites; - } - - public int getElements() { - return elements; - } - - public void setElements(int elements) { - this.elements = elements; - } - - public int getCalls() { - return calls; - } - - public void setCalls(int calls) { - this.calls = calls; - } - - public int getHits() { - return hits; - } - - public void setHits(int hits) { - this.hits = hits; - } - - public int getMisses() { - return misses; - } - - public void setMisses(int misses) { - this.misses = misses; - } - - public Map getCounts() { - return counts; - } - - public void setCounts(Map counts) { - this.counts = counts; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportIndex.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportIndex.java deleted file mode 100644 index 2cdacafdab..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportIndex.java +++ /dev/null @@ -1,72 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.util.List; - -import com.google.gson.Gson; - -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsLogs; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MemoiReportIndex { - - private String id; - private String funcSig; - private List call_sites; - - public static MemoiReportIndex fromFile(File file) { - - SpecsCheck.checkArgument(file.exists(), () -> "the file " + file + " doesn't exist"); - - FileReader fr = null; - try { - fr = new FileReader(file); - } catch (FileNotFoundException e) { - SpecsLogs.warn("Could not find the file " + file.getAbsolutePath()); - } - - BufferedReader br = new BufferedReader(fr); - MemoiReportIndex fromJson = new Gson().fromJson(br, MemoiReportIndex.class); - return fromJson; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFuncSig() { - return funcSig; - } - - public void setFuncSig(String funcSig) { - this.funcSig = funcSig; - } - - public List getCall_sites() { - return call_sites; - } - - public void setCall_sites(List call_sites) { - this.call_sites = call_sites; - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportsMap.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportsMap.java deleted file mode 100644 index 0d374040c8..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiReportsMap.java +++ /dev/null @@ -1,121 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsIo; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MemoiReportsMap { - - public static Map>> fromDirName(String dirName) { - -// System.out.println("buildReportsMap(dirName)"); - - File dir = new File(dirName); - - SpecsCheck.checkArgument(dir.exists(), () -> "the directory " + dirName + " doesn't exist"); - SpecsCheck.checkArgument(dir.isDirectory(), () -> dirName + " is not a directory"); - - List reportFiles = SpecsIo.getFiles(dir, "json"); - - return fromFiles(reportFiles); - } - - public static Map>> fromNames(String[] fileNames) { - -// System.out.println("buildReportsMapFromNames(fileNames)"); - - return fromNames(Arrays.asList(fileNames)); - } - - public static Map>> fromNames(List fileNames) { - -// System.out.println("buildReportsMapFromNames(L[fileNames)"); - - List files = new ArrayList<>(); - - for (String fileName : fileNames) { - - File file = new File(fileName); - - SpecsCheck.checkArgument(file.exists(), () -> "the file " + fileName + " doesn't exist"); - SpecsCheck.checkArgument(file.isFile(), () -> fileName + " is not a file"); - - files.add(file); - } - - return fromFiles(files); - } - - public static Map>> fromFiles(List reportFiles) { - -// System.out.println("buildReportsMapFromFiles(reportFiles)"); - - Map>> map = new HashMap>>(); - - for (File reportFile : reportFiles) { - - String indexExt = ".index"; - String indexFilePath = reportFile.getAbsolutePath() + indexExt; - File indexFile = new File(indexFilePath); - - MemoiReport report = MemoiReport.fromFile(indexFile, false); - put(map, report.getFuncSig(), String.join("#", report.getCall_sites()), reportFile.getAbsolutePath()); - } - - return map; - } - - private static void put(Map>> map, String target, String callSite, - String reportPath) { - - Map> sitesMap = getSitesMap(map, target); - put(sitesMap, callSite, reportPath); - } - - private static Map> getSitesMap(Map>> map, String target) { - - if (map.containsKey(target)) { - - return map.get(target); - } else { - - HashMap> innerMap = new HashMap>(); - map.put(target, innerMap); - - return innerMap; - } - } - - private static void put(Map> sitesMap, String callSite, String reportPath) { - - if (sitesMap.containsKey(callSite)) { - - sitesMap.get(callSite).add(reportPath); - } else { - - List reportList = new ArrayList(); - reportList.add(reportPath); - - sitesMap.put(callSite, reportList); - } - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiUtils.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiUtils.java deleted file mode 100644 index 7c3aaf162d..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MemoiUtils.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi; - -import java.util.List; - -public class MemoiUtils { - - public static double mean(List c1, int t) { - - return c1.stream().reduce(0, Integer::sum) / t; - } - - public static double log2(int i) { - return (Math.log(i) / Math.log(2)); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiEntry.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiEntry.java deleted file mode 100644 index d1bca9a608..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiEntry.java +++ /dev/null @@ -1,113 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -import java.util.ArrayList; -import java.util.List; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MergedMemoiEntry implements java.io.Serializable { - - private static final long serialVersionUID = -3654548405691045308L; - - private String key; - private String output; - private List counter; - private int collisions; - // private final MergedMemoiReport parentReport; - - public MergedMemoiEntry(MemoiEntry previousEntry) { - - this.key = previousEntry.getKey(); - this.output = previousEntry.getOutput(); - this.counter = new ArrayList<>(10); - this.counter.add(previousEntry.getCounter()); - this.collisions = 0; - } - - public MergedMemoiEntry() { - - } - - // public MergedMemoiEntry(MemoiEntry previousEntry, MergedMemoiReport parentReport) { - // - // this.key = previousEntry.getKey(); - // this.output = previousEntry.getOutput(); - // this.counter = new ArrayList<>(); - // this.counter.add(previousEntry.getCounter()); - // this.collisions = 0; - // this.parentReport = parentReport; - // } - - // public double getCountMean() { - // - // return MemoiUtils.mean(counter, parentReport.getReportCount()); - // } - - public String getKey() { - return key; - } - - public String getOutput() { - return output; - } - - public List getCounter() { - return counter; - } - - public void addCounter(int newValue) { - - this.counter.add(newValue); - } - - public void incCollisions() { - this.collisions++; - } - - public int getCollisions() { - return this.collisions; - } - - public void setKey(String key) { - this.key = key; - } - - public void setOutput(String output) { - this.output = output; - } - - public void setCounter(List counter) { - this.counter = counter; - } - - public void setCollisions(int collisions) { - this.collisions = collisions; - } - - @Override - public String toString() { - - StringBuilder builder = new StringBuilder("{"); - builder.append(key); - builder.append(", "); - builder.append(output); - builder.append(", "); - builder.append(counter); - builder.append("} ("); - builder.append(collisions); - builder.append(")"); - - return builder.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiReport.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiReport.java deleted file mode 100644 index 93238d107f..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/MergedMemoiReport.java +++ /dev/null @@ -1,323 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi; - -import java.io.File; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import pt.up.fe.specs.clava.weaver.memoi.stats.Stats; -import pt.up.fe.specs.util.SpecsCheck; -import pt.up.fe.specs.util.SpecsIo; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -/** - * Represents the merge of several profiling runs for the same function (signature) and call site. - * - * @author pedro - * - */ -public class MergedMemoiReport implements java.io.Serializable { - - private static final long serialVersionUID = -8261433007204000797L; - - private String uuid; - private String id; - private String funcSig; - private int inputCount; - private int outputCount; - private List inputTypes; - private List outputTypes; - private List callSites; - - private List elements; - private List calls; - private List hits; - private List misses; - - private Map counts; - - private int reportCount = 1; - - private Stats stats; - - public MergedMemoiReport() { - - } - - public MergedMemoiReport(MemoiReport report) { - - this.uuid = report.getUuid(); - this.id = report.getId(); - this.funcSig = report.getFuncSig(); - this.outputTypes = report.getOutputTypes(); - this.inputCount = report.getInputCount(); - this.outputCount = report.getOutputCount(); - this.inputTypes = new ArrayList<>(report.getInputTypes()); - this.callSites = new ArrayList<>(report.getCall_sites()); - - this.elements = new ArrayList(50); - this.elements.add(report.getElements()); - - this.calls = new ArrayList(50); - this.calls.add(report.getCalls()); - - this.hits = new ArrayList(50); - this.hits.add(report.getHits()); - - this.misses = new ArrayList(50); - this.misses.add(report.getMisses()); - - this.counts = new HashMap(report.getCounts().size()); - // for (MemoiEntry oldEntry : report.getCounts()) { - // - // String key = oldEntry.getKey(); - // MergedMemoiEntry newEntry = new MergedMemoiEntry(oldEntry, this); - // counts.put(key, newEntry); - // } - - // report.getCounts().forEach( - // (k, v) -> { - // MergedMemoiEntry newEntry = new MergedMemoiEntry(v, this); - // counts.put(k, newEntry); - // }); - - report.getCounts().values() - .stream() - .map(me -> new MergedMemoiEntry(me)) - .forEach(mme -> counts.put(mme.getKey(), mme)); - - // this.counts = report.getCounts().values() - // .parallelStream() - // .map(me -> new MergedMemoiEntry(me, this)) - // .collect( - // Collectors.toMap(MergedMemoiEntry::getKey, mme -> mme)); - } - - // public List getMeanSorted() { - // - // var list = new ArrayList(counts.values()); - // list.sort(new MeanComparator(this)); - // - // return list; - // } - - public List getSortedCounts(Comparator countComparator) { - - var list = new ArrayList(counts.values()); - - list.sort(countComparator); - - return list; - } - - void mergeReport(MemoiReport tempReport) { - - mergeReport(tempReport, false); - } - - /** - * Merges a MemoiReport into this MergedMemoiReport. - * - * @param tempReport - * @param check - */ - void mergeReport(MemoiReport tempReport, boolean check) { - - if (check) { - testReport(tempReport); - } - - uuid.concat(tempReport.getUuid()); - elements.add(tempReport.getElements()); - calls.add(tempReport.getCalls()); - hits.add(tempReport.getHits()); - misses.add(tempReport.getMisses()); - - tempReport.getCounts().forEach( - (k, v) -> { - - if (counts.containsKey(k)) { - - counts.get(k).addCounter(v.getCounter()); - } else { - - MergedMemoiEntry newEntry = new MergedMemoiEntry(v); - counts.put(k, newEntry); - } - }); - - // for (MemoiEntry oldEntry : tempReport.getCounts()) { - // - // String key = oldEntry.getKey(); - // - // if (!counts.containsKey(key)) { - // - // MergedMemoiEntry newEntry = new MergedMemoiEntry(oldEntry, this); - // - // counts.put(key, newEntry); - // } else { - // - // counts.get(key).addCounter(oldEntry.getCounter()); - // } - // - // } - - this.reportCount += 1; - } - - private void testReport(MemoiReport tempReport) { - - SpecsCheck.checkArgument(this.funcSig.equals(tempReport.getFuncSig()), - () -> "The function signatures of the reports are not equal"); - SpecsCheck.checkArgument(this.callSites.equals(tempReport.getCall_sites()), - () -> "The call sites of the reports are not equal"); - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getFuncSig() { - return funcSig; - } - - public void setFuncSig(String funcSig) { - this.funcSig = funcSig; - } - - public List getOutputTypes() { - return outputTypes; - } - - public void setOutputType(List outputTypes) { - this.outputTypes = outputTypes; - } - - public int getInputCount() { - return inputCount; - } - - public void setInputCount(int inputCount) { - this.inputCount = inputCount; - } - - public int getOutputCount() { - return outputCount; - } - - public void setOutputCount(int outputCount) { - this.outputCount = outputCount; - } - - public List getInputTypes() { - return inputTypes; - } - - public void setInputTypes(List inputTypes) { - this.inputTypes = inputTypes; - } - - public List getCallSites() { - return callSites; - } - - public void setCallSites(List call_sites) { - this.callSites = call_sites; - } - - public List getElements() { - return elements; - } - - public void setElements(List elements) { - this.elements = elements; - } - - public List getCalls() { - return calls; - } - - public void setCalls(List calls) { - this.calls = calls; - } - - public List getHits() { - return hits; - } - - public void setHits(List hits) { - this.hits = hits; - } - - public List getMisses() { - return misses; - } - - public void setMisses(List misses) { - this.misses = misses; - } - - public Map getCounts() { - return counts; - } - - public void setCounts(Map counts) { - this.counts = counts; - } - - public int getReportCount() { - return reportCount; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public void setOutputTypes(List outputTypes) { - this.outputTypes = outputTypes; - } - - public void setReportCount(int reportCount) { - this.reportCount = reportCount; - } - - public void printStats() { - - System.out.println("\n\n=== profile stats ==="); - System.out.println("target function: " + funcSig); - System.out.println("call sites: " + callSites); - System.out.println("report count: " + reportCount); - - // stats.print(); - File d = SpecsIo.mkdir("./memoi-report-stats/" + funcSig); - File f = new File(d, callSites.toString()); - SpecsIo.write(f, stats.toString()); - } - - public void makeStats() { - this.stats = new Stats(this); - } - - public String getUuid() { - return uuid; - } - -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/comparator/MeanComparator.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/comparator/MeanComparator.java deleted file mode 100644 index 5a72c0959f..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/comparator/MeanComparator.java +++ /dev/null @@ -1,79 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi.comparator; - -import java.util.Comparator; - -import pt.up.fe.specs.clava.weaver.memoi.MemoiUtils; -import pt.up.fe.specs.clava.weaver.memoi.MergedMemoiEntry; -import pt.up.fe.specs.clava.weaver.memoi.MergedMemoiReport; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -public class MeanComparator implements Comparator, java.io.Serializable { - - private static final long serialVersionUID = -212004096753106698L; - - private MergedMemoiReport report; - - public MeanComparator() { - } - - public MeanComparator(MergedMemoiReport report) { - this.report = report; - } - - // @SuppressWarnings("unchecked") - // public final static Comparator mean(MergedMemoiReport report) { - // - // int total = report.getReportCount(); - // - // return (MergedMemoiEntry e1, MergedMemoiEntry e2) -> { - // - // double mean1 = MemoiUtils.mean(e1.getCounter(), total); - // double mean2 = MemoiUtils.mean(e2.getCounter(), total); - // - // if (mean1 > mean2) { - // return 1; - // } else if (mean1 < mean2) { - // return -1; - // } else { - // return 0; - // } - // }; - // } - - @Override - public int compare(MergedMemoiEntry o1, MergedMemoiEntry o2) { - - int total = report.getReportCount(); - - double mean1 = MemoiUtils.mean(o1.getCounter(), total); - double mean2 = MemoiUtils.mean(o2.getCounter(), total); - - if (mean1 > mean2) { - return 1; - } else if (mean1 < mean2) { - return -1; - } else { - return 0; - } - } - - public MergedMemoiReport getReport() { - return report; - } - - public void setReport(MergedMemoiReport report) { - this.report = report; - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/DmtRepetition.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/DmtRepetition.java deleted file mode 100644 index ac7daf7e85..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/DmtRepetition.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi.policy.apply; - -import java.util.function.Predicate; - -import pt.up.fe.specs.clava.weaver.memoi.DirectMappedTable; - -public class DmtRepetition { - - public static Predicate OVER_25_PCT = dmt -> overXPct(dmt, 25); - public static Predicate OVER_50_PCT = dmt -> overXPct(dmt, 50); - public static Predicate OVER_75_PCT = dmt -> overXPct(dmt, 75); - public static Predicate OVER_90_PCT = dmt -> overXPct(dmt, 90); - - public static boolean overXPct(DirectMappedTable dmt, double pct) { - - return dmt.getStats().getCallCoverage() > pct; - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/SimplePolicies.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/SimplePolicies.java deleted file mode 100644 index 4bbf8611e6..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/apply/SimplePolicies.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi.policy.apply; - -import java.util.function.Predicate; - -import pt.up.fe.specs.clava.weaver.memoi.DirectMappedTable; - -public class SimplePolicies { - - public static Predicate ALWAYS = dmt -> true; - public static Predicate NOT_EMPTY = dmt -> dmt.getTable().size() > 0; -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/insert/AlwaysInsert.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/insert/AlwaysInsert.java deleted file mode 100644 index b7c8e7d089..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/policy/insert/AlwaysInsert.java +++ /dev/null @@ -1,37 +0,0 @@ -package pt.up.fe.specs.clava.weaver.memoi.policy.insert; - -import java.util.function.Predicate; - -import pt.up.fe.specs.clava.weaver.memoi.MergedMemoiEntry; - -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -/** - * Policies for inserting specific entries into the table. - * - * @author pedro - * - */ -public class AlwaysInsert implements Predicate, java.io.Serializable { - - private static final long serialVersionUID = 645571394428346494L; - - public AlwaysInsert() { - } - - @Override - public boolean test(MergedMemoiEntry t) { - return true; - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/BoxWhisker.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/BoxWhisker.java deleted file mode 100644 index 45dec754ac..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/BoxWhisker.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi.stats; - -import java.util.List; - -public class BoxWhisker implements java.io.Serializable { - - private static final long serialVersionUID = 1193463067709042297L; - - private static final double ONE_QUARTER = 0.25; - private static final double HALF = 0.5; - private static final double THREE_QUARTERS = 0.75; - private final int min; - private final int max; - private final int q1; - private final int q2; - private final int q3; - private final int iqr; - - public BoxWhisker(List meanCounts) { - - int size = meanCounts.size(); - - this.min = meanCounts.get(size - 1); - this.q3 = getQuartVal(meanCounts, ONE_QUARTER * size); // q1 and q3 are inverted since this list is order from - // highest to lowest - this.q2 = getQuartVal(meanCounts, HALF * size); - this.q1 = getQuartVal(meanCounts, THREE_QUARTERS * size); - this.max = meanCounts.get(0); - this.iqr = q3 - q1; - } - - private int getQuartVal(List meanCounts, double i) { - - int floor = (int) Math.floor(i); - - Integer first = meanCounts.get(floor); - if (i == floor) { - - Integer second = meanCounts.get(floor + 1); - return (first + second) / 2; - } else { - - return first; - } - } - - // 2|---[2 |2 2]---|74708 - @Override - public String toString() { - - StringBuilder b = new StringBuilder("== box whisker ==\n"); - b.append(min); - b.append("|---["); - b.append(q1); - b.append(" |"); - b.append(q2); - b.append(" "); - b.append(q3); - b.append("]---|"); - b.append(max); - b.append(" iqr: "); - b.append(iqr); - - return b.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Histogram.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Histogram.java deleted file mode 100644 index 27d3041246..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Histogram.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi.stats; - -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -public class Histogram implements java.io.Serializable { - - private static final long serialVersionUID = 5726323419689661888L; - - private Map map; - - public Histogram(List meanCounts) { - - map = new TreeMap<>(); - - meanCounts.stream() - .forEach(c -> { - map.merge(c, 1, Integer::sum); - }); - } - - @Override - public String toString() { - - StringBuilder b = new StringBuilder("== histogram ==\n"); - - for (var key : map.keySet()) { - b.append(key); - b.append(": "); - b.append(map.get(key)); - b.append("\n"); - } - - return b.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Stats.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Stats.java deleted file mode 100644 index 9051c117ca..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/memoi/stats/Stats.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.memoi.stats; - -import java.util.List; -import java.util.stream.Collectors; - -import pt.up.fe.specs.clava.weaver.memoi.MemoiUtils; -import pt.up.fe.specs.clava.weaver.memoi.MergedMemoiReport; -import pt.up.fe.specs.clava.weaver.memoi.comparator.MeanComparator; - -public class Stats implements java.io.Serializable { - - private static final long serialVersionUID = -3810845133276540446L; - - final private double unique; - final private double totalCalls; - final private double repetition; - final private double averageRepetition; - final private double top3percentage; - final private double top5percentage; - final private double top10percentage; - final private Object elements5; - final private Object elements10; - final private Object elements25; - final private Object elements50; - final private BoxWhisker bw; - final private Histogram hist; - - public static boolean isSorted(List listOfT) { - Integer previous = null; - for (Integer current : listOfT) { - if (previous != null && current < previous) - return false; - previous = current; - } - return true; - } - - public Stats(MergedMemoiReport report) { - - var elements = report.getElements(); - var reportCount = report.getReportCount(); - var calls = report.getCalls(); - var entries = report.getSortedCounts(new MeanComparator(report).reversed()); - - var meanCounts = entries.stream() - .map(c -> (int) MemoiUtils.mean(c.getCounter(), reportCount)) - .collect(Collectors.toList()); - - this.unique = MemoiUtils.mean(elements, reportCount); - this.totalCalls = MemoiUtils.mean(calls, reportCount); - - this.repetition = 100.0 * (totalCalls - unique) / totalCalls; - this.averageRepetition = totalCalls / unique; - - double top3total = totalTopN(meanCounts, 3); - this.top3percentage = top3total / totalCalls * 100; - - double top5total = totalTopN(meanCounts, 5); - this.top5percentage = top5total / totalCalls * 100; - - double top10total = totalTopN(meanCounts, 10); - this.top10percentage = top10total / totalCalls * 100; - - int defaultValue = (int) MemoiUtils.mean(elements, reportCount); - this.elements5 = elementsForRatio(meanCounts, totalCalls, 0.05, defaultValue); - this.elements10 = elementsForRatio(meanCounts, totalCalls, 0.1, defaultValue); - this.elements25 = elementsForRatio(meanCounts, totalCalls, 0.25, defaultValue); - this.elements50 = elementsForRatio(meanCounts, totalCalls, 0.5, defaultValue); - - this.bw = new BoxWhisker(meanCounts); - this.hist = new Histogram(meanCounts); - } - - public static int elementsForRatio(List meanCounts, double total, double ratio, int defaultValue) { - - int sum = 0; - - for (int i = 0; i < meanCounts.size(); i++) { - - sum += meanCounts.get(i); - if (sum / total > ratio) { - - return i + 1; - } - } - - return defaultValue; - } - - private static int totalTopN(List meanCounts, int n) { - - int result = 0; - - final int min = Math.min(meanCounts.size(), n); - - for (int i = 0; i < min; i++) { - - result += meanCounts.get(i); - } - - return result; - } - - public void print() { - - System.out.println(toString()); - } - - @Override - public String toString() { - StringBuilder b = new StringBuilder(); - - b.append("unique inputs: " + unique); - b.append(System.lineSeparator()); - b.append("total calls: " + totalCalls); - b.append(System.lineSeparator()); - - b.append("repetition: " + String.format("%.2f%%", repetition)); - b.append(System.lineSeparator()); - b.append("average repetition: " + averageRepetition); - b.append(System.lineSeparator()); - - b.append("top 3: " + String.format("%.2f%%", top3percentage)); - b.append(System.lineSeparator()); - b.append("top 5: " + String.format("%.2f%%", top5percentage)); - b.append(System.lineSeparator()); - b.append("top 10: " + String.format("%.2f%%", top10percentage)); - b.append(System.lineSeparator()); - - b.append("elements for 5%: " + elements5); - b.append(System.lineSeparator()); - b.append("elements for 10%: " + elements10); - b.append(System.lineSeparator()); - b.append("elements for 25%: " + elements25); - b.append(System.lineSeparator()); - b.append("elements for 50%: " + elements50); - b.append(System.lineSeparator()); - - b.append(bw); - b.append(System.lineSeparator()); - b.append(hist); - b.append(System.lineSeparator()); - - return b.toString(); - } -} diff --git a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/util/ClavaPetit.java b/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/util/ClavaPetit.java deleted file mode 100644 index 6f3e56c98e..0000000000 --- a/ClavaLaraApi/src-java/pt/up/fe/specs/clava/weaver/util/ClavaPetit.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.util; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import pt.up.fe.specs.clava.weaver.ClavaApiWebResource; -import pt.up.fe.specs.lang.SpecsPlatforms; -import pt.up.fe.specs.lara.LaraSystemTools; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.providers.FileResourceProvider.ResourceWriteData; -import pt.up.fe.specs.util.providers.WebResourceProvider; - -/** - * Utility class for launching the Petit executable. - * - * @author JoaoBispo - * - */ -public class ClavaPetit { - - public static String execute(List args, String workingDir, boolean printToConsole, long timeoutSeconds) { - List command = new ArrayList<>(args.size() + 1); - command.add(getPetitExecutable().getAbsolutePath()); - command.addAll(args); - - var output = LaraSystemTools.runCommand(command, workingDir, printToConsole, - TimeUnit.SECONDS.toNanos(timeoutSeconds)); - - return output.getOutput(); - } - - private static File getClavaApiResourceFolder() { - return new File(SpecsIo.getTempFolder(), "clava_api"); - } - - private static File getPetitExecutable() { - - File resourceFolder = getClavaApiResourceFolder(); - - WebResourceProvider petitExecutable = getPetitExecutableResource(); - - // Copy executable - // ResourceWriteData executable = executableResource.writeVersioned(resourceFolder, ClangAstParser.class); - - ResourceWriteData executable = petitExecutable.writeVersioned(resourceFolder, - ClavaPetit.class); - - // If file is new and we are in a flavor of Linux, make file executable - if (executable.isNewFile() && SpecsPlatforms.isLinux()) { - SpecsSystem.runProcess(Arrays.asList("chmod", "+x", executable.getFile().getAbsolutePath()), false, true); - } - - return executable.getFile(); - } - - private static WebResourceProvider getPetitExecutableResource() { - - // Check if Linux - if (SpecsPlatforms.isLinux()) { - return ClavaApiWebResource.PETIT_UBUNTU; - } - - if (SpecsPlatforms.isCentos6()) { - return ClavaApiWebResource.PETIT_CENTOS6; - } - - throw new RuntimeException( - "The 'petit' executable (e.g., used by AutoPar package) is currently available only for Debian-compatible systems (e.g., Ubuntu) and RedHat systems (e.g., CentOS)"); - - } -} diff --git a/ClavaLaraApi/src-js/clava/js/autopar/Add_msgError.js b/ClavaLaraApi/src-js/clava/js/autopar/Add_msgError.js deleted file mode 100644 index ae761d5b4c..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/Add_msgError.js +++ /dev/null @@ -1,22 +0,0 @@ -/************************************************************** -* -* Add_msgError -* -**************************************************************/ -function Add_msgError(LoopOmpAttributes, $ForStmt, msgError ) -{ - var loopindex = GetLoopIndex($ForStmt); - - if (LoopOmpAttributes[loopindex].msgError === undefined ) - LoopOmpAttributes[loopindex].msgError = []; - - if (typeof(msgError) === 'string') - { - LoopOmpAttributes[loopindex].msgError.push(msgError); - } - else - { - LoopOmpAttributes[loopindex].msgError = LoopOmpAttributes[loopindex].msgError.concat(msgError); - } -} - diff --git a/ClavaLaraApi/src-js/clava/js/autopar/GetLoopIndex.js b/ClavaLaraApi/src-js/clava/js/autopar/GetLoopIndex.js deleted file mode 100644 index 573494f80d..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/GetLoopIndex.js +++ /dev/null @@ -1,10 +0,0 @@ -/************************************************************** -* -* GetLoopIndex -* -**************************************************************/ -var GetLoopIndex = function($loop) -{ - return $loop.getAstAncestor('FunctionDecl').name + '_' + $loop.rank.join('_'); - //return $loop.id; -} \ No newline at end of file diff --git a/ClavaLaraApi/src-js/clava/js/autopar/RemoveStruct.js b/ClavaLaraApi/src-js/clava/js/autopar/RemoveStruct.js deleted file mode 100644 index 7751349326..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/RemoveStruct.js +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************** -* -* RemoveStruct -* -**************************************************************/ -function RemoveStruct(structObj, criteria) -{ - return structObj.filter(function(obj) - { - return ! Object.keys(criteria).every(function(c) - { - if (typeof(obj[c]) === 'string') - return obj[c].indexOf(criteria[c])>-1; - else - return obj[c] === criteria[c]; - }); - }); -} \ No newline at end of file diff --git a/ClavaLaraApi/src-js/clava/js/autopar/SafeFunctionCalls.js b/ClavaLaraApi/src-js/clava/js/autopar/SafeFunctionCalls.js deleted file mode 100644 index d0b92e4800..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/SafeFunctionCalls.js +++ /dev/null @@ -1,2 +0,0 @@ -var safefunctionCallslist = ['sqrt', 'log', 'fabs', 'malloc', 'pow', 'cos', 'sin', 'exp', 'floor', 'ceil', 'round', 'fmod']; - diff --git a/ClavaLaraApi/src-js/clava/js/autopar/SearchStruct.js b/ClavaLaraApi/src-js/clava/js/autopar/SearchStruct.js deleted file mode 100644 index b5a930dd8c..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/SearchStruct.js +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************** -* -* SearchStruct -* -**************************************************************/ -function SearchStruct(structObj, criteria) -{ - return structObj.filter(function(obj) - { - return Object.keys(criteria).every(function(c) - { - - if (typeof(obj[c]) === 'string') - //return obj[c].indexOf(criteria[c])>-1; - return obj[c].toUpperCase() === criteria[c].toUpperCase(); - - else - - return obj[c] === criteria[c]; - }); - }); -} - -/* - -function multiFilter(array, filters) { - filterKeys = Object.keys(filters); - // filters all elements passing the criteria - return array.filter(function(item) { - // dynamically validate all filter criteria - return filterKeys.every(function(key){ !!~filters[key].indexOf(item[key])}); - }); -} - -function multiFilter(arr, filters) -{ - filterKeys = Object.keys(filters); - return arr.filter(function(eachObj) { - return filterKeys.every(function(eachKey) { - if (!filters[eachKey].length) { - return true; // passing an empty filter means that filter is ignored. - } - return filters[eachKey].includes(eachObj[eachKey]); - }); - }); -} -*/ \ No newline at end of file diff --git a/ClavaLaraApi/src-js/clava/js/autopar/allReplace.js b/ClavaLaraApi/src-js/clava/js/autopar/allReplace.js deleted file mode 100644 index 10d52a52eb..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/allReplace.js +++ /dev/null @@ -1,159 +0,0 @@ -/************************************************************** -* -* allReplace -* -**************************************************************/ -String.prototype.allReplace = function(obj) { - var retStr = this; - for (var x in obj) { - retStr = retStr.replace(new RegExp(x, 'g'), obj[x]); - } - return retStr; -}; - - -String.prototype.getBetweenBrackets = function() -{ - var matchlist = []; - this.replace(/\[(.*?)\]/g, function(_, match){matchlist.push(match);}); - return matchlist; -} - -String.prototype.moveBracketsToEnd = function(arraylist) -{ - var str = this; - var index = 0; - var matchlist = this; - var i = 0; - while(true) - { - posSTBracket = str.indexOf('[', index); - if (posSTBracket === -1) - break; - - posSTspace = str.lastIndexOf(' ', posSTBracket) - if (posSTspace === -1) posSTspace = 0; - - posFTBracket = str.indexOf(']', posSTBracket); - posFTspace = str.indexOf(' ', posFTBracket); - if (posFTspace === -1) posFTspace = str.length; - - var substr = str.substring(posSTspace, posFTspace); - var betweenBracketslist = substr.getBetweenBrackets(); - var newsubstr = substr.replace(/\[.*?\]/g, ""); - - - arraylist.push(newsubstr + '(' + Array(betweenBracketslist.length+1).join('#').split('').join(',') +')'); - - - newsubstr = newsubstr + '(' + betweenBracketslist.join(',') + ')'; - matchlist = matchlist.replace(substr, newsubstr); - index = posFTspace; - } - - return matchlist; -} - -function normalizeVarName(Varname) -{ - //return Varname.replace(/\[.*?\]/g, ""); - return Varname.replace(/\[.*\]/g, ""); -} - -function normalizeVarName2(Varname) -{ - return Varname.replace(/\[.*?\]/g, "-"); -} - - -String.prototype.moveBracketsToEnd3 = function(arraylistdic) -{ - if (this.indexOf('[') === -1) - return this; - - var filteredstr = this.allReplace({'\t':' '}) + ' '; - var outputstr = this; - - - while(true) - { - if (outputstr.indexOf('[') === -1) - break; - - var indexST = filteredstr.lastIndexOf(' ',filteredstr.indexOf('[')); - var indexFT = filteredstr.indexOf(']',indexST+1); - while(indexFT < filteredstr.length) - { - if ( - filteredstr.indexOf('[',indexFT) !== -1 - && - filteredstr.substring(indexFT,filteredstr.indexOf('[',indexFT)).indexOf(' ') === -1 - ) - indexFT = filteredstr.indexOf(']',indexFT+1); - else - break; - } - indexFT = filteredstr.indexOf(' ', indexFT); - - var substr = filteredstr.substring(indexST+1,indexFT); - var arrayName = normalizeVarName(substr); - var betweenBracketslist = substr.getBetweenBrackets(); - - var len = Object.keys(arraylistdic).length + 1; - if (arraylistdic[arrayName] === undefined) - { - arraylistdic[arrayName] = {}; - arraylistdic[arrayName].name = 'A_' + len; - arraylistdic[arrayName].size = '(0:9999' + Array(betweenBracketslist.length).join(',0:9999') +')'; - } - var newsubstr = arraylistdic[arrayName].name + '(' + betweenBracketslist.join(',') +')'; - - outputstr = outputstr.replace(substr, newsubstr); - filteredstr = filteredstr.replace(substr, ''); - } - - return outputstr; -} - -String.prototype.moveBracketsToEnd2 = function(arraylistdic) -{ - var index = 0; - var newCode = this; - while(true) - { - posSTBracket = this.indexOf('[', index); - if (posSTBracket === -1) - break; - - posSTspace = this.lastIndexOf(' ', posSTBracket) - if (posSTspace === -1) posSTspace = 0; - - posFTBracket = this.indexOf(']', posSTBracket); - posFTspace = this.indexOf(' ', posFTBracket); - if (posFTspace === -1) posFTspace = this.length; - - var substr = this.substring(posSTspace, posFTspace); - - var betweenBracketslist = substr.getBetweenBrackets(); - var newsubstr = substr.replace(/\[.*?\]/g, ""); - - newsubstr = newsubstr + '(' + betweenBracketslist.join(',') + ')'; - - var arrayName = newsubstr.split('(')[0]; - arrayName = arrayName.trim(); - - var len = Object.keys(arraylistdic).length + 1; - if (arraylistdic[arrayName] === undefined) - { - arraylistdic[arrayName] = {}; - arraylistdic[arrayName].name = 'A_' + len; - arraylistdic[arrayName].size = '(0:9999' + Array(betweenBracketslist.length).join(',0:9999') +')'; - } - newsubstr = newsubstr.replace(arrayName, arraylistdic[arrayName].name); - - newCode = newCode.replace(substr, newsubstr); - index = posFTspace; - } - - return newCode; -} \ No newline at end of file diff --git a/ClavaLaraApi/src-js/clava/js/autopar/getFromBetween.js b/ClavaLaraApi/src-js/clava/js/autopar/getFromBetween.js deleted file mode 100644 index b7d6226978..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/getFromBetween.js +++ /dev/null @@ -1,40 +0,0 @@ -var getFromBetween = { - results:[], - string:"", - getFromBetween:function (sub1,sub2) { - if(this.string.indexOf(sub1) < 0 || this.string.indexOf(sub2) < 0) return false; - var SP = this.string.indexOf(sub1)+sub1.length; - var string1 = this.string.substr(0,SP); - var string2 = this.string.substr(SP); - var TP = string1.length + string2.indexOf(sub2); - return this.string.substring(SP,TP); - }, - removeFromBetween:function (sub1,sub2) { - if(this.string.indexOf(sub1) < 0 || this.string.indexOf(sub2) < 0) return false; - var removal = sub1+this.getFromBetween(sub1,sub2)+sub2; - this.string = this.string.replace(removal,""); - }, - getAllResults:function (sub1,sub2) { - // first check to see if we do have both substrings - if(this.string.indexOf(sub1) < 0 || this.string.indexOf(sub2) < 0) return; - - // find one result - var result = this.getFromBetween(sub1,sub2); - // push it to the results array - this.results.push(result); - // remove the most recently found one from the string - this.removeFromBetween(sub1,sub2); - - // if there's more substrings - if(this.string.indexOf(sub1) > -1 && this.string.indexOf(sub2) > -1) { - this.getAllResults(sub1,sub2); - } - else return; - }, - get:function (string,sub1,sub2) { - this.results = []; - this.string = string; - this.getAllResults(sub1,sub2); - return this.results; - } -}; \ No newline at end of file diff --git a/ClavaLaraApi/src-js/clava/js/autopar/orderedVarrefs3.js b/ClavaLaraApi/src-js/clava/js/autopar/orderedVarrefs3.js deleted file mode 100644 index f285df44e4..0000000000 --- a/ClavaLaraApi/src-js/clava/js/autopar/orderedVarrefs3.js +++ /dev/null @@ -1,115 +0,0 @@ -/************************************************************** -* -* orderedVarrefs3 -* -**************************************************************/ -var orderedVarrefs3 = function($jp) -{ - - var varrefs = []; - if($jp.instanceOf("expression") || $jp.joinPointType === "statement") - { - return orderedVarrefsBase3($jp); - } - - for(var i=0; i<$jp.numChildren; i++) - { - var astChild = $jp.getChild(i); - if(astChild === undefined) { - continue; - } - varrefs = varrefs.concat( orderedVarrefs3(astChild) ); - } - return varrefs; -}; -var orderedVarrefsBase3 = function($stmt) -{ - varrefTable = {}; - var maxLevel = varrefUsageOrder3($stmt, 0, varrefTable); - var orderedExprs = []; - for(var i=maxLevel; i>=0; i--) - { - var exprList = varrefTable[i]; - if(exprList === undefined) - { - continue; - } - orderedExprs = orderedExprs.concat(exprList); - } - return orderedExprs; -}; -var varrefUsageOrder3 = function($jp, currentLevel, varrefTable) -{ - if($jp.joinPointType === "binaryOp") - { - if($jp.kind === "assign") - { - var rightLevel = varrefUsageOrder3($jp.getChild(1), currentLevel+1, varrefTable); - var leftLevel = varrefUsageOrder3($jp.getChild(0), currentLevel+1, varrefTable); - return rightLevel > leftLevel ? rightLevel : leftLevel; - } - else - { - var leftLevel = varrefUsageOrder3($jp.getChild(0), currentLevel+1, varrefTable); - var rightLevel = varrefUsageOrder3($jp.getChild(1), currentLevel+1, varrefTable); - - return rightLevel > leftLevel ? rightLevel : leftLevel; - } - - } - else if( - $jp.joinPointType === "varref" && $jp.isFunctionCall === false - ) - { - var currentVarrefs = varrefTable[currentLevel]; - if(currentVarrefs === undefined) - { - currentVarrefs = []; - varrefTable[currentLevel] = currentVarrefs; - } - currentVarrefs.push($jp); - return currentLevel; - } - else - { - if (['arrayAccess','memberAccess'].indexOf($jp.joinPointType) !== -1) - { - var maxLevel = currentLevel; - for(var i=0; i<$jp.numChildren; i++) - { - var lastLevel = varrefUsageOrder3($jp.getChild(i), currentLevel, varrefTable); - if(lastLevel > maxLevel) - { - maxLevel = lastLevel; - } - } - - - var currentVarrefs = varrefTable[currentLevel]; - if(currentVarrefs === undefined) - { - currentVarrefs = []; - varrefTable[currentLevel] = currentVarrefs; - } - currentVarrefs.push($jp); - - return maxLevel; - } - else - { - var maxLevel = currentLevel; - for(var i=0; i<$jp.numChildren; i++) - { - var lastLevel = varrefUsageOrder3($jp.getChild(i), currentLevel+1, varrefTable); - if(lastLevel > maxLevel) - { - maxLevel = lastLevel; - } - } - return maxLevel; - } - - } -}; - - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddOpenMPDirectivesForLoop.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddOpenMPDirectivesForLoop.lara deleted file mode 100644 index 09658c509d..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddOpenMPDirectivesForLoop.lara +++ /dev/null @@ -1,270 +0,0 @@ -/************************************************************** -/************************************************************** -* -* AddOpenMPDirectivesForLoop -* -**************************************************************/ -aspectdef AddOpenMPDirectivesForLoop - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - - if (typeof LoopOmpAttributes[loopindex] === 'undefined') - { - return; - } - - var msgError = LoopOmpAttributes[loopindex].msgError; - if (typeof msgError === 'undefined') - msgError = []; - - var InsertBeforeStr = ''; - - if (msgError.length > 0) - { - InsertBeforeStr = '/*' + Array(15).join('*') + ' Clava msgError ' + Array(15).join('*') + - '\n\t\t' + msgError.join('\n\t\t') + - '\n' + Array(40).join('*') + '*/'; - } - else - { - var privateVars = LoopOmpAttributes[loopindex].privateVars; - var firstprivateVars = LoopOmpAttributes[loopindex].firstprivateVars; - var lastprivateVars = LoopOmpAttributes[loopindex].lastprivateVars; - var reduction = LoopOmpAttributes[loopindex].reduction; - var depPetitFileName = LoopOmpAttributes[loopindex].DepPetitFileName; - - var OpenMPDirectivesStr = '#pragma omp parallel for '; - - OpenMPDirectivesStr += ' default(shared) '; - - - /* - call o : ret_IF_Clause($ForStmt); - OpenMPDirectivesStr += ' ' + o.IF_Clause_str + ' '; - */ - - /* - call o : ret_NUM_THREADS_Clause($ForStmt); - OpenMPDirectivesStr += ' ' + o.NUM_THREADS_Clause_str + ' '; - */ - - - if (privateVars.length > 0) - OpenMPDirectivesStr += 'private(' + privateVars.join(', ') + ') '; - - if (firstprivateVars.length > 0) - OpenMPDirectivesStr += 'firstprivate(' + firstprivateVars.join(', ') + ') '; - - if (lastprivateVars.length > 0) - OpenMPDirectivesStr += 'lastprivate(' + lastprivateVars.join(', ') + ') '; - - if (reduction.length > 0) - OpenMPDirectivesStr += reduction.join(' ') + ' '; - - if (depPetitFileName!== null && depPetitFileName.length > 0) - OpenMPDirectivesStr += '\n// ' + depPetitFileName; - - InsertBeforeStr = OpenMPDirectivesStr; - } - - // Insert pragma - $ForStmt.insert before InsertBeforeStr; - - // Add include - not working... - //$ForStmt.getAncestor('file').addInclude("omp", true); - - select $ForStmt.body end - apply - if(!$body.hasChildren) { - continue; - } - - if ($body.getChild(0).code.indexOf('//loopindex') !== -1) - { - var loopindex_org = $body.children[0].code.split(' ')[1].trim(); - var func_name = $ForStmt.getAstAncestor('FunctionDecl').name; - if (loopindex_org.indexOf(func_name) !== -1) - { - if (OmpPragmas[loopindex_org] === undefined) - { - OmpPragmas[loopindex_org] = {}; - - OmpPragmas[loopindex_org].pragmaCode = InsertBeforeStr; - } - else - { - //exit(); - return; - } - } - } - end - -end - - - -aspectdef ret_IF_Clause - input $ForStmt end - output IF_Clause_str end - - var loopindex = GetLoopIndex($ForStmt); - var loopControlVarname = LoopOmpAttributes[loopindex].loopControlVarname; - this.IF_Clause_str = 'if(abs('; - - var cloneJP = null; - - select $ForStmt.init end - apply - for($cast of $init.getDescendantsAndSelf("vardecl")) // if for(int i = ... ) - { - cloneJP=$cast.init.copy(); - break #$ForStmt; - } - for($cast of $init.getDescendantsAndSelf("binaryOp"))// if for(i = ... ) - { - cloneJP=$cast.right.copy(); - break #$ForStmt; - } - end - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - this.IF_Clause_str += cloneJP.code + ' - '; - - - cloneJP = null; - var binaryOpleft = null; - var binaryOpRight = null; - select $ForStmt.cond.binaryOp end - apply - binaryOpleft=$binaryOp.left.copy(); - binaryOpRight=$binaryOp.right.copy(); - break #$ForStmt; - end - - var foundflag = false; - for($cast of binaryOpleft.getDescendantsAndSelf("varref")) - if ($cast.name === loopControlVarname) - { - cloneJP=binaryOpRight; - foundflag = true; - } - - if (foundflag === false) - cloneJP=binaryOpleft; - - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - - this.IF_Clause_str += cloneJP.code; - - - this.IF_Clause_str += ')>500)'; -end - - - -aspectdef ret_NUM_THREADS_Clause - input $ForStmt end - output NUM_THREADS_Clause_str end - - var loopindex = GetLoopIndex($ForStmt); - var loopControlVarname = LoopOmpAttributes[loopindex].loopControlVarname; - this.NUM_THREADS_Clause_str = 'num_threads((abs('; - - var cloneJP = null; - - select $ForStmt.init end - apply - for($cast of $init.getDescendantsAndSelf("vardecl")) // if for(int i = ... ) - { - cloneJP=$cast.init.copy(); - break #$ForStmt; - } - for($cast of $init.getDescendantsAndSelf("binaryOp"))// if for(i = ... ) - { - cloneJP=$cast.right.copy(); - break #$ForStmt; - } - end - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - this.NUM_THREADS_Clause_str += cloneJP.code + ' - '; - - - cloneJP = null; - var binaryOpleft = null; - var binaryOpRight = null; - select $ForStmt.cond.binaryOp end - apply - binaryOpleft=$binaryOp.left.copy(); - binaryOpRight=$binaryOp.right.copy(); - break #$ForStmt; - end - - var foundflag = false; - for($cast of binaryOpleft.getDescendantsAndSelf("varref")) - if ($cast.name === loopControlVarname) - { - cloneJP=binaryOpRight; - foundflag = true; - } - - if (foundflag === false) - cloneJP=binaryOpleft; - - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - - this.NUM_THREADS_Clause_str += cloneJP.code; - - - this.NUM_THREADS_Clause_str += ')<500)?1:omp_get_max_threads())'; -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddPragmaLoopIndex.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddPragmaLoopIndex.lara deleted file mode 100644 index 2133ac3473..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AddPragmaLoopIndex.lara +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************** -* -* AddPragmaLoopIndex -* -**************************************************************/ - -aspectdef AddPragmaLoopIndex - - select file.function.loop.body end - apply - var loopindex = GetLoopIndex($loop); - //$body.insert before '//#pragma Clava loopindex ' + loopindex; - $body.insert before '//loopindex ' + loopindex; - end - condition $loop.astName === 'ForStmt' end - - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParStats.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParStats.lara deleted file mode 100644 index 4439ff4a9c..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParStats.lara +++ /dev/null @@ -1,101 +0,0 @@ -import lara.Io; - -/** - * Collects stats about AutoPar execution. - */ -var AutoParStats = function() { - this.name = "default"; - this.inlinedCalls = 0; - this.inlineAnalysis = {}; - this.inlineAnalysisFunctions = {}; - this.inlineExcludedFunctions = []; - this.inductionVariableReplacements = 0; -}; - - -/*** STATIC FUNCTIONS ***/ - -AutoParStats._STATS = undefined; - -AutoParStats.EXCLUDED_RECURSIVE = "excluded_recursive"; -AutoParStats.EXCLUDED_IS_UNSAFE = "excluded_is_unsafe"; -AutoParStats.EXCLUDED_GLOBAL_VAR = "excluded_global_var"; -AutoParStats.EXCLUDED_CALLS_UNSAFE = "excluded_has_unsafe_calls"; - -AutoParStats.get = function() { - if(AutoParStats._STATS === undefined) { - AutoParStats._STATS = new AutoParStats(); - } - - return AutoParStats._STATS; -} - -AutoParStats.reset = function() { - AutoParStats._STATS = new AutoParStats(); -} - -AutoParStats.save = function() { - if(AutoParStats._STATS === undefined) { - console.log("AutoParStats.saveStats: stats have not been initialized, use AutoParStats.resetStats()"); - return; - } - - AutoParStats._STATS.write(); -} - - -/*** INSTANCE FUNCTIONS ***/ - -/** - * Sets the name of these stats (will reflect on the name of the output file) - */ -AutoParStats.prototype.setName = function(name) { - this.name = name; -} - -/** - * Writes the current stats to the given output folder - */ -AutoParStats.prototype.write = function(outputFolder) { - if(outputFolder === undefined) { - outputFolder = Io.getWorkingFolder(); - } - - Io.writeJson(Io.getPath(outputFolder, "AutoParStats-" + this.name + ".json"), this); -} - -AutoParStats.prototype.incInlineCalls = function() { - this.inlinedCalls++; -} - -AutoParStats.prototype.incInlineAnalysis = function(field, functionName) { - if(field === undefined) { - console.log("AutoParStats.incInlineAnalysis: field is undefined"); - return; - } - - if(this.inlineAnalysis[field] === undefined) { - this.inlineAnalysis[field] = 0; - } - - this.inlineAnalysis[field]++; - - if(functionName !== undefined) { - if(this.inlineAnalysisFunctions[field] === undefined) { - this.inlineAnalysisFunctions[field] = []; - } - - this.inlineAnalysisFunctions[field].push(functionName); - } - -} - -AutoParStats.prototype.setInlineExcludedFunctions = function(excludedFunctions) { - this.inlineExcludedFunctions = excludedFunctions; -} - -AutoParStats.prototype.incIndunctionVariableReplacements = function() { - this.inductionVariableReplacements++; -} - - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParUtils.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParUtils.lara deleted file mode 100644 index e8734a3553..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/AutoParUtils.lara +++ /dev/null @@ -1,20 +0,0 @@ -import clava.Clava; - -/** - * Utility methods related to the AutoPar package. - * - * @class - */ -var AutoParUtils = {}; - -/** - * Returns the petit executable, of the Omega suite. - * - * @return {J#File} a file representing the petit executable. - */ -/* -AutoParUtils.getPetit = function() { - return Clava._getApiUtils().getPetitExecutable(); -} -*/ - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/BuildPetitFileInput.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/BuildPetitFileInput.lara deleted file mode 100644 index 68c06d2212..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/BuildPetitFileInput.lara +++ /dev/null @@ -1,328 +0,0 @@ -/************************************************************** -* -* BuildPetitFileInput -* -**************************************************************/ -import clava.autopar.get_varTypeAccess; - -aspectdef BuildPetitFileInput - input $ForStmt end - - var replace_vars = []; - var loopindex = GetLoopIndex($ForStmt); - - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - LoopOmpAttributes[loopindex].ForStmtToPetit = []; - LoopOmpAttributes[loopindex].petit_variables = []; - LoopOmpAttributes[loopindex].petit_arrays = {}; - LoopOmpAttributes[loopindex].petit_loop_indices = []; - - LoopOmpAttributes[loopindex].petit_variables.push('petit_tmp'); - - var varreflist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'varref'}); - for(var i = 0; i < varreflist.length; i++) - { - LoopOmpAttributes[loopindex].petit_variables.push(varreflist[i].name); - if (varreflist[i].name[0] === '_') - replace_vars.push(varreflist[i].name); - } - var loopsControlVarname = []; - loopsControlVarname.push(LoopOmpAttributes[loopindex].loopControlVarname); - if (LoopOmpAttributes[loopindex].innerloopsControlVarname !== undefined ) - loopsControlVarname = loopsControlVarname.concat(LoopOmpAttributes[loopindex].innerloopsControlVarname); - for(var i = 0; i < loopsControlVarname.length; i++) - LoopOmpAttributes[loopindex].petit_loop_indices.push(loopsControlVarname[i]); - - - - var $cloneJPForStmt = $ForStmt.copy(); - - var tabOP = []; - - call o : CovertLoopToPetitForm($ForStmt, tabOP); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line: LoopOmpAttributes[loopindex].start, str : o.loopPetitForm}); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line: LoopOmpAttributes[loopindex].end, str : tabOP.join('') + 'endfor'}); - - select $ForStmt.body.loop end - apply - var innerloopindex = GetLoopIndex($loop); - - tabOP = []; - for(var i = 0; i < $loop.rank.length-1; i++) - tabOP.push('\t'); - - call o : CovertLoopToPetitForm($loop, tabOP); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line: LoopOmpAttributes[innerloopindex].start, str : o.loopPetitForm}); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line: LoopOmpAttributes[innerloopindex].end, str : tabOP.join('') + 'endfor'}); - end - condition $loop.astName === 'ForStmt' end - - var candidateArraylist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {usedInClause : false, hasDescendantOfArrayAccess : true}); - - var oder = 0; - for(var i = 0; i < candidateArraylist.length; i++) - { - var varObj = candidateArraylist[i]; - - if ( varObj.use.indexOf('W') === -1 || varObj.sendtoPetit === false) - continue; - - for(var j = 0; j < varObj.varUsage.length; j++) - if (varObj.varUsage[j].isInsideLoopHeader === false) - { - - var tabOP = Array(varObj.varUsage[j].parentlooprank.length).join('\t'); - if (varObj.varUsage[j].use === 'R') - { - LoopOmpAttributes[loopindex].ForStmtToPetit.push({ - line : varObj.varUsage[j].line, - order : oder++, - parentlooprank : varObj.varUsage[j].parentlooprank.join('_'), - IsdependentCurrentloop : varObj.varUsage[j].IsdependentCurrentloop, - IsdependentInnerloop : varObj.varUsage[j].IsdependentInnerloop, - IsdependentOuterloop : varObj.varUsage[j].IsdependentOuterloop, - str : tabOP + 'petit_tmp = ' + varObj.varUsage[j].code - }); - } - else if (varObj.varUsage[j].use === 'W') - { - LoopOmpAttributes[loopindex].ForStmtToPetit.push({ - line : varObj.varUsage[j].line, - order : oder++, - parentlooprank : varObj.varUsage[j].parentlooprank.join('_'), - IsdependentCurrentloop : varObj.varUsage[j].IsdependentCurrentloop, - IsdependentInnerloop : varObj.varUsage[j].IsdependentInnerloop, - IsdependentOuterloop : varObj.varUsage[j].IsdependentOuterloop, - str : tabOP + varObj.varUsage[j].code + ' = petit_tmp' - }); - } - else if (varObj.varUsage[j].use === 'RW') - { - LoopOmpAttributes[loopindex].ForStmtToPetit.push({ - line : varObj.varUsage[j].line, - order : oder++, - parentlooprank : varObj.varUsage[j].parentlooprank.join('_'), - IsdependentCurrentloop : varObj.varUsage[j].IsdependentCurrentloop, - IsdependentInnerloop : varObj.varUsage[j].IsdependentInnerloop, - IsdependentOuterloop : varObj.varUsage[j].IsdependentOuterloop, - str : tabOP + 'petit_tmp = ' + varObj.varUsage[j].code - }); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({ - line : varObj.varUsage[j].line, - order : oder++, - parentlooprank : varObj.varUsage[j].parentlooprank.join('_'), - IsdependentCurrentloop : varObj.varUsage[j].IsdependentCurrentloop, - IsdependentInnerloop : varObj.varUsage[j].IsdependentInnerloop, - IsdependentOuterloop : varObj.varUsage[j].IsdependentOuterloop, - str : tabOP + varObj.varUsage[j].code + ' = petit_tmp' - }); - } - } - - } - - - for(var i=0; i < LoopOmpAttributes[loopindex].ForStmtToPetit.length ; i++) - { - LoopOmpAttributes[loopindex].ForStmtToPetit[i].str = LoopOmpAttributes[loopindex].ForStmtToPetit[i].str.moveBracketsToEnd3(LoopOmpAttributes[loopindex].petit_arrays); - } - - var j = -6; - for ( var key in LoopOmpAttributes[loopindex].petit_arrays) - { - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : j, str : 'integer ' + - LoopOmpAttributes[loopindex].petit_arrays[key].name + - LoopOmpAttributes[loopindex].petit_arrays[key].size }); - j--; - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : j, str : '!------ ' + - LoopOmpAttributes[loopindex].petit_arrays[key].name + - ' -> ' +key}); - j--; - } - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : j, str : '!' + Array(50).join('-') +' arrays'}); - - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : -5, str : '!' + Array(50).join('-') +' loop indices'}); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : -4, str : 'integer ' + LoopOmpAttributes[loopindex].petit_loop_indices.join(',')}); - - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : -3, str : '!' + Array(50).join('-') +' variables'}); - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : -2, str : 'integer ' + LoopOmpAttributes[loopindex].petit_variables.join(',')}); - - LoopOmpAttributes[loopindex].ForStmtToPetit.push({line : -1, str : '!' + Array(50).join('-') +' body code'}); - - LoopOmpAttributes[loopindex].ForStmtToPetit = LoopOmpAttributes[loopindex].ForStmtToPetit.sort( - function(obj1, obj2) - { - if(obj1.line !== obj2.line) - return obj1.line - obj2.line; - else - return obj1.order - obj2.order; - }); - - - var count = 1; - var replaceloopindices = {}; - - for(var loopindices of LoopOmpAttributes[loopindex].petit_loop_indices) - if (loopindices.length > 5) - { - replaceloopindices[loopindices] = {}; - replaceloopindices[loopindices].rep = 'tmp' + count.toString();; - count = count + 1; - } - - - for(var i=0; i < LoopOmpAttributes[loopindex].ForStmtToPetit.length ; i++) - { - for (var key in replaceloopindices) - if (LoopOmpAttributes[loopindex].ForStmtToPetit[i].str.indexOf(key) !== -1) - { - LoopOmpAttributes[loopindex].ForStmtToPetit[i].str = Strings.replacer(LoopOmpAttributes[loopindex].ForStmtToPetit[i].str,key,replaceloopindices[key].rep); - } - - } - - for(var replace_var of replace_vars) - for(var i=0; i < LoopOmpAttributes[loopindex].ForStmtToPetit.length ; i++) - LoopOmpAttributes[loopindex].ForStmtToPetit[i].str = Strings.replacer(LoopOmpAttributes[loopindex].ForStmtToPetit[i].str,replace_var,replace_var.substr(1)); - -end - - -/************************************************************** -* -* CovertLoopToPetitForm -* -**************************************************************/ -aspectdef CovertLoopToPetitForm - input $ForStmt, tabOP end - output loopPetitForm end - - this.loopPetitForm = tabOP.join('') + 'for '; - var loopindex = GetLoopIndex($ForStmt); - //console.log("DEBUG - Loop Index: " + loopindex); - //console.log("DEBUG - For Stmt: " + $ForStmt.location); - //console.log("DEBUG - LoopOmpAttributes[loopindex]: " + LoopOmpAttributes[loopindex]); - var loopAttributes = LoopOmpAttributes[loopindex]; - if(loopAttributes === undefined) { - var message = ""; - message += "Could not find the loop attributes of loop " + loopindex + "@" + $ForStmt.location + ". Current attributes:\n"; - for(var key in LoopOmpAttributes) { - message += key + ": " + LoopOmpAttributes[key]; - } - - throw message; - } - - //var loopControlVarname = LoopOmpAttributes[loopindex].loopControlVarname; - var loopControlVarname = loopAttributes.loopControlVarname; - - var cloneJP = null; - - select $ForStmt.init end - apply - for($cast of $init.getDescendantsAndSelf("vardecl")) // if for(int i = ... ) - { - cloneJP=$cast.init.copy(); - break #$ForStmt; - } - for($cast of $init.getDescendantsAndSelf("binaryOp"))// if for(i = ... ) - { - cloneJP=$cast.right.copy(); - break #$ForStmt; - } - end - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - - var str_init = cloneJP.code; - - this.loopPetitForm += loopControlVarname + ' = ' + str_init + ' to '; - - cloneJP = null; - var binaryOpleft = null; - var binaryOpRight = null; - select $ForStmt.cond.binaryOp end - apply - binaryOpleft=$binaryOp.left.copy(); - binaryOpRight=$binaryOp.right.copy(); - break #$ForStmt; - end - - var foundflag = false; - for($cast of binaryOpleft.getDescendantsAndSelf("varref")) - if ($cast.name === loopControlVarname) - { - cloneJP=binaryOpRight; - foundflag = true; - } - - if (foundflag === false) - cloneJP=binaryOpleft; - - - - for($cast of cloneJP.getDescendantsAndSelf("cast")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - for($cast of cloneJP.getDescendantsAndSelf("unaryOp")) - { - var child = $cast.getChild(0); - $cast.replaceWith(child); - } - - var str_cond = cloneJP.code; - - for($cast of cloneJP.getDescendantsAndSelf("binaryOp")) - { - if (['shr' , 'shl'].indexOf($cast.kind) !== -1) - str_cond = '9999'; - } - - this.loopPetitForm += str_cond; - - var stepOp = null; - cloneJP = null; - select $ForStmt.step.expr end - apply - stepOp = $expr.kind; - - if (stepOp === 'assign' || stepOp === 'add' || stepOp === 'sub') - { - cloneJP=$expr.right.copy(); - } - break #$ForStmt; - end - condition $expr.joinPointType == 'binaryOp' || $expr.joinPointType == 'unaryOp' end - - - if (stepOp === 'post_inc' || stepOp === 'pre_inc') - { - this.loopPetitForm += ' do'; - } - else if (stepOp === 'pre_dec' || stepOp === 'post_dec') - { - this.loopPetitForm += ' by -1 do'; - } - else if (stepOp === 'assign') - { - this.loopPetitForm += ' do'; - } - - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/CheckForSafeFunctionCall.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/CheckForSafeFunctionCall.lara deleted file mode 100644 index 9f010c7598..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/CheckForSafeFunctionCall.lara +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************** -* -* checkForSafeFunctionCall -* -**************************************************************/ -aspectdef CheckForSafeFunctionCall - - var new_safefunctionCallslist = []; - - select file.function end - apply - if ( new_safefunctionCallslist.indexOf($function.name) === -1) - new_safefunctionCallslist.push($function.name); - end - condition $function.params.length > 0 end - - select file.function.call end - apply - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - end - condition new_safefunctionCallslist.indexOf($function.name) !== -1 end - - - select file.function.body.arrayAccess end - apply - if($arrayAccess.use.indexOf('write') === -1) { - continue; - } - - var currentRegion = $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.currentRegion; - if((currentRegion !== undefined && currentRegion.joinPointType === 'file') - || $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.isParam) { - - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - } - -/* - if ( - $arrayAccess.use.indexOf('write') !== -1 && - ( - $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.currentRegion.joinPointType === 'file' - || - $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.isParam - ) - ) - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); -*/ - end - condition new_safefunctionCallslist.indexOf($function.name) !== -1 end - - select file.function.body.memberAccess end - apply - if($memberAccess.use.indexOf('write') === -1) { - continue; - } - - var currentRegion = $memberAccess.getDescendantsAndSelf('varref')[0].vardecl.currentRegion; - if(currentRegion !== undefined && currentRegion.joinPointType === 'file') { - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - } - - /* - if ( - $memberAccess.use.indexOf('write') !== -1 && - $memberAccess.getDescendantsAndSelf('varref')[0].vardecl.currentRegion.joinPointType === 'file' - ) - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - */ - end - condition new_safefunctionCallslist.indexOf($function.name) !== -1 end - - - select file.function.body.varref end - apply - if($varref.useExpr.use.indexOf('write') === -1){ - continue; - } - - var currentRegion = $varref.vardecl.currentRegion; - if(currentRegion !== undefined && currentRegion.joinPointType === 'file') { - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - } - /* - if ( - $varref.useExpr.use.indexOf('write') !== -1 && - $varref.vardecl.currentRegion.joinPointType === 'file' - ) - new_safefunctionCallslist.splice(new_safefunctionCallslist.indexOf($function.name),1); - */ - end - condition new_safefunctionCallslist.indexOf($function.name) !== -1 end - - select file end - apply - $file.insertBegin('//new_safefunctionCallslist : ' + new_safefunctionCallslist.join(' , ')); - end - - if (new_safefunctionCallslist.length > 0) - safefunctionCallslist = safefunctionCallslist.concat(new_safefunctionCallslist); - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ExecPetitDependencyTest.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ExecPetitDependencyTest.lara deleted file mode 100644 index 1162aa4ccd..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ExecPetitDependencyTest.lara +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************** -* -* ExecPetitDependencyTest -* -**************************************************************/ -import clava.autopar.AutoParUtils; -import lara.util.ProcessExecutor; -import clava.ClavaJavaTypes; - - -aspectdef ExecPetitDependencyTest - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - LoopOmpAttributes[loopindex].petitInputFileAddress = Clava.getWeavingFolder() + - '/Petitdeploop#' + $ForStmt.line + '[' + $ForStmt.getAstAncestor('FunctionDecl').name + ']' + '.t'; - - LoopOmpAttributes[loopindex].petitOutputFileAddress = Clava.getWeavingFolder() + - '/Petitdeploop#' + $ForStmt.line + '[' + $ForStmt.getAstAncestor('FunctionDecl').name + ']' +'_output.t'; - - var petit_input_file = []; - for(var i=0; i < LoopOmpAttributes[loopindex].ForStmtToPetit.length ; i++) - petit_input_file.push(LoopOmpAttributes[loopindex].ForStmtToPetit[i].str); - - - - Io.writeFile(LoopOmpAttributes[loopindex].petitInputFileAddress, petit_input_file.join('\n')); - - var petitArgs = ['-Fc', '-g', '-s', '-4', LoopOmpAttributes[loopindex].petitInputFileAddress, '-R' + LoopOmpAttributes[loopindex].petitOutputFileAddress]; - - // RUN petit dependency test - var printToConsole = false; - var timeoutSeconds = 60; - var consoleOutput = ClavaJavaTypes.ClavaPetit.execute(petitArgs, Clava.getWeavingFolder() + '/', printToConsole, timeoutSeconds); - - - if (consoleOutput.length === 0) - { - LoopOmpAttributes[loopindex].PetitFoundDependency = []; - - var PetitOutputDependencyFile = Strings.asLines(Io.readFile(LoopOmpAttributes[loopindex].petitOutputFileAddress)); - Io.appendFile(LoopOmpAttributes[loopindex].petitInputFileAddress, '\n\n!' + Array(100).join('-') + '\n'); - Io.appendFile(LoopOmpAttributes[loopindex].petitInputFileAddress,'!' + Array(10).join('\t') + ' Petit Output Dependency ' + '\n!-\n'); - - var nosolvedepvarName = []; - for(var i=0;i':'', '\\[':'', '\\]':''}); - outputLine = outputLine.split(' ').filter(function(n){ return n != ''; }).join(' ').split(' '); - - - - var varName = Object.keys(LoopOmpAttributes[loopindex].petit_arrays).filter(function(key) {return LoopOmpAttributes[loopindex].petit_arrays[key].name === outputLine[2].split('(')[0];})[0]; - - var depObj = { - depType : outputLine[0], - src : Number(outputLine[1]), - dst : Number(outputLine[3]), - ArrayName : outputLine[2].split('(')[0], - varName : varName, - depVector : outputLine[5].allReplace({'\\(':'', '\\)':''}).split(','), - subscriptNumber : outputLine[2].split('(')[1].split(',').length, - depStatus : outputLine[6], - src_usge : outputLine[2], - dst_usge : outputLine[4], - - parentlooprank_src : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[1])-1].parentlooprank, - parentlooprank_dst : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[3])-1].parentlooprank, - - IsdependentCurrentloop_src : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[1])-1].IsdependentCurrentloop, - IsdependentInnerloop_src : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[1])-1].IsdependentInnerloop, - IsdependentOuterloop_src : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[1])-1].IsdependentOuterloop, - - - IsdependentCurrentloop_dst : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[3])-1].IsdependentCurrentloop, - IsdependentInnerloop_dst : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[3])-1].IsdependentInnerloop, - IsdependentOuterloop_dst : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[3])-1].IsdependentOuterloop, - - varref_line_src : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[1])-1].line, - varref_line_dst : LoopOmpAttributes[loopindex].ForStmtToPetit[Number(outputLine[3])-1].line, - - cannotbesolved :false, - canbeignored : false - }; - - - if ( - outputLine[5].indexOf('#') !== -1 || - String(depObj.depVector.join('')).allReplace({'\\+':'','0':'','\\*':''}).length !== 0 - ) - { - if (nosolvedepvarName.indexOf(varName) === -1) - { - nosolvedepvarName.push(varName); - } - } - - var check_str = []; - if ( - depObj.subscriptNumber === depObj.depVector.length && - ( depObj.IsdependentInnerloop_src || depObj.IsdependentCurrentloop_src ) && - (String(depObj.depVector.join('')).allReplace({'\\+':'','0':''}).length === 0) - && (depObj.depVector[0] === '0') - - ) - { - depObj.canbeignored = true; - } - - if ( - (depObj.depVector[0] === '0' && depObj.src_usge === depObj.dst_usge )|| - (depObj.src > depObj.dst && depObj.subscriptNumber === depObj.depVector.length && - depObj.parentlooprank_dst.indexOf(depObj.parentlooprank_src + '_') === -1 ) // add new - ) - { - depObj.canbeignored = true; - - } - - if (depObj.IsdependentCurrentloop_src === false || depObj.IsdependentCurrentloop_dst === false) - depObj.canbeignored = false; - - LoopOmpAttributes[loopindex].PetitFoundDependency.push(depObj); - - Io.appendFile(LoopOmpAttributes[loopindex].petitInputFileAddress,'!-\t' + PetitOutputDependencyFile[i] + - (depObj.canbeignored === true ?'\t canbeignored = ' + depObj.canbeignored : '\t'+Array(21).join(' ')) + - (nosolvedepvarName.indexOf(depObj.varName) !== -1 ?'\t cannotbesolved = true' : '') + - '\n'); - } - - - for(var depObj of LoopOmpAttributes[loopindex].PetitFoundDependency) - if (nosolvedepvarName.indexOf(depObj.varName) !== -1) - depObj.cannotbesolved = true; - - - Io.appendFile(LoopOmpAttributes[loopindex].petitInputFileAddress, '!' + Array(100).join('-') + '\n'); - - } - else - { - // Check if console output has path to petit executable, cut it so that the message is platform independent - var petitIndex = consoleOutput.indexOf("petit:"); - if(petitIndex !== -1) { - consoleOutput = consoleOutput.substring(petitIndex); - } - Add_msgError(LoopOmpAttributes, $ForStmt,'consoleOutput ' + consoleOutput); - } - -end diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/FindReductionArrays.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/FindReductionArrays.lara deleted file mode 100644 index d37bbc870a..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/FindReductionArrays.lara +++ /dev/null @@ -1,192 +0,0 @@ -/************************************************************** -* -* FindReductionArrays -* -**************************************************************/ -aspectdef FindReductionArrays - input $ForStmt, candidateArrayName, exprline, isdependentInnerloop, isdependentCurrentloop, isdependentOuterloop end - output isReductionArrays end - var reduction = []; - - this.isReductionArrays = false; - - var check1 = (isdependentInnerloop === true) && (isdependentCurrentloop === false) && (isdependentOuterloop === false); - var check2 = (isdependentInnerloop === false) && (isdependentCurrentloop === false) && (isdependentOuterloop === true); - - - if ( - check1 === false && check2 === false - ) - return; - - // type 1 : x++, ++x, x--, --x - // type 2 : x binaryOp= expr , binaryOp={+, *, -, &, ^ ,|} - // type 3 : x = x binaryOp expr, binaryOp={+, *, -, &, ^ ,|, &&, ||} - // x = expr binaryOp x (except for subtraction) - // x is not referenced in exp - // expr has scalar type (no array, objects etc) - - - var loopindex = GetLoopIndex($ForStmt); - var loopControlVarname = LoopOmpAttributes[loopindex].loopControlVarname; - - - var candidateArray = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {usedInClause : false, name : candidateArrayName})[0]; - - var count = (candidateArray.useT.match(/RW/g) || []); - - if (count.length >1 || count.length === 0) - return; - - - // check for similar dependency of all occurrence for candidateArray - for(var i = 1; i < candidateArray.varUsage.length; i++) - if ( - candidateArray.varUsage[i].IsdependentCurrentloop !== candidateArray.varUsage[0].IsdependentCurrentloop || - candidateArray.varUsage[i].IsdependentInnerloop !== candidateArray.varUsage[0].IsdependentInnerloop || - candidateArray.varUsage[i].IsdependentOuterloop !== candidateArray.varUsage[0].IsdependentOuterloop - ) - return; - - - select $ForStmt.body.expr end - apply - - call o: retReductionOpArray($expr, candidateArray, isdependentInnerloop, isdependentCurrentloop, isdependentOuterloop); - reduction = o.reduction; - break #$ForStmt; - - end - condition $expr.line === exprline end - - if (reduction.length > 0) - { - LoopOmpAttributes[loopindex].reduction = LoopOmpAttributes[loopindex].reduction.concat(reduction); - LoopOmpAttributes[loopindex].Reduction_listVars.push(candidateArrayName); - this.isReductionArrays = true; - } - return; - - -end - - - -/************************************************************** -* -* retReductionOpArray -* -**************************************************************/ -aspectdef retReductionOpArray - input $expr, candidateVar, isdependentInnerloop, isdependentCurrentloop, isdependentOuterloop end - output reduction end -//console.log("Heello"); - - this.reduction = []; - var candidateVarUse = null; - - var exprvarrefset = orderedVarrefs3($expr); - var candidateVarOp = []; - var otherVarUsednumber = 0; // number of other varref in expr - for(var j = 0; j < exprvarrefset.length; j++) - { - - // Fix: Although the array is called exprvarrefset, not all elements are varref (arrayAccess can appear) - if (exprvarrefset[j].name === candidateVar.name && exprvarrefset[j].instanceOf("varref")) - { - if (exprvarrefset[j].useExpr.use.indexOf('write') !== -1) - candidateVarUse = exprvarrefset[j].useExpr.code; - - if (exprvarrefset[j].getAncestor('expression') !== undefined && exprvarrefset[j].getAncestor('expression').astName === 'ParenExpr') - { - candidateVarOp = []; - break; // candidateVar should not be in any ParenExpr - } - - var op = null; - if (exprvarrefset[j].getAncestor('unaryOp') !== undefined) - op = exprvarrefset[j].getAncestor('unaryOp').kind; - else if (exprvarrefset[j].getAncestor('binaryOp') !== undefined) - op = exprvarrefset[j].getAncestor('binaryOp').kind - // TODO: Is this dead code? - + (( exprvarrefset[j].getAncestor('binaryOp').kind !== 'assign' && exprvarrefset[j].getAncestor('binaryOp').isAssignment === true) ? '' :''); - if (op === 'sub' && - typeof(exprvarrefset[j].getAncestor('binaryOp').right.vardecl) !== 'undefined' && - exprvarrefset[j].getAncestor('binaryOp').right.vardecl.name === candidateVar.name - ) - { - candidateVarOp = []; - break; // x = expr - x not acceptable - } - - candidateVarOp.push(op); - } - } - - var op = null; - if (candidateVarOp.length == 1) - { - op = candidateVarOp[0]; - } - else if(candidateVarOp.length == 2 && - candidateVarOp[1] == 'assign' && - ( - // TODO: Remove compound operators (add_assign), since there is an assign? - ['add_assign', 'sub_assign', 'mul_assign','and_assign', 'or_assign' , 'xor_assign'].indexOf(candidateVarOp[0]) !== -1 || - ['add', 'mul', 'sub', 'and', 'or', 'l_and' , 'l_or'].indexOf(candidateVarOp[0]) !== -1 - ) - ) - { - op = candidateVarOp[0]; - } - else - { - return; - } - - - var arraysizeStr = null; - - if (candidateVar.ArraySize === null) - return; - - - if ( - isdependentInnerloop === true - ) - arraysizeStr = candidateVar.name + candidateVar.ArraySize.allReplace({'\\[':'[:'}); - else if (isdependentInnerloop === false) - { - arraysizeStr = candidateVarUse; - } - // TODO: Dead code? - else - { - return; - } - - - var findOpflag = true; - if ( ['pre_dec', 'post_dec', 'sub', 'sub_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (-:' + arraysizeStr + ')'); - else if ( ['pre_inc', 'post_inc', 'add', 'add_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (+:' + arraysizeStr + ')'); - else if ( ['mul' , 'mul_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (*:' + arraysizeStr + ')'); - else if ( ['and' , 'and_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (&:' + arraysizeStr + ')'); - else if ( ['xor' , 'xor_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (^:' + arraysizeStr + ')'); - else if ( ['or' , 'or_assign'].indexOf(op) !== -1 ) - this.reduction.push('reduction (|:' + arraysizeStr + ')'); - else if ( ['l_and'].indexOf(op) !== -1 ) - this.reduction.push('reduction (&&:' + arraysizeStr + ')'); - else if ( ['l_or'].indexOf(op) !== -1 ) - this.reduction.push('reduction (||:' + arraysizeStr + ')'); - else - findOpflag = false; - - if (findOpflag === true) - candidateVar.usedInClause = true; - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/InlineFunctionCalls.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/InlineFunctionCalls.lara deleted file mode 100644 index 8b52f3dcb2..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/InlineFunctionCalls.lara +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************** -* -* InlineFunctionCalls -* -**************************************************************/ -aspectdef InlineFunctionCalls - - var func_name = {}; - - select file.function end - apply - if (func_name[$function.name] === undefined) - { - func_name[$function.name] = {}; - func_name[$function.name].innerCallNumber = 0; - } - end - - select file.function end - apply - var innerCalls = $function.getDescendants('call'); - func_name[$function.name].innerCallNumber = innerCalls.length; - end - - - var sorted = []; - for (var key in func_name) - { - sorted.push([ key, func_name[key].innerCallNumber ]); - } - sorted.sort(function compare(obj1, obj2) {return obj1[1] - obj2[1];}); - - - for(i in sorted) - { - call inlineFunction(sorted[i][0]); - } - - - - return; -end - -/************************************************************** -* -* inlineFunction -* -**************************************************************/ -aspectdef inlineFunction - input funcname end - - select file.function.loop.call end - apply - if ( - $call.getAstAncestor('ForStmt') === undefined || - $call.getAstAncestor('ForStmt').rank.join('_') === $loop.rank.join('_') - ) - { - $call.exec inline; - } - - end - condition $call.name === funcname end -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/LoopInductionVariables.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/LoopInductionVariables.lara deleted file mode 100644 index 4d37f6bc91..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/LoopInductionVariables.lara +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************** -* -* LoopInductionVariables -* -**************************************************************/ -aspectdef LoopInductionVariables - - var inductionVariables = {}; - var inductionVariablesName = []; - var functionNames = []; - - select file.function.loop.binaryOp end - apply - if ( - $binaryOp.left.joinPointType === 'varref' - ) - { - $varref = $binaryOp.left; - astId = $varref.vardecl.astId; - - if (inductionVariables[astId] === undefined) - { - inductionVariables[astId] = {}; - inductionVariables[astId].varName = $varref.name; - inductionVariables[astId].varAccess = []; - - inductionVariablesName.push($varref.name); - - if ( functionNames.indexOf($function.name) === -1) - functionNames.push($function.name); - } - - if ( - $binaryOp.isInsideLoopHeader === false && - $binaryOp.getAncestor('if') === undefined && - $binaryOp.getDescendantsAndSelf("arrayAccess").length === 0 && - $binaryOp.getDescendantsAndSelf("call").length === 0 && - $binaryOp.getDescendantsAndSelf("unaryOp").length === 0 && - $binaryOp.code.indexOf('>>') === -1 && - $binaryOp.code.indexOf('<<') === -1 - ) - { - inductionVariables[astId].varAccess.push({ - line : $varref.line, - replaceCode : $binaryOp.right.code - }); - } - else - { - inductionVariables[astId].varAccess.push({ - line : $varref.line, - replaceCode : $varref.name - }); - } - } - - end - condition $loop.nestedLevel === 0 && $binaryOp.kind === 'assign' end - - select file.function.loop.body.arrayAccess.subscript end - apply - if (inductionVariables[$subscript.vardecl.astId] !== undefined ) - { - var replaceCode = null; - for(obj of inductionVariables[$subscript.vardecl.astId].varAccess) - if (obj.line < $subscript.line) - replaceCode = obj.replaceCode; - - if (replaceCode !== null && replaceCode !== $subscript.name ) - { - strbefor = $arrayAccess.code; - $subscript.insert replace replaceCode; - AutoParStats.get().incIndunctionVariableReplacements(); - } - } - end - condition $loop.nestedLevel === 0 && $subscript.joinPointType === 'varref' end - -end diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/NormalizedBinaryOp.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/NormalizedBinaryOp.lara deleted file mode 100644 index 55323b9012..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/NormalizedBinaryOp.lara +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************************** -* -* NormalizedBinaryOp -* -**************************************************************/ -aspectdef NormalizedBinaryOp - - select file.function.body.binaryOp end - apply - var Op = null; - if ($binaryOp.kind === 'add') - Op = '+'; - else if ($binaryOp.kind === 'sub') - Op = '-'; - else if ($binaryOp.kind === 'mul') - Op = '*'; - else if ($binaryOp.kind === 'div') - Op = '/'; - - if (Op !== null) - $binaryOp.insert replace $binaryOp.left.code + '=' + $binaryOp.left.code + Op + '(' + $binaryOp.right.code + ')'; - end - condition $binaryOp.astName === 'CompoundAssignOperator' end - - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/OmegaConfig.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/OmegaConfig.lara deleted file mode 100644 index 86367b0a59..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/OmegaConfig.lara +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Configurations related with Omega framework. - * - * @class - */ -var OmegaConfig = {}; - -OmegaConfig.petitExecutable = null; - -/* - * - */ -OmegaConfig.setPetitExecutable = function(petitExecutable) { - OmegaConfig.petitExecutable = petitExecutable; -} \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/Parallelize.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/Parallelize.lara deleted file mode 100644 index cbbdf47014..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/Parallelize.lara +++ /dev/null @@ -1,333 +0,0 @@ -import clava.autopar.InlineFunctionCalls; -import clava.autopar.RemoveNakedloops; -import clava.autopar.NormalizedBinaryOp; -import clava.autopar.ParallelizeLoop; -import clava.autopar.AddPragmaLoopIndex; -import clava.autopar.RunInlineFunctionCalls; -import clava.autopar.LoopInductionVariables; -import clava.autopar.CheckForSafeFunctionCall; -import clava.autopar.AutoParStats; - -import clava.Clava; -import clava.util.CodeInserter; -import lara.Io; - -import weaver.Query; - -/** - * Utility methods for parallelization. - * - * @class - */ -var Parallelize = {}; -var OmpPragmas = {}; - -/** - * @param $loops {$loop[]} an array of for loops to attempt to parallelize. If undefined, tries to parallelize all for loops in the program. - */ -Parallelize.forLoops = function($loops) { - - //var parallelLoops = Parallelize.getForLoopsPragmas($loops); - var autoparResult = Parallelize.getForLoopsPragmas($loops, true); - var parallelLoops = autoparResult["parallelLoops"]; - var unparallelizableLoops = autoparResult["unparallelizableLoops"]; - - // Add pragmas to loops - /* - for(var $loop of $loops) { - var ompPragma = parallelLoops[$loop.astId]; - if(ompPragma === undefined) { - console.log("Could not parallelize loop@"+$loop.location); - //console.log("Could not parallelize loop@"+$loop.location+":\n -> " + unparallelizableLoops[$loop.astId]); - continue; - } - - $loop.insertBefore(ompPragma); - - // Add include - $loop.getAncestor("file").addInclude("omp.h",true); - } - */ - - console.log('Parallelization finished'); -} - -/** - * - */ -Parallelize.forLoopsAsText = function($loops, outputFolder) { - - if(outputFolder === undefined) { - outputFolder = Io.getPath("./"); - } - - var autoparResult = Parallelize.getForLoopsPragmas($loops, true); - var parallelLoops = autoparResult["parallelLoops"]; - var unparallelizableLoops = autoparResult["unparallelizableLoops"]; - - var codeInserter = new CodeInserter(); - var filesWithPragmas = {}; - - // Add pragmas to loops - for(var $loop of $loops) - { - var ompPragma = parallelLoops[$loop.astId]; - if(ompPragma === undefined) - { - //console.log("Could not parallelize loop@"+$loop.location+":\n -> " + unparallelizableLoops[$loop.astId]); - continue; - } - - - var $file = $loop.getAncestor("file"); - if($file === undefined) - { - console.log("Could not find a file associated with loop@"+$loop.location); - continue; - } - - codeInserter.add($file, $loop.line, ompPragma); - - // Add file - filesWithPragmas[$file] = true; - } - - // Add includes to files that have pragmas - for(var $file in filesWithPragmas) { - codeInserter.add($file, 1, "#include "); - } - - codeInserter.write(outputFolder); - - console.log('Parallelization finished'); -} - - -/** - * - * @param {$loop[]} [$loops=] - Array of loops to parallelize. - * @param {boolean} insertPragma - If true, inserts the found pragmas in the code. - * @param {boolean} useLoopId - If true, the returning map uses $loop.id instead of $loop.astId as keys. - * - * @return {Object[parallelLoops, unparallelizableLoops]} an object with the pragmas of the parallelized loops, and the error messages of the loops that could not be parallelized. - */ -Parallelize.getForLoopsPragmas = function($loops, insertPragma, useLoopId) { - if(insertPragma === undefined) { - insertPragma = false; - } - - if(useLoopId === undefined) { - useLoopId = false; - } - - // Reset stats - //Parallelize.resetStats(); - - // Initialize loops if undefined - if($loops === undefined) { - $loops = Clava.getProgram().getDescendants('loop'); - } - - // Filter any loop that is not a for loop - var $forLoops = []; - for(var $loop of $loops) { - if($loop.kind !== "for") { - continue; - } - - $forLoops.push($loop); - } - - // Save the current AST, before applying modifications that help analysis - Clava.pushAst(); - - - // Mark all for loops with pragmas - for($originalLoop of $forLoops) { - if($originalLoop.kind !== "for") { - continue; - } - - var $loop = Clava.findJp($originalLoop); - - $loop.insertBefore("#pragma parallelize_id " + $originalLoop.astId); - } - - - // Transformations to help analysis - call RemoveNakedloops; - call AddPragmaLoopIndex; - call RunInlineFunctionCalls; - - // Rebuild tree - Clava.rebuild(); - /* - select program end - apply - $program.rebuild(); - end - */ - - call LoopInductionVariables; - call CheckForSafeFunctionCall; - call RemoveNakedloops; - call NormalizedBinaryOp; - - // Rebuild tree - Clava.rebuild(); - /* - select program end - apply - $program.rebuild(); - end - */ - - - // Write stats before attempting parallelization - AutoParStats.save(); - - console.log('Parallelizing ' + $forLoops.length + ' for loops...'); - - // Find all loops marked for parallelization - //var loopPragmas = {}; - var parallelLoops = {}; - var unparallelizableLoops = {}; - - $pragmas = Clava.getProgram().getDescendants('pragma'); - for(var $pragma of $pragmas) { - if($pragma.name !== "parallelize_id") { - continue; - } - - var parallelization = call ParallelizeLoop($pragma.target); - - /* - if(parallelization.ompPragma === undefined) - { - unparallelizableLoops[$pragma.content] = parallelization.errorMsg; - } - else - { - parallelLoops[$pragma.content] = parallelization.ompPragma; - } - */ - } - - // Revert AST changes - Clava.popAst(); - - var loopIds = []; - for (var $loop of $loops) { - loopIds.push($loop.id); - } - - for(var $loop of Query.search('loop').get()) { - //select file.function.loop end - //apply - var loopindex = GetLoopIndex($loop); - if (OmpPragmas[loopindex] !== undefined && loopIds.includes($loop.id)) - { - if(insertPragma) { - $loop.insert before OmpPragmas[loopindex].pragmaCode; - } - - // parallelLoops[$pragma.content] = OmpPragmas[loopindex].pragmaCode; - var pragmaCode = OmpPragmas[loopindex].pragmaCode; - var loopId = useLoopId ? $loop.id : $loop.astId; - if(pragmaCode.startsWith("#pragma")) { - parallelLoops[loopId] = pragmaCode; - } else { - unparallelizableLoops[loopId] = pragmaCode; - } - - } - - //end - } - - //Clava.rebuild(); - /* - select program end - apply - $program.rebuild(); - end - */ - - - var result = {}; - result["parallelLoops"] = parallelLoops; - result["unparallelizableLoops"] = unparallelizableLoops; - - return result; - - //return parallelLoops; -} - -/* -Parallelize.getStats = function($loops) { - if(Parallelize._stats === undefined) { - Parallelize._stats = new AutoParStats(); - } - - return Parallelize._stats; -} - -Parallelize.resetStats = function($loops) { - Parallelize._stats = undefined; -} - -Parallelize.saveStats = function($loops) { - if(Parallelize._stats === undefined) { - return; - } - - Parallelize._stats.write(); -} -*/ - - -/** - * Comments OpenMP pragmas that are nested inside other OpenMP pragmas. - * - * @return {String} the loop ids of loops whose OpenMP pragmas where commented. - */ -Parallelize.removeNestedPragmas = function() { - - var pragmasToComment = []; - var commentedLoopIds = []; - - for(var $omp of Query.search("omp")) { - if(Parallelize.isNestedOpenMP($omp)) { - pragmasToComment.push($omp); - commentedLoopIds.push($omp.target.id); - } - } - - for(var $pragma of pragmasToComment) { - $pragma.replaceWith("// " + $pragma.code); - } - - return commentedLoopIds; -} - - -Parallelize.isNestedOpenMP = function($omp) { - - // Check if OpenMP pragma is inside a loop with another OpenMP pragma - var $loop = $omp.target; - - var $ancestor = $loop.parent; - while($ancestor !== undefined) { - if($ancestor.instanceOf("loop")) { - for(var $pragma of $ancestor.pragmas) { - if($pragma.instanceOf("omp")) { - return true; - } - } - } - - $ancestor = $ancestor.parent; - } - - return false; -} \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ParallelizeLoop.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ParallelizeLoop.lara deleted file mode 100644 index b0aaabda61..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/ParallelizeLoop.lara +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************** -* -* ParallelizeLoop -* -**************************************************************/ -import clava.autopar.checkForOpenMPCanonicalForm; -import clava.autopar.AddOpenMPDirectivesForLoop; -import clava.autopar.SetVariableAccess; -import clava.autopar.additionalConditionsCheck; -import clava.autopar.SetVarrefOpenMPscoping; -import clava.autopar.SetMemberAccessOpenMPscoping; -import clava.autopar.BuildPetitFileInput; -import clava.autopar.ExecPetitDependencyTest; -import clava.autopar.SetArrayAccessOpenMPscoping; - -var LoopOmpAttributes = {}; - -aspectdef ParallelizeLoop - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - - call checkForOpenMPCanonicalForm($ForStmt); - - call additionalConditionsCheck($ForStmt); - - call SetVariableAccess($ForStmt); - - call SetVarrefOpenMPscoping($ForStmt); - - call BuildPetitFileInput($ForStmt); - - call ExecPetitDependencyTest($ForStmt); - - call SetArrayAccessOpenMPscoping($ForStmt); - - // remove all variable declared inside loop , i changed SetVariableAccess code!!!! - call AddOpenMPDirectivesForLoop($ForStmt); - - - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/README.md b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/README.md deleted file mode 100644 index f9220b333c..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# acknowledgments - -This work has been partially funded by the [ANTAREX project](http://antarex-project.eu) through the EU H2020 FET-HPC program under grant no. 671623. diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveNakedloops.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveNakedloops.lara deleted file mode 100644 index 3d755b1618..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveNakedloops.lara +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************** -* -* RemoveNakedloops -* -**************************************************************/ -aspectdef RemoveNakedloops - - select file.function.loop.body end - apply - $body.exec setNaked(false); - //$body.insert before '{'; - //$body.insert after '}'; - end - condition $body.naked === true end - - - //select file.function.loop.body.if.then end - select file.function.body.if.then end - apply - $then.exec setNaked(false); - end - condition $then.naked === true end - - - - //select file.function.loop.body.if.else end - select file.function.body.if.else end - apply - $else.exec setNaked(false); - end - condition $else.naked === true end - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveOpenMPfromInnerloop.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveOpenMPfromInnerloop.lara deleted file mode 100644 index bd448bb9b4..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RemoveOpenMPfromInnerloop.lara +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************** -* -* RemoveOpenMPfromInnerloop -* -**************************************************************/ -aspectdef RemoveOpenMPfromInnerloop - - select program.file.function.body.omp end - apply - if ($omp.kind === 'parallel for') - { - if (typeof $omp.target !== 'undefined') - call RemoveSubOmpParallel($omp.target); - } - end - - - var exclude_func_from_Omp = []; - select program.file.function.body.omp end - apply - if ($omp.kind === 'parallel for') - { - if (typeof $omp.target !== 'undefined') - { - call o : find_func_call($omp.target); - for(var func_name of o.func_names) - if (exclude_func_from_Omp.indexOf(func_name) === -1) - exclude_func_from_Omp.push(func_name); - } - } - end - - select program.file.function.body.omp end - apply - func_name = $omp.getAstAncestor('FunctionDecl').name; - if (exclude_func_from_Omp.indexOf(func_name) !== -1) - - $omp.insert replace('// #pragma omp ' + $omp.content + ' remove due to be part of parallel section for function call'); - - end - condition $omp.kind === 'parallel for' end - -end -/************************************************************** -* -* RemoveSubOmpParallel -* -**************************************************************/ -aspectdef RemoveSubOmpParallel - input $loop end - - select $loop.body.omp end - apply - if ($omp.kind === 'parallel for') - $omp.insert replace('// #pragma omp ' + $omp.content); - end - -end - - -aspectdef find_func_call - input $loop end - output func_names end - this.func_names = []; - - select $loop.body.call end - apply - this.func_names.push($call.name); - end - condition $call.astName === 'CallExpr' end - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RunInlineFunctionCalls.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RunInlineFunctionCalls.lara deleted file mode 100644 index e8ad94da01..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/RunInlineFunctionCalls.lara +++ /dev/null @@ -1,552 +0,0 @@ -/************************************************************** -* -* RunInlineFunctionCalls -* -**************************************************************/ -import clava.ClavaJoinPoints; -import clava.ClavaType; - -import clava.autopar.AutoParStats; - -var countCallInlinedFunction; -aspectdef RunInlineFunctionCalls - - - var func_name = {}; - countCallInlinedFunction = 0; - select file.function end - apply - if (func_name[$function.name] === undefined) - { - func_name[$function.name] = {}; - func_name[$function.name].innerCallNumber = 0; - func_name[$function.name].CallingFunc = []; - } - end - - select file.function end - apply - var innerCalls = $function.getDescendants('call'); - - func_name[$function.name].innerCallNumber = innerCalls.length; - for(var obj of innerCalls) - if (safefunctionCallslist.indexOf(obj.name) === -1) - func_name[$function.name].CallingFunc.push(obj.name); - end - - - - - var flag = false; - while(1) - { - flag = false; - for (var caller_func in func_name) - for(var calling of func_name[caller_func].CallingFunc) - if (calling !== caller_func && func_name[calling] !== undefined ) - { - for(var func of func_name[calling].CallingFunc) - if (func_name[caller_func].CallingFunc.indexOf(func) ===-1 ) - { - func_name[caller_func].CallingFunc.push(func); - flag = true; - } - } - - if (flag === false) - break; - } - - - - var excluded_function_list = []; - // check for recursive function calls - for (var caller_func in func_name) - { - - if ( - func_name[caller_func].CallingFunc.indexOf(caller_func) !== -1 && - excluded_function_list.indexOf(caller_func) === -1 // not exist - ) - { - debug("Excluding from inlining '" + caller_func + "', because it is recursive"); - excluded_function_list.push(caller_func); - AutoParStats.get().incInlineAnalysis(AutoParStats.EXCLUDED_RECURSIVE, caller_func); - } - - - } - - - select file.function end - apply - var innerCalls = $function.getDescendants('call'); - - for(var obj of innerCalls) - if (safefunctionCallslist.indexOf(obj.name) === -1 && func_name[obj.name] === undefined ) - if (excluded_function_list.indexOf($function.name) === -1) { // not exist - debug("Excluding from inlining '" + caller_func + "', because is not considered safe (func_name[obj.name]: " + func_name[obj.name] + ")"); - excluded_function_list.push($function.name); - AutoParStats.get().incInlineAnalysis(AutoParStats.EXCLUDED_IS_UNSAFE, $function.name); - } - end - - - // Exclude functions that have global variable declarations - select file.function.body.vardecl end - apply - /* - if($vardecl.isGlobal !== ($vardecl.storageClass === 'static')) { - console.log("DIFF!!!"); - console.log("isGlobal: " + $vardecl.isGlobal); - console.log("Storage class: " + $vardecl.storageClass); - } - */ - - - if(!$vardecl.isGlobal) { - //if($vardecl.storageClass !== 'static') { - continue; - } - - if (excluded_function_list.indexOf($function.name) === -1) { - debug("Excluding from inlining '" + $function.name + "', because it declares at least one global variable ("+$vardecl.name+"@"+$vardecl.location+")"); - excluded_function_list.push($function.name); - AutoParStats.get().incInlineAnalysis(AutoParStats.EXCLUDED_GLOBAL_VAR, $function.name); - } - end - //condition $vardecl.storageClass === 'static' end - //condition $vardecl.isGlobal end - - /* - // Exclude functions that have references to global variables - select file.function.body.varref end - apply - var $vardecl = $varref.declaration; - if($vardecl === undefined) { - continue; - } - - if(!$vardecl.isGlobal) { - continue; - } - - if (excluded_function_list.indexOf($function.name) === -1) { - debug("Excluding from inlining '" + $function.name + "', because it has references to global variables"); - excluded_function_list.push($function.name); - } - end - */ - - for (var caller_func in func_name) - for(var calling of func_name[caller_func].CallingFunc) - if ( - excluded_function_list.indexOf(calling) !== -1 && - excluded_function_list.indexOf(caller_func) === -1 - ) - { - debug("Excluding from inlining '" +caller_func + "', because it calls excluded function '"+calling+"'"); - excluded_function_list.push(caller_func); - AutoParStats.get().incInlineAnalysis(AutoParStats.EXCLUDED_CALLS_UNSAFE, caller_func); - } - - - - debug("Functions excluded from inlining: " + excluded_function_list); - AutoParStats.get().setInlineExcludedFunctions(excluded_function_list); - - var sorted = []; - for (var key in func_name) - { - sorted.push([ key, func_name[key].innerCallNumber ]); - } - sorted.sort(function compare(obj1, obj2) {return obj1[1] - obj2[1];}); - - for(i in sorted) - if (excluded_function_list.indexOf(sorted[i][0]) === -1) - { - call callInline(sorted[i][0]); - } -end - - - -/************************************************************** -* -* callInline -* -**************************************************************/ -aspectdef callInline - input func_name end - - select file.function.call end - apply - - var exprStmt = $call.getAstAncestor('ExprStmt'); - - if (exprStmt === undefined) - { - continue; - } - - - if ( - (// funcCall(...) - exprStmt.children[0].joinPointType === 'call' && - exprStmt.getDescendantsAndSelf('call').length ===1 && - exprStmt.children[0].name === func_name - ) - || - (// var op funcCall(...) - exprStmt.children[0].joinPointType === 'binaryOp' && - exprStmt.children[0].right.joinPointType === 'call' && - exprStmt.children[0].right.getDescendantsAndSelf('call').length === 1 - ) - ) - { - // Count as an inlined call - AutoParStats.get().incInlineCalls(); - - var o = null; - call o : inlinePreparation(func_name, $call, exprStmt); - - - if(o.$newStmts.length > 0) - { - var replacedCallStr = '// ClavaInlineFunction : ' + exprStmt.code + ' countCallInlinedFunction : ' + countCallInlinedFunction; - - // Insert after to preserve order of comments - var currentStmt = exprStmt.insertAfter(replacedCallStr); - for(var $newStmt of o.$newStmts) - { - currentStmt = currentStmt.insertAfter($newStmt); - } - - exprStmt.detach(); - } - } - - end - condition $call.name === func_name && $call.getAstAncestor('ForStmt') !== undefined end - - //call aspec_rebuild; -end - - -aspectdef aspec_rebuild - select program end - apply - $program.rebuild(); - end -end - -/************************************************************** -* -* inlinePreparation -* -**************************************************************/ -aspectdef inlinePreparation - input func_name, callStmt, exprStmt end - output replacedCallStr, $newStmts end - - this.replacedCallStr = ''; - - this.$newStmts = []; - - var funcJP = null; - var funcJP_backup = null; - select function end - apply - funcJPOrginal = $function; - - funcJP = $function.clone(func_name + '_clone'); - - funcJP_backup = $function.copy(); - funcJP_backupCode = $function.code; - funcAst_backup = $function.ast; - - break; - end - condition $function.name === func_name && $function.hasDefinition === true end - - if (funcJP === null) - { - debug("RunInlineFunctionCalls::inlinePreparation: Could not find the definition of function " + func_name); - //funcJP.detach(); - return; - } - - returnStmtJPs = []; - select funcJP.body.stmt end - apply - returnStmtJPs.push($stmt); - end - condition $stmt.astName === 'ReturnStmt' end - - if ( - funcJP.functionType.returnType.code === 'void' - && - ( - returnStmtJPs.length > 1 || - (returnStmtJPs.length === 1 && returnStmtJPs[0].isLast === false ) - ) - ) - { - funcJP.detach(); - return; - } - else // function return !== void - { - if ( - returnStmtJPs.length > 1 || - (returnStmtJPs.length === 1 && returnStmtJPs[0].isLast === false ) - ) - { - funcJP.detach(); - return; - } - - } - - if (funcJP.functionType.returnType.code === 'void' && returnStmtJPs.length === 1) - { - returnStmtJPs[0].detach(); - } - - countCallInlinedFunction = countCallInlinedFunction + 1; - - var param_table = {}; - - select funcJP.body.vardecl end - apply - if ($vardecl.qualifiedName !== $vardecl.name) - continue; - - var newDeclName = $vardecl.qualifiedName + "_" + countCallInlinedFunction; - param_table[$vardecl.name] = newDeclName; - $vardecl.name = newDeclName; - - end - - - select funcJP.body.varref end - apply - var varrefName = $varref.name; - var newVarrefName = updateVarrefName(varrefName, param_table); - if(varrefName !== newVarrefName) { - $varref.setName(newVarrefName); - } - end - - select funcJP.body.varref end - apply - $varref.useExpr.replaceWith($varref); - end - condition $varref.vardecl !== undefined && $varref.vardecl.isParam && $varref.kind === 'pointer_access' end - - - var param_index = 0; - param_table = {}; - select funcJP.param end - apply - if ($param.type.code.indexOf('void ') !== -1) - { - funcJP.detach(); - return; - } - - if ($param.type.isBuiltin === true) - { - var orgparamName = $param.qualifiedName; - param_table[$param.name] = $param.qualifiedName + "_" + countCallInlinedFunction; - $param.name = param_table[$param.name]; - - $newVardecl = ClavaJoinPoints.varDecl($param.name, callStmt.argList[param_index].copy()); - - funcJP.body.insertBegin($newVardecl); - } - - else if ($param.type.isArray === true) - { - if (callStmt.argList[param_index].joinPointType === 'unaryOp') - { - funcJP.detach(); - return; - - var arrayVarObj = callStmt.argList[param_index].getDescendantsAndSelf('arrayAccess')[0]; - - param_table[$param.name] = arrayVarObj.arrayVar.code; - for(var index = 0 ; index < arrayVarObj.subscript.length - ($param.code.split('[').length-1) ; index++) - { - param_table[$param.name] += '[' + arrayVarObj.subscript[index].code +']'; - } - } - else if (callStmt.argList[param_index].joinPointType === 'cast') - { - - if (callStmt.argList[param_index].vardecl.type.unwrap.code !== callStmt.argList[param_index].type.unwrap.code) - { - funcJP.detach(); - return; - } - - param_table[$param.name] = callStmt.argList[param_index].subExpr.code; - } - else - { - param_table[$param.name] = callStmt.argList[param_index].code; - } - $param.name = param_table[$param.name]; - } - else if ($param.type.isPointer === true) - { - param_table[$param.name] = callStmt.argList[param_index].code.allReplace({'&':''}); - $param.name = param_table[$param.name]; - - } - param_index = param_index + 1; - end - - - select funcJP.body.varref end - apply - - if (param_table[$varref.name] !== undefined) - $varref.setName(param_table[$varref.name]); - end - condition $varref.vardecl.isParam === true end - - select funcJP.body.vardecl end - apply - var varrefs = []; - var $typeCopy = ClavaType.getVarrefsInTypeCopy($vardecl.type, varrefs); - - for(var $varref of varrefs) - { - $varref.name = param_table[$varref.name]; - } - - $vardecl.type = $typeCopy; - end - - - - if (exprStmt.children[0].joinPointType === 'binaryOp') - { - var ret_str_replacement = exprStmt.children[0].children[0].code; - - if (exprStmt.children[0].kind === 'assign') - ret_str_replacement += ' = '; - else if (exprStmt.children[0].kind === 'add_assign') - ret_str_replacement += ' += '; - else if (exprStmt.children[0].kind === 'sub_assign') - ret_str_replacement += ' -= '; - else if (exprStmt.children[0].kind === 'mul_assign') - ret_str_replacement += ' *= '; -// else -// throw "Not implemented for kind " + exprStmt.children[0].kind; - - //retJPs = funcJP.body.stmts.filter(function(obj){if (obj.astName === 'ReturnStmt') {return obj;}}); - retJPs = funcJP.body.allStmts.filter(function(obj){if (obj.astName === 'ReturnStmt') {return obj;}}); - - for(retJP of retJPs) - { - //console.log("ret_str_repl: " + ret_str_replacement); - //console.log("retJP original: " + retJP.code); - //console.log("retJP after: " + ret_str_replacement + retJP.children[0].code + ';'); - //console.log("retJp child: " + retJP.children[0]); - //retJP.insert replace ret_str_replacement + retJP.children[0].code + ';'; - - // Copy binary operation stmt - var exprStmtCopy = exprStmt.copy(); - var binaryOpCopy = exprStmtCopy.children[0]; - // Replace right hand with return expression - binaryOpCopy.right = retJP.children[0]; - - //console.log("PREVIOUS CODE: " + ret_str_replacement + retJP.children[0].code + ';'); - //console.log("CURRENT CODE: " + exprStmtCopy.code); - // Replace return with copy of expr stmt - retJP.replaceWith(exprStmtCopy); - } - - } - - select funcJP.body.comment end - apply - $comment.detach(); - end - - //var changedReplacedCall = false; - select funcJP.body.childStmt end - apply - this.$newStmts.push($childStmt.copy()); - this.replacedCallStr += $childStmt.code + '\n'; - //changedReplacedCall = true; - //console.log("ADDING: " + $childStmt.code); - end - - this.replacedCallStr = this.replacedCallStr.allReplace({' const ':' '}); - - funcJP.detach(); -end - - -function updateVarrefName(varrefName, param_table) { - - // If name is present in the table, return table value - if (param_table[varrefName] !== undefined) { - return param_table[varrefName]; - } - - // If name has a square bracket, it means it is array access - // Update the name of the array, and the contents of each subscript - - var bracketIndex = varrefName.indexOf("["); - if(bracketIndex != -1) { - var accessName = varrefName.substring(0, bracketIndex); - var newAccessName = updateVarrefName(accessName, param_table); - var suffix = varrefName.substring(bracketIndex); - var updatedSuffix = updateSubscripts(suffix, param_table); - - return newAccessName + updatedSuffix; - } - - - // Return the current name - return varrefName; -} - -function updateSubscripts(subscripts, param_table) { - //console.log("Original subscripts: '" + subscripts + "'"); - - var idRegex = /[a-zA-Z_][a-zA-Z_0-9]*/g; - var match = idRegex['exec'](subscripts); - - var startIndex = 0; - var updatedSubscripts = ""; - while (match != null) { - // matched text: match[0] - // match start: match.index - // capturing group n: match[n] - var matched = match[0]; - var matchedIndex = match.index; - //console.log(matched); - //console.log(matchedIndex); - match = idRegex['exec'](subscripts); - - var newMatched = updateVarrefName(matched, param_table); - - updatedSubscripts += subscripts.substring(startIndex, matchedIndex); - updatedSubscripts += newMatched; - - startIndex = matchedIndex + matched.length; - - //console.log("Current String: '" + updatedSubscripts + "'"); - } - - // Complete string - updatedSubscripts += subscripts.substring(startIndex, subscripts.length); - //console.log("Updated subscripts: '" + updatedSubscripts + "'"); - - return updatedSubscripts; -} \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetArrayAccessOpenMPscoping.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetArrayAccessOpenMPscoping.lara deleted file mode 100644 index 3214aa3363..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetArrayAccessOpenMPscoping.lara +++ /dev/null @@ -1,144 +0,0 @@ -/************************************************************** -* -* SetArrayAccessOpenMPscoping -* -**************************************************************/ -import clava.autopar.FindReductionArrays; - - -aspectdef SetArrayAccessOpenMPscoping - input $ForStmt end - - // Get id of the loop - var loopindex = GetLoopIndex($ForStmt); - - // If there are errors, return - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - - // TODO: This 'for' needs to be commented in order for array - // variables to appear as first private. However, commenting it - // triggers pragma generation bugs (e.g., ] in NAS CG and NAS UA) - - // Ignore array uses in the loop whose pattern is 'R' - for(var arrayAccessObj of LoopOmpAttributes[loopindex].varAccess) - if ( - arrayAccessObj.varTypeAccess === 'arrayAccess' && - arrayAccessObj.usedInClause === false && - arrayAccessObj.use === 'R' - ) - { - if (LoopOmpAttributes[loopindex].firstprivateVars.indexOf(arrayAccessObj.name) === -1) - { - LoopOmpAttributes[loopindex].firstprivateVars.push(arrayAccessObj.name); - //LoopOmpAttributes[loopindex].firstprivateVars.push(arrayAccessObj.name); - } - arrayAccessObj.usedInClause = true; - } - - - - //var arrayAccesslist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'arrayAccess', usedInClause : false}); - // Get list of array uses - var arrayAccesslist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'arrayAccess'}); - - - //print_obj(arrayAccesslist, '\n\n\n\n\n check 1 arrayAccesslist for For#' + $ForStmt.line+ '\taspectdef SetArrayAccessOpenMPscoping'); - - // If no array uses, return - if (arrayAccesslist.length ===0 ) - return; - - - var arrayAccessNamelist = []; - for (var obj of arrayAccesslist) - if (arrayAccessNamelist.indexOf(obj.name) === -1) - arrayAccessNamelist.push(obj.name); - - for(var depObj of LoopOmpAttributes[loopindex].PetitFoundDependency) - if (depObj.canbeignored === false && arrayAccessNamelist.indexOf(depObj.varName) !== -1 && depObj.cannotbesolved === false) - { - var arrayAccessObj = SearchStruct(arrayAccesslist, {name : depObj.varName})[0]; - - if (arrayAccessObj.usedInClause === true) - { - arrayAccessNamelist.splice(arrayAccessNamelist.indexOf(depObj.varName),1); - continue; - } - - if ( - depObj.IsdependentInnerloop_src === true && - depObj.IsdependentCurrentloop_src === false && - depObj.IsdependentOuterloop_src === true - ) - { - // can be ignored - arrayAccessObj.usedInClause = true; - } - - var check_depVector = true; //should be (0)*1 0,0,1 0,1 1 BUT NOT 1,0 - - if ( - depObj.varref_line_src === depObj.varref_line_dst && - depObj.src_usge === depObj.dst_usge && - check_depVector === true - ) - { - call o : FindReductionArrays($ForStmt, depObj.varName, depObj.varref_line_src, depObj.IsdependentInnerloop_src, depObj.IsdependentCurrentloop_src, depObj.IsdependentOuterloop_src); - if (o.isReductionArrays === true) - { - arrayAccessNamelist.splice(arrayAccessNamelist.indexOf(depObj.varName),1); - arrayAccessObj.usedInClause = true; - } - } - - } - - for(var arrayAccessObj of arrayAccesslist) - if (arrayAccessObj.usedInClause === false) - { - arrayAccessObj.usedInClause = true; - for(var depObj of LoopOmpAttributes[loopindex].PetitFoundDependency) - if (depObj.varName === arrayAccessObj.name) - arrayAccessObj.usedInClause = arrayAccessObj.usedInClause && depObj.canbeignored && (depObj.cannotbesolved === false); - - if ( - arrayAccessObj.usedInClause === true && // TODO: Unnecessary? - arrayAccessObj.use.indexOf('W') === -1 && - LoopOmpAttributes[loopindex].firstprivateVars.indexOf(arrayAccessObj.name) === -1 - ) - { - LoopOmpAttributes[loopindex].firstprivateVars.push(arrayAccessObj.name); - } - - } - - for(var arrayAccessObj of arrayAccesslist) - for(var depObj of LoopOmpAttributes[loopindex].PetitFoundDependency) - if ( - depObj.varName === arrayAccessObj.name && - arrayAccessObj.use === 'WR' && - depObj.IsdependentCurrentloop_dst === false - ) - { - if (LoopOmpAttributes[loopindex].firstprivateVars.indexOf(arrayAccessObj.name) === -1&& - LoopOmpAttributes[loopindex].Reduction_listVars.indexOf(arrayAccessObj.name) === -1 - ) - { - LoopOmpAttributes[loopindex].firstprivateVars.push(arrayAccessObj.name); - arrayAccessObj.usedInClause = true; - } - - } - - for(var arrayAccessObj of LoopOmpAttributes[loopindex].varAccess) - if ( - arrayAccessObj.varTypeAccess === 'arrayAccess' && - arrayAccessObj.usedInClause === false - ) - { - Add_msgError(LoopOmpAttributes, $ForStmt,'unsolved dependency for arrayAccess ' + arrayAccessObj.name + '\t use : ' + arrayAccessObj.use ); - } - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetMemberAccessOpenMPscoping.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetMemberAccessOpenMPscoping.lara deleted file mode 100644 index 83329021bd..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetMemberAccessOpenMPscoping.lara +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************** -* -* SetMemberAccessOpenMPscoping -* -**************************************************************/ - -aspectdef SetMemberAccessOpenMPscoping - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - - var varreflist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'memberAccess'}); - - print_obj(varreflist, 'aspectdef SetMemberAccessOpenMPscoping : varAccess for For#' + $ForStmt.line); - - - - - - for(var i = 0; i < varreflist.length; i++) - { - var varObj = varreflist[i]; - if ( - varObj.hasDescendantOfArrayAccess === false && - varObj.usedInClause === false && - varObj.nextUse !== 'R' && - (varObj.use === 'WR' || varObj.use === 'W') - ) - { - varObj.usedInClause = true; - } - } - - for(var i = 0; i < varreflist.length; i++) - if (varreflist[i].usedInClause === false) - { - Add_msgError(LoopOmpAttributes, $ForStmt,'Variable ' + varreflist[i].name + ' could not be categorized into any OpenMP Variable Scope'); - } - - - - print_obj(varreflist, 'aspectdef SetMemberAccessOpenMPscoping : varAccess for For#' + $ForStmt.line); -end - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVariableAccess.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVariableAccess.lara deleted file mode 100644 index 63ff7abef4..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVariableAccess.lara +++ /dev/null @@ -1,346 +0,0 @@ -/************************************************************** -* -* SetVariableAccess -* -**************************************************************/ -import lara.Strings; -import clava.autopar.get_varTypeAccess; - - -aspectdef SetVariableAccess - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - - var innerloopsControlVarname = []; - var loopControlVarname = LoopOmpAttributes[loopindex].loopControlVarname; - innerloopsControlVarname = innerloopsControlVarname.concat(LoopOmpAttributes[loopindex].innerloopsControlVarname); - - - LoopOmpAttributes[loopindex].varAccess = []; - - var $forFunction = $ForStmt.getAstAncestor('FunctionDecl'); - if($forFunction === undefined) - { - var $forRoot = $ForStmt.parent; - while($forRoot.parent !== undefined) - { - $forRoot = $forRoot.parent; - } - } - - var functionvarrefset = orderedVarrefs3($ForStmt.getAstAncestor('FunctionDecl')); - var loopvarrefset = orderedVarrefs3($ForStmt); - - - var noVarrefVariables = []; - - for(var index = 0; index < loopvarrefset.length; index++) - { - var $varref = loopvarrefset[index]; - - call o : get_varTypeAccess($varref); - var varTypeAccess = o.varTypeAccess; - - if (varTypeAccess === null) - { - continue; - } - - var vardecl = o.vardecl; - var varUse = o.varUse; - var declpos = null; - var varName = o.varName; - - if (varTypeAccess !== 'varref' && noVarrefVariables.indexOf(varName) === -1) - noVarrefVariables.push(varName); - - var useExpr = (varUse === 'read') ? 'R' : (varUse === 'write') ? 'W' : 'RW'; - -// if(vardecl !== null && vardecl.currentRegion === undefined) { -// console.log("UNDEFINED REGION IN VARDECL " + vardecl.name +"@" + vardecl.location); -// console.log("VARDECL ROOT: " + vardecl.root.ast); -// } - -// if (vardecl !== null || vardecl === undefined) - if (vardecl !== null) - { - - var vardeclRegion = ""; - if(vardecl.currentRegion !== undefined) { - vardeclRegion = vardecl.currentRegion.joinPointType; - } - //var vardeclRegion = vardecl.currentRegion.joinPointType; - - - if ($ForStmt.contains(vardecl) === true) - declpos = 'inside'; - else if (vardecl.joinPointType === 'param') - declpos = 'param'; - else if (vardeclRegion === 'file') - declpos = 'global'; - else if (vardeclRegion === 'function') - declpos = 'outside'; - else if (vardeclRegion === 'loop') - declpos = 'outside'; - else if (vardeclRegion === 'scope') - declpos = 'inside'; - else if (vardecl.getAstAncestor('FunctionDecl').name === $ForStmt.getAstAncestor('FunctionDecl').name) - declpos = 'outside'; - else - { - Add_msgError(LoopOmpAttributes, $ForStmt,'declpos for Variable ' + $varref.name + ' can not be specified ' - + '\t vardeclRegion : ' + vardeclRegion - + '\t $ForStmt.contains(vardecl) : ' + $ForStmt.contains(vardecl) - + '\t vardecl : ' + vardecl.code + ' #' + vardecl.line); - return; - } - } - - - if ( - (varTypeAccess === 'varref' && (innerloopsControlVarname.indexOf($varref.name) !== -1 || loopControlVarname === $varref.name)) // is loop control variable - ) - continue; - if ($varref.isFunctionArgument === true) - { - var callJP = $varref.getAncestor('call'); - if (safefunctionCallslist.indexOf(callJP.name) === -1) - { - Add_msgError(LoopOmpAttributes, $ForStmt,'Variable Access for ' + $varref.name + ' Can not be traced inside of function ' + callJP.name + ' called at line #' + callJP.line); - return; - } - } - - var hasDescendantOfArrayAccess = false; - if ($varref.getDescendantsAndSelf('arrayAccess').length > 0) - hasDescendantOfArrayAccess = true; - - var varUsage = null; - var arraysizeStr = null; - - varUsage = { - line : $varref.line, - use : useExpr, - code : $varref.code, - isInsideLoopHeader : $varref.isInsideLoopHeader, - parentlooprank : $varref.getAstAncestor('ForStmt').rank - }; - - if (varTypeAccess === 'memberArrayAccess' || varTypeAccess === 'arrayAccess') - { - varUsage.subscript = $varref.subscript; - if (vardecl !== null) - { - arraysizeStr = vardecl.code; - arraysizeStr = arraysizeStr.slice(arraysizeStr.indexOf('['),arraysizeStr.lastIndexOf(']')+1); - if (arraysizeStr.length === 0) // parameter pass as : int *array - arraysizeStr = null; - } - } - - if (hasDescendantOfArrayAccess === true) - { - if ($varref.subscript === undefined) - { - Add_msgError(LoopOmpAttributes, $ForStmt,' NO subscript for Array Access ' + $varref.code); - return; - } - - call o : retsubscriptcurrentloop($varref, loopControlVarname); - varUsage.subscriptcurrentloop = o.subscriptstr; - - var subscriptVarNamelist = []; - for(var arrayAccessobj of $varref.getDescendantsAndSelf('arrayAccess')) - { - call retsubscriptVars(arrayAccessobj,subscriptVarNamelist); - } - - varUsage.IsdependentCurrentloop = false; - if (subscriptVarNamelist.indexOf(loopControlVarname) !== -1) - varUsage.IsdependentCurrentloop = true; - - varUsage.IsdependentInnerloop = false; - for( var innerloopsVarname of innerloopsControlVarname) - if (subscriptVarNamelist.indexOf(innerloopsVarname) !== -1) - { - varUsage.IsdependentInnerloop = true; - break; - } - - varUsage.IsdependentOuterloop = false; - for( var subscriptVarName of subscriptVarNamelist) - if ( - subscriptVarName !== loopControlVarname && - innerloopsControlVarname.indexOf(subscriptVarName) === -1 - ) - { - var varObj = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'varref', name : subscriptVarName}); - - if (varObj.length !== 0 && varObj[0].use.indexOf('W') !== -1) - break; - varUsage.IsdependentOuterloop = true; - break; - } - - - var strdep = ''; - strdep = strdep + (varUsage.IsdependentCurrentloop === true ? ' dependentCurrentloop\t ' : '\t '); - strdep = strdep + (varUsage.IsdependentInnerloop === true ? ' dependentInnerloop\t ' : '\t '); - strdep = strdep + (varUsage.IsdependentOuterloop === true ? ' IsdependentOuterloop\t ' : '\t '); - } - - var varObj = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : varTypeAccess, name : varName}); - - if (varObj.length ===0) - { - var varNextUse = FindVariableNextUse(functionvarrefset, LoopOmpAttributes[loopindex].end, varTypeAccess, varName); - - LoopOmpAttributes[loopindex].varAccess.push({ - name : varName, - varTypeAccess : varTypeAccess, - isInsideLoopHeader : $varref.isInsideLoopHeader, - declpos : declpos, - usedInClause : false, - use : useExpr, - sendtoPetit : false, - useT : useExpr, - nextUse : varNextUse, - varUsage : [varUsage], - ArraySize : arraysizeStr, - hasDescendantOfArrayAccess : hasDescendantOfArrayAccess - }); - } - else - { - for(var i=0;i loopEndline) - { - var $varobj = functionvarrefset[index]; - call o : get_varTypeAccess($varobj); - if (o.varTypeAccess === varTypeAccess && o.varName === varName) - { - varNextUse = (o.varUse == 'read') ? 'R' : (o.varUse == 'write') ? 'W' : 'RW'; - break; - } - } - - return varNextUse; -} - -aspectdef retsubscriptVars - input $stmt, varNamelist end - - select $stmt.subscript end - apply - for($varref of $subscript.getDescendantsAndSelf("varref")) - if (varNamelist.indexOf($varref.name) === -1) - varNamelist.push($varref.name); - end - -end - - -aspectdef retsubscriptcurrentloop - input $varref, loopControlVarname end - output subscriptstr end - - this.subscriptstr = ''; - - select $varref.subscript end - apply - for($varref of $subscript.getDescendantsAndSelf("varref")) - if ( $varref.name === loopControlVarname) - { - this.subscriptstr += '[' + $subscript.code +']'; - break; - } - end - -end - - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVarrefOpenMPscoping.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVarrefOpenMPscoping.lara deleted file mode 100644 index 4f18fe9e11..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/SetVarrefOpenMPscoping.lara +++ /dev/null @@ -1,145 +0,0 @@ -/************************************************************** -* -* SetVarrefOpenMPscoping -* -**************************************************************/ -import clava.autopar.checkvarreReduction; - -aspectdef SetVarrefOpenMPscoping - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - var varreflist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'varref'}); - - - for(var i = 0; i < varreflist.length; i++) - if (varreflist[i].declpos === 'inside') - varreflist[i].usedInClause = true; - - - - - //------------------------------------------------------------ - // add all sub loop control vars to private list - //------------------------------------------------------------ - var loopsControlVarname = []; - loopsControlVarname.push(LoopOmpAttributes[loopindex].loopControlVarname); - if (LoopOmpAttributes[loopindex].innerloopsControlVarname !== undefined ) - loopsControlVarname = loopsControlVarname.concat(LoopOmpAttributes[loopindex].innerloopsControlVarname); - - for(var i = 0; i < loopsControlVarname.length; i++) - if (LoopOmpAttributes[loopindex].privateVars.indexOf(loopsControlVarname[i]) === -1) - LoopOmpAttributes[loopindex].privateVars.push(loopsControlVarname[i]); - - - //------------------------------------------------------------ - // add all vars which [use==WR or use==W] and [nextUse==null] and are local function var - //------------------------------------------------------------ - for(var i = 0; i < varreflist.length; i++) - { - var varObj = varreflist[i]; - if ( - varObj.usedInClause === false && - varObj.nextUse !== 'R' && - (varObj.use === 'WR' || varObj.use === 'W') - ) - { - if ( LoopOmpAttributes[loopindex].privateVars.indexOf(varObj.name) === -1 ) - LoopOmpAttributes[loopindex].privateVars.push(varObj.name); - varObj.usedInClause = true; - } - } - - //------------------------------------------------------------ - // find Reduction for variable access - //------------------------------------------------------------ - call o : checkvarreReduction($ForStmt); - LoopOmpAttributes[loopindex].reduction = LoopOmpAttributes[loopindex].reduction.concat(o.Reduction); - - - //------------------------------------------------------------ - // Fill firstprivate and lastprivate - // Restrictions : - // - A variable that is part of another variable (as an array or structure element) cannot appear in a private clause - // - If a list item appears in both firstprivate and lastprivate clauses, the update required for lastprivate occurs after all the initializations for firstprivate - // - A list item that appears in a reduction clause of a parallel construct must not appear in a firstprivate clause - // - A variable that appears in a firstprivate clause must not have an incomplete C/C++ type or be a reference to an incomplete type - //------------------------------------------------------------ - for(var i = 0; i < varreflist.length; i++) - if ( - varreflist[i].usedInClause === false && - varreflist[i].declpos !== 'inside' - ) - { - if (varreflist[i].use === 'R' && - LoopOmpAttributes[loopindex].firstprivateVars.indexOf(varreflist[i].name) === -1) - { - LoopOmpAttributes[loopindex].firstprivateVars.push(varreflist[i].name); - varreflist[i].usedInClause = true; - } - - if (varreflist[i].nextUse === 'R' && - varreflist[i].use.indexOf('W') !== -1 && - varreflist[i].use.indexOf('RW') === -1) // hamid changed for EP benchmark - { - LoopOmpAttributes[loopindex].lastprivateVars.push(varreflist[i].name); - varreflist[i].usedInClause = true; - } - } - - //------------------------------------------------------------ - // simple test if all variable used in Clauses are set as usedInClause - //------------------------------------------------------------ - for(var i = 0; i < varreflist.length; i++) - if ( - varreflist[i].usedInClause === false && - ( - LoopOmpAttributes[loopindex].firstprivateVars.indexOf(varreflist[i].name) !== -1 || - LoopOmpAttributes[loopindex].lastprivateVars.indexOf(varreflist[i].name) !== -1 || - LoopOmpAttributes[loopindex].privateVars.indexOf(varreflist[i].name) !== -1 - ) - ) - { - varreflist[i].usedInClause = true; - } - - - for(var i = 0; i < varreflist.length; i++) - if (varreflist[i].usedInClause === false) - { - Add_msgError(LoopOmpAttributes, $ForStmt,'Variable ' + varreflist[i].name + ' could not be categorized into any OpenMP Variable Scope' + 'use : ' + varreflist[i].use); - - - } - - - select $ForStmt.vardecl end - apply - if (LoopOmpAttributes[loopindex].privateVars.indexOf($vardecl.name) !== -1) - LoopOmpAttributes[loopindex].privateVars.splice(LoopOmpAttributes[loopindex].privateVars.indexOf($vardecl.name), 1); - - if (LoopOmpAttributes[loopindex].firstprivateVars.indexOf($vardecl.name) !== -1) - LoopOmpAttributes[loopindex].firstprivateVars.splice(LoopOmpAttributes[loopindex].firstprivateVars.indexOf($vardecl.name), 1); - - if (LoopOmpAttributes[loopindex].lastprivateVars.indexOf($vardecl.name) !== -1) - LoopOmpAttributes[loopindex].lastprivateVars.splice(LoopOmpAttributes[loopindex].lastprivateVars.indexOf($vardecl.name), 1); - end - - select $ForStmt.varref end - apply - if (LoopOmpAttributes[loopindex].privateVars.indexOf($varref.name) !== -1) - LoopOmpAttributes[loopindex].privateVars.splice(LoopOmpAttributes[loopindex].privateVars.indexOf($varref.name), 1); - - if (LoopOmpAttributes[loopindex].firstprivateVars.indexOf($varref.name) !== -1) - LoopOmpAttributes[loopindex].firstprivateVars.splice(LoopOmpAttributes[loopindex].firstprivateVars.indexOf($varref.name), 1); - - if (LoopOmpAttributes[loopindex].lastprivateVars.indexOf($varref.name) !== -1) - LoopOmpAttributes[loopindex].lastprivateVars.splice(LoopOmpAttributes[loopindex].lastprivateVars.indexOf($varref.name), 1); - - end - condition $varref.type.isPointer === true end - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/additionalConditionsCheck.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/additionalConditionsCheck.lara deleted file mode 100644 index 0c94bc4d0c..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/additionalConditionsCheck.lara +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************** -* -* additionalConditionsCheck -* -**************************************************************/ -import clava.autopar.checkForFunctionCalls; - -aspectdef additionalConditionsCheck - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - if (LoopOmpAttributes[loopindex].msgError.length !== 0) - return; - - - var conterNum = null; - - try - { - conterNum = eval($ForStmt.endValue + '-' + $ForStmt.initValue); - } - catch(e) - { - } - - - if ( - Number($ForStmt.endValue) !== NaN && - conterNum !== null && - Math.abs(Number(conterNum)) < 50 - ) - { - Add_msgError(LoopOmpAttributes, $ForStmt, ' Loop Iteration number is too low'); - return; - } - - call o : checkForFunctionCalls($ForStmt); - - if (o.FunctionCalls.length > 0) - { - Add_msgError(LoopOmpAttributes, $ForStmt, 'Variables Access as passed arguments Can not be traced inside of function calls : \n' + o.FunctionCalls.join('\n')); - return; - } - - // check non-affine array subscript A[B[j]].... ???? - //------------------------------------------------------------ - // check for usage of array access as the subscript A[B[.]] - //------------------------------------------------------------ - select $ForStmt.arrayAccess.subscript end - apply - if ($subscript.getDescendantsAndSelf('arrayAccess').length > 0) - { - Add_msgError(LoopOmpAttributes, $ForStmt,' Array access ' + $arrayAccess.code + ' which is used for writing has subscript of arrayType ' + $subscript.code); - return; - } - end - condition $arrayAccess.use.indexOf('write') !== -1 end - -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForFunctionCalls.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForFunctionCalls.lara deleted file mode 100644 index ca79d15d45..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForFunctionCalls.lara +++ /dev/null @@ -1,26 +0,0 @@ -/************************************************************** -* -* checkForFunctionCalls -* -**************************************************************/ -aspectdef checkForFunctionCalls - input $ForStmt end - output FunctionCalls end - - this.FunctionCalls = []; - - // check for calling functions - - var userSafeFunctions = $ForStmt.data.safeFunctions; - - select $ForStmt.call end - apply - var isSafe = (safefunctionCallslist.indexOf($call.name) !== -1) || - (userSafeFunctions !== undefined && userSafeFunctions.indexOf($call.name) !== -1); - - if (!isSafe) - this.FunctionCalls.push($call.name + '#' + $call.line + '{' + $call.code +'}'); - end - condition $call.astName === 'CallExpr' end - -end diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForInvalidStmts.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForInvalidStmts.lara deleted file mode 100644 index 0e222f43d6..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForInvalidStmts.lara +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************** -* -* checkForInvalidStmts -* -**************************************************************/ -aspectdef checkForInvalidStmts - input $ForStmt end - output InvalidStmts end - - // Initialize output - this.InvalidStmts = []; - - // check for [exit] at any subregion - select $ForStmt.call{'exit'} end - apply - this.InvalidStmts.push($call.name + '#' + $call.line); - return; - end - - // check for [break,return] - select $ForStmt.body.stmt end - apply - if ( - $stmt.astName === 'ReturnStmt' || - ($stmt.astName === 'BreakStmt' && $stmt.getAstAncestor('ForStmt').line === $ForStmt.line) - ) - { - this.InvalidStmts.push($stmt.astName + '#' + $stmt.line); - return; - } - end - condition $stmt.astName === 'ReturnStmt' || $stmt.astName === 'BreakStmt' end -end \ No newline at end of file diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForOpenMPCanonicalForm.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForOpenMPCanonicalForm.lara deleted file mode 100644 index 0a6505a1dd..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkForOpenMPCanonicalForm.lara +++ /dev/null @@ -1,341 +0,0 @@ -/************************************************************** -* -* checkForOpenMPCanonicalForm -* -**************************************************************/ -import clava.autopar.checkForInvalidStmts; - - -aspectdef checkForOpenMPCanonicalForm - input $ForStmt end - - var loopindex = GetLoopIndex($ForStmt); - - - // check if $ForStmt has been checked for Canonical Form or not - if (LoopOmpAttributes[loopindex] !== undefined) - return; - - // create LoopOmpAttributes structure for current $ForStmt - LoopOmpAttributes[loopindex] = {}; - LoopOmpAttributes[loopindex].msgError = []; - LoopOmpAttributes[loopindex].astId = $ForStmt.astId; - LoopOmpAttributes[loopindex].loopindex = loopindex; - - - // check if all inner loops are in OpenMP Canonical Form or not - select $ForStmt.body.loop end - apply - if($loop.astName !== 'ForStmt') { - throw "Not a for stmt: " + $loop.astName; - } - - var innerloopindex = $loop.getAstAncestor('FunctionDecl').name + '_' + $loop.rank.join('_'); - if (LoopOmpAttributes[innerloopindex] === undefined) - call checkForOpenMPCanonicalForm($loop); - - { - - if (LoopOmpAttributes[innerloopindex].loopControlVarname === undefined) - { - Add_msgError(LoopOmpAttributes, $ForStmt,'inner loop #' + $loop.line + '\t' + innerloopindex + ' dose not have loopControlVarname'); - return; - } - - var varName = LoopOmpAttributes[innerloopindex].loopControlVarname; - - if (LoopOmpAttributes[loopindex].innerloopsControlVarname === undefined) - LoopOmpAttributes[loopindex].innerloopsControlVarname = []; - - if (LoopOmpAttributes[loopindex].innerloopsControlVarname.indexOf(varName) === -1) - LoopOmpAttributes[loopindex].innerloopsControlVarname.push(varName); - } - end - condition $loop.astName === 'ForStmt' end - - - var controlVarsName = []; - var controlVarsAstId = []; - var msgError = []; - - - - var initVars = []; - var initVardecl = []; - var initmsgError = []; - select $ForStmt.init.vardecl end - apply - initVardecl.push({ - name : $vardecl.name, - astId : $vardecl.astId, - varType : $vardecl.type.code, - use : 'write', - loc : 'init', - hasInit : $vardecl.hasInit - }); - end - - var initVarref = []; - select $ForStmt.init.varref end - apply - if ( - ($varref.kind === 'address_of') || - ($varref.useExpr.use === 'readwrite') || - ($varref.kind === 'pointer_access' && $varref.useExpr.use === 'write') - ) - { - initmsgError.push($init.code.split(';').join(' ') + ' : ' + ' is not allowed' ); - } - else if ($varref.useExpr.use === 'write') - initVarref.push({ - name : $varref.name, - astId : $varref.vardecl.astId, - varType : $varref.vardecl.type.code, - use : $varref.useExpr.use, - loc : 'init' - }); - end - - initVars = initVars.concat(initVardecl); - initVars = initVars.concat(initVarref); - - var condVars = []; - select $ForStmt.cond.varref end - apply - if ($varref.useExpr.use == 'read') - condVars.push({ - name : $varref.name, - astId : $varref.vardecl.astId, - varType : $varref.vardecl.type.code, - use : $varref.useExpr.use, - loc : 'cond' - }); - end - - var stepVars = []; - select $ForStmt.step.varref end - apply - if ($varref.useExpr.use == 'write' || $varref.useExpr.use == 'readwrite') - stepVars.push({ - name : $varref.name, - astId : $varref.vardecl.astId, - varType : $varref.vardecl.type.code, - use : $varref.useExpr.use, - loc : 'step' - }); - end - - - controlVarsName = intersection( - initVars.map(function(obj) {return obj.name;}), - condVars.map(function(obj) {return obj.name;}), - stepVars.map(function(obj) {return obj.name;}) - ); - - controlVarsAstId = intersection( - initVars.map(function(obj) {return obj.astId;}), - condVars.map(function(obj) {return obj.astId;}), - stepVars.map(function(obj) {return obj.astId;}) - ); - - - //------------------------------------------------------------ - // checking loop init-expr (integer-type var = lb) - //------------------------------------------------------------ - if (initVardecl.length > 1) - initmsgError.push(' only single var declaration is allowed' ); - else if (initVardecl.length == 1 && initVardecl[0].varType != 'int') - initmsgError.push('typeOf(' + initVardecl[0].name + ') must have int type, not ' + initVardecl[0].varType); - else if (initVardecl.length == 1 && initVardecl[0].hasInit == false) - initmsgError.push(' loop init-expr declaration without variable initialization' ); - - //------------------------------------------------------------ - // checking loop init-expr (var = lb) - //------------------------------------------------------------ - if (initVarref.length > 1) - initmsgError.push(' only single var initialization is allowed' ); - else if (initVarref.length == 1 && initVarref[0].varType != 'int') - { - /* - initmsgError.push('typeOf(' + initVarref[0].name + ') = ' + initVarref[0].varType + ' as loop counter type is not allowed' ); - */ - } - - //------------------------------------------------------------ - // checking loop for at least one control var - //------------------------------------------------------------ - if (initVars.length == 0) - initmsgError.push('loop-init : at least a single variable initialization/declaration is required' ); - - - //------------------------------------------------------------ - // checking loop test-expr (var op lb || lb op var) var in [>,>=,<,<=] - //------------------------------------------------------------ - var condmsgError = []; - var condbinaryOp = []; - var condIterationValue = NaN; - select $ForStmt.cond.binaryOp end - apply - condbinaryOp.push($binaryOp.kind); - if ($binaryOp.left.astName === 'IntegerLiteral') - condIterationValue = Number($binaryOp.left.code); - else if ($binaryOp.right.astName === 'IntegerLiteral') - condIterationValue = Number($binaryOp.right.code); - break #$ForStmt; - end - - if (['lt','le','gt','ge'].indexOf(condbinaryOp[0]) == -1) - { - condmsgError.push(' relation-op should be in the following : (var op lb) OR (lb op var) where op in [<,<=,>,>=]' ); - } - else if (condIterationValue < 100) - { - //condmsgError.push(' loop iteration number ( ' + condIterationValue + ' ) is too low!!!'); - } - - - //------------------------------------------------------------ - // checking loop incr-expr - //------------------------------------------------------------ - var stepmsgError = []; - var stepOp = null; - var $stepOpExpr = undefined; - var $stepExpr = undefined; - select $ForStmt.step.expr end - apply - $stepExpr = $step; - $stepOpExpr = $expr; - stepOp = $expr.kind; - break #$ForStmt; - end - condition $expr.joinPointType == 'binaryOp' || $expr.joinPointType == 'unaryOp' end - -// if (stepOp == null || ['assign','post_inc','pre_inc','pre_dec','post_dec','add','sub'].indexOf(stepOp) == -1 || stepVars.length != 1) -// stepmsgError.push('loop-step expression is not in canonical form' ); - if ($stepExpr === undefined) { - stepmsgError.push('loop-step expression is not in canonical form: loop at "'+$ForStmt.location+'" does not have a step expression'); - } else if ($stepOpExpr === undefined) { - stepmsgError.push('loop-step expression is not in canonical form: could not obtain step operation expression from step "'+$stepExpr.code+'":' + $stepExpr.ast); - }else if (stepOp == null) { - stepmsgError.push('loop-step expression is not in canonical form: could not obtain step operation from expression "'+$stepOpExpr.code+'":' + $stepOpExpr.ast); - }else if (['assign','post_inc','pre_inc','pre_dec','post_dec','add','sub'].indexOf(stepOp) == -1) { - stepmsgError.push('loop-step expression is not in canonical form: detected step operation is '+stepOp+', expected one of assign, post_inc, pre_inc, pre_dec, post_dec, add, sub'); - } - - if (stepVars.length != 1) - stepmsgError.push('loop-step expression is not in canonical form: step variables is not 1, it is ' + stepVars.length + ' (' + stepVars + ')'); - - msgError = msgError.concat(initmsgError); - msgError = msgError.concat(condmsgError); - msgError = msgError.concat(stepmsgError); - - - - if (controlVarsAstId.length === 1) - { - call o : checkForControlVarChanged($ForStmt,controlVarsAstId[0]); - if (o.ControlVarChanged == true) - { - LoopOmpAttributes[loopindex].hasOpenMPCanonicalForm = false; - msgError.push('For controlVar is changed inside of loop body'); - } - - } - - call o : checkForInvalidStmts($ForStmt); - - if (o.InvalidStmts.length > 0) - { - LoopOmpAttributes[loopindex].hasOpenMPCanonicalForm = false; - msgError.push('Loop contains Invalid Statement -> ' + o.InvalidStmts.join('\t')); - } - - if (msgError.length > 0 || controlVarsAstId.length !== 1) - { - Add_msgError(LoopOmpAttributes, $ForStmt, msgError); - LoopOmpAttributes[loopindex].hasOpenMPCanonicalForm = false; - //return; - } - - - LoopOmpAttributes[loopindex].loopControlVarname = controlVarsName[0]; - LoopOmpAttributes[loopindex].loopControlVarastId = controlVarsAstId[0]; - //------------------------------------------------------------ - //------------------ extract start and end line for loop - //------------------------------------------------------------ - var strtmp = Strings.replacer($ForStmt.location,'->',':').split(':'); - LoopOmpAttributes[loopindex].start = Number(strtmp[strtmp.length-4]); - LoopOmpAttributes[loopindex].end = Number(strtmp[strtmp.length-2]); - //------------------------------------------------------------ - //------------------ set loop parameters - //------------------------------------------------------------ - - LoopOmpAttributes[loopindex].setp = null; - if (['lt','le'].indexOf(condbinaryOp[0]) !== -1) - { - LoopOmpAttributes[loopindex].setp = 'incremental'; - } - else if (['gt','ge'].indexOf(condbinaryOp[0]) !== -1) - { - LoopOmpAttributes[loopindex].setp = 'decremental'; - } - LoopOmpAttributes[loopindex].initValue = $ForStmt.initValue; - LoopOmpAttributes[loopindex].endValue = $ForStmt.endValue; - - - LoopOmpAttributes[loopindex].hasOpenMPCanonicalForm = true; - - LoopOmpAttributes[loopindex].privateVars = []; - LoopOmpAttributes[loopindex].firstprivateVars = []; - LoopOmpAttributes[loopindex].lastprivateVars = []; - LoopOmpAttributes[loopindex].Reduction = []; - LoopOmpAttributes[loopindex].threadprivate = []; - LoopOmpAttributes[loopindex].Reduction_listVars = []; - LoopOmpAttributes[loopindex].DepPetitFileName = null; - - - LoopOmpAttributes[loopindex].DepArrays = []; - select $ForStmt.arrayAccess.subscript end - apply - for($varref of $subscript.getDescendantsAndSelf("varref")) - { - if (LoopOmpAttributes[loopindex].loopControlVarname === $varref.name && - LoopOmpAttributes[loopindex].DepArrays.indexOf($arrayAccess.arrayVar.name) === -1) - LoopOmpAttributes[loopindex].DepArrays.push($arrayAccess.arrayVar.name); - } - end - -end - - -/************************* intersection *************************/ - var intersection = function(){ - return Array.prototype.slice.call(arguments).reduce(function(previous, current){ - return previous.filter(function(element){ - return current.indexOf(element) > -1; - }); - }); -}; - - -/************************************************************** -* -* checkForControlVarChanged -* -**************************************************************/ -aspectdef checkForControlVarChanged - input $ForStmt, VarAstId end - output ControlVarChanged end - this.ControlVarChanged = false; - - select $ForStmt.body.stmt.varref end - apply - this.ControlVarChanged = true; - return; - end - condition $varref.vardecl.astId == VarAstId && $varref.useExpr.use.indexOf('write') !== -1 end -end - - - - diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkvarreReduction.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkvarreReduction.lara deleted file mode 100644 index 9ea20e32b6..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/checkvarreReduction.lara +++ /dev/null @@ -1,155 +0,0 @@ -/************************************************************** -* -* checkvarreReduction -* -**************************************************************/ - -aspectdef checkvarreReduction - input $ForStmt end - output Reduction end - this.Reduction = []; - // type 1 : x++, ++x, x--, --x - // type 2 : x binaryOp= expr , binaryOp={+, *, -, &, ^ ,|} - // type 3 : x = x binaryOp expr, binaryOp={+, *, -, &, ^ ,|, &&, ||} - // x = expr binaryOp x (except for subtraction) - // x is not referenced in exp - // expr has scalar type (no array, objects etc) - - - - var loopindex = GetLoopIndex($ForStmt); - var candidateVarlist = SearchStruct(LoopOmpAttributes[loopindex].varAccess, {varTypeAccess : 'varref', use : 'RW', isInsideLoopHeader : false , usedInClause : false}); - - var exprlines = []; - - for(var i = 0; i < candidateVarlist.length; i++) - if ( - (candidateVarlist[i].varUsage.length == 1) // for type 1 (or type 2,3) - || - (candidateVarlist[i].varUsage.length == 2 && candidateVarlist[i].varUsage[0].line == candidateVarlist[i].varUsage[1].line) // for type 2,3 , at same line - ) - { - exprlines.push(candidateVarlist[i].varUsage[0].line); - } - else - { - candidateVarlist.splice(i, 1); // remove from candidates - i--; - } - - select $ForStmt.body.expr end - apply - if ( exprlines.indexOf($expr.line) !== -1 ) - { - var candidateVar = null; - for(var i = 0; i < candidateVarlist.length; i++) - if (candidateVarlist[i].varUsage[0].line === $expr.line) - { - candidateVar = candidateVarlist[i]; - break; - } - - call o: retReductionOpVar($expr, candidateVar); - this.Reduction = this.Reduction.concat(o.Reduction); - exprlines.splice(exprlines.indexOf($expr.line), 1); - } - - end - - -end - - -/************************************************************** -* -* retReductionOpVar -* -**************************************************************/ -aspectdef retReductionOpVar - input $expr, candidateVar end - output Reduction end - - this.Reduction = []; - - var exprvarrefset = orderedVarrefs3($expr); - var candidateVarOp = []; - var otherVarUsednumber = 0; // number of other varref in expr - for(var j = 0; j < exprvarrefset.length; j++) - { - if (exprvarrefset[j].name === candidateVar.name) - { - if (exprvarrefset[j].getAncestor('expression') !== undefined && exprvarrefset[j].getAncestor('expression').astName === 'ParenExpr') - { - candidateVarOp = []; - break; // candidateVar should not be in any ParenExpr - } - - var op = null; - if (exprvarrefset[j].getAncestor('unaryOp') !== undefined) - op = exprvarrefset[j].getAncestor('unaryOp').kind; - else if (exprvarrefset[j].getAncestor('binaryOp') !== undefined) - op = exprvarrefset[j].getAncestor('binaryOp').kind + - (( exprvarrefset[j].getAncestor('binaryOp').kind !== 'assign' && exprvarrefset[j].getAncestor('binaryOp').isAssignment === true) ? '' :''); - if (op === 'sub' && - typeof(exprvarrefset[j].getAncestor('binaryOp').right.vardecl) !== 'undefined' && - exprvarrefset[j].getAncestor('binaryOp').right.vardecl.name === candidateVar.name - ) - { - candidateVarOp = []; - break; // x = expr - x not acceptable - } - - candidateVarOp.push(op); - } - else - { - otherVarUsednumber++; - } - } - - - var op = null; - if (candidateVarOp.length == 1) - { - op = candidateVarOp[0]; - } - else if(candidateVarOp.length == 2 && - candidateVarOp[1] == 'assign' && - ( - ['add_assign', 'sub_assign', 'mul_assign','and_assign', 'or_assign' , 'xor_assign'].indexOf(candidateVarOp[0]) !== -1 || - ['add', 'mul', 'sub', 'and', 'or', 'l_and' , 'l_or'].indexOf(candidateVarOp[0]) !== -1 - ) - ) - { - op = candidateVarOp[0]; - } - else - { - return; - } - - - var findOpflag = true; - if ( ['pre_dec', 'post_dec', 'sub', 'sub_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(- : ' + candidateVar.name + ')'); - else if ( ['pre_inc', 'post_inc', 'add', 'add_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(+ : ' + candidateVar.name + ')'); - else if ( ['mul' , 'mul_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(* : ' + candidateVar.name + ')'); - else if ( ['and' , 'and_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(& : ' + candidateVar.name + ')'); - else if ( ['xor' , 'xor_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(^ : ' + candidateVar.name + ')'); - else if ( ['or' , 'or_assign'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(| : ' + candidateVar.name + ')'); - else if ( ['l_and'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(&& : ' + candidateVar.name + ')'); - else if ( ['l_or'].indexOf(op) !== -1 ) - this.Reduction.push('reduction(|| : ' + candidateVar.name + ')'); - else - findOpflag = false; - - if (findOpflag === true) - candidateVar.usedInClause = true; - -end diff --git a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/get_varTypeAccess.lara b/ClavaLaraApi/src-lara-clava/clava/clava/autopar/get_varTypeAccess.lara deleted file mode 100644 index 5b16886c27..0000000000 --- a/ClavaLaraApi/src-lara-clava/clava/clava/autopar/get_varTypeAccess.lara +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************** -* -* get_varTypeAccess -* -**************************************************************/ -aspectdef get_varTypeAccess - input $varJP, op end - output varTypeAccess, varUse, varName, vardecl end - - - op = (typeof op !== 'undefined') ? op : 'all'; - - this.varTypeAccess = null; - this.varUse = null; - this.varName = null; - this.vardecl = null; - - if ( - $varJP.joinPointType === 'arrayAccess' && - ['BuiltinType','QualType','TypedefType'].indexOf($varJP.type.astName) !== -1 - //$varJP.type.astName !== 'RecordType' && - //$varJP.type.astName === 'BuiltinType' - ) - { - if ($varJP.arrayVar.joinPointType === 'memberAccess') - { - this.varTypeAccess = 'memberArrayAccess'; - } - else if ($varJP.arrayVar.joinPointType === 'varref') - { - this.varTypeAccess = 'arrayAccess'; - } - } - - if ( - $varJP.joinPointType === 'memberAccess' && - ['BuiltinType','QualType'].indexOf($varJP.type.astName) !== -1 - //$varJP.type.astName === 'BuiltinType' - ) - { - this.varTypeAccess = 'memberAccess'; - } - - if ( - $varJP.joinPointType === 'varref' && - ['BuiltinType','QualType','PointerType','TypedefType'].indexOf($varJP.type.astName) !== -1 - //$varJP.type.astName === 'BuiltinType' - ) - { - this.varTypeAccess = 'varref'; - } - - - if (op !== 'all') - return; - - if (this.varTypeAccess === 'memberArrayAccess') - { - this.varUse = $varJP.use; - //varName = $varJP.arrayVar.name; - this.varName = normalizeVarName($varJP.code); - } - else if (this.varTypeAccess === 'arrayAccess') - { - this.vardecl = $varJP.arrayVar.vardecl; - if(this.vardecl === undefined) { - debug("autopar.get_varTypeAccess: Could not find vardecl of arrayVar@" + $varJP.arrayVar.location); - this.vardecl = null; - } - this.varUse = $varJP.use; - //varName = $varJP.arrayVar.name; - this.varName = normalizeVarName($varJP.code); - } - else if (this.varTypeAccess === 'memberAccess') - { - this.varUse = $varJP.use; - //varName = $varJP.name; - this.varName = normalizeVarName($varJP.code); - } - else if (this.varTypeAccess === 'varref') - { - this.varUse = $varJP.useExpr.use; - this.vardecl = $varJP.vardecl; - if(this.vardecl === undefined) { - debug("autopar.get_varTypeAccess: Could not find vardecl of var@" + $varJP.location); - this.vardecl = null; - } - - //varName = $varJP.name; - this.varName = normalizeVarName($varJP.code); - } - -end - diff --git a/ClavaLaraApi/src-lara/clava/Joinpoints.js b/ClavaLaraApi/src-lara/clava/Joinpoints.js deleted file mode 100644 index d8a504c6bf..0000000000 --- a/ClavaLaraApi/src-lara/clava/Joinpoints.js +++ /dev/null @@ -1,2591 +0,0 @@ -/////////////////////////////////////////////////// -// This file is generated by build-interfaces.js // -/////////////////////////////////////////////////// -import { LaraJoinPoint, registerJoinpointMapper, wrapJoinPoint, unwrapJoinPoint, } from "@specs-feup/lara/api/LaraJoinPoint.js"; -export class Joinpoint extends LaraJoinPoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump' - */ - get ast() { return wrapJoinPoint(this._javaObject.getAst()); } - /** - * Returns an array with the children of the node, considering null nodes - */ - get astChildren() { return wrapJoinPoint(this._javaObject.getAstChildren()); } - /** - * String that uniquely identifies this node - */ - get astId() { return wrapJoinPoint(this._javaObject.getAstId()); } - /** - * The name of the Java class of this node, which is similar to the equivalent node in Clang AST - */ - get astName() { return wrapJoinPoint(this._javaObject.getAstName()); } - /** - * Returns the number of children of the node, considering null nodes - */ - get astNumChildren() { return wrapJoinPoint(this._javaObject.getAstNumChildren()); } - /** - * The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit - */ - get bitWidth() { return wrapJoinPoint(this._javaObject.getBitWidth()); } - /** - * String list of the names of the join points that form a path from the root to this node - */ - get chain() { return wrapJoinPoint(this._javaObject.getChain()); } - /** - * Returns an array with the children of the node, ignoring null nodes - */ - get children() { return wrapJoinPoint(this._javaObject.getChildren()); } - /** - * String with the code represented by this node - */ - get code() { return wrapJoinPoint(this._javaObject.getCode()); } - /** - * The starting column of the current node in the original code - */ - get column() { return wrapJoinPoint(this._javaObject.getColumn()); } - /** - * Returns the node that declares the scope of this node - */ - get currentRegion() { return wrapJoinPoint(this._javaObject.getCurrentRegion()); } - /** - * JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds. - */ - get data() { const data = this._javaObject.getData(); return data ? JSON.parse(data) : data; } - /** - * JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds. - */ - set data(value) { this._javaObject.setData(JSON.stringify(value)); } - /** - * The depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc. - */ - get depth() { return wrapJoinPoint(this._javaObject.getDepth()); } - /** - * Retrieves all descendants of the join point - */ - get descendants() { return wrapJoinPoint(this._javaObject.getDescendants()); } - /** - * The ending column of the current node in the original code - */ - get endColumn() { return wrapJoinPoint(this._javaObject.getEndColumn()); } - /** - * The ending line of the current node in the original code - */ - get endLine() { return wrapJoinPoint(this._javaObject.getEndLine()); } - /** - * The name of the file where the code of this node is located, if available - */ - get filename() { return wrapJoinPoint(this._javaObject.getFilename()); } - /** - * The complete path to the file where the code of this node comes from - */ - get filepath() { return wrapJoinPoint(this._javaObject.getFilepath()); } - /** - * Returns the first child of this node, or undefined if it has no child - */ - get firstChild() { return wrapJoinPoint(this._javaObject.getFirstChild()); } - /** - * Returns the first child of this node, or undefined if it has no child - */ - set firstChild(value) { this._javaObject.setFirstChild(unwrapJoinPoint(value)); } - /** - * True if the node has children, false otherwise - */ - get hasChildren() { return wrapJoinPoint(this._javaObject.getHasChildren()); } - /** - * True if this node has a parent - */ - get hasParent() { return wrapJoinPoint(this._javaObject.getHasParent()); } - /** - * True, if the join point has a type - */ - get hasType() { return wrapJoinPoint(this._javaObject.getHasType()); } - /** - * Returns comments that are not explicitly in the AST, but embedded in other nodes - */ - get inlineComments() { return wrapJoinPoint(this._javaObject.getInlineComments()); } - /** - * Returns comments that are not explicitly in the AST, but embedded in other nodes - */ - set inlineComments(value) { this._javaObject.setInlineComments(unwrapJoinPoint(value)); } - /** - * True if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for) - */ - get isCilk() { return wrapJoinPoint(this._javaObject.getIsCilk()); } - /** - * True, if the join point is part of a system header file - */ - get isInSystemHeader() { return wrapJoinPoint(this._javaObject.getIsInSystemHeader()); } - /** - * True, if the join point is inside a header (e.g., if condition, for, while) - */ - get isInsideHeader() { return wrapJoinPoint(this._javaObject.getIsInsideHeader()); } - /** - * True, if the join point is inside a loop header (e.g., for, while) - */ - get isInsideLoopHeader() { return wrapJoinPoint(this._javaObject.getIsInsideLoopHeader()); } - /** - * True if any descendant or the node itself was defined as a macro - */ - get isMacro() { return wrapJoinPoint(this._javaObject.getIsMacro()); } - /** - * The names of the Java fields of this node. Can be used as key of the attribute 'javaValue' - * - * @deprecated used attribute 'keys' instead, together with 'getValue' - */ - get javaFields() { return wrapJoinPoint(this._javaObject.getJavaFields()); } - /** - * Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it) - */ - get jpId() { return wrapJoinPoint(this._javaObject.getJpId()); } - /** - * A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue' - */ - get keys() { return wrapJoinPoint(this._javaObject.getKeys()); } - /** - * Returns the last child of this node, or undefined if it has no child - */ - get lastChild() { return wrapJoinPoint(this._javaObject.getLastChild()); } - /** - * Returns the last child of this node, or undefined if it has no child - */ - set lastChild(value) { this._javaObject.setLastChild(unwrapJoinPoint(value)); } - /** - * Returns the node that came before this node, or undefined if there is none - */ - get leftJp() { return wrapJoinPoint(this._javaObject.getLeftJp()); } - /** - * The starting line of the current node in the original code - */ - get line() { return wrapJoinPoint(this._javaObject.getLine()); } - /** - * A string with information about the file and code position of this node, if available - */ - get location() { return wrapJoinPoint(this._javaObject.getLocation()); } - /** - * Returns the number of children of the node, ignoring null nodes - */ - get numChildren() { return wrapJoinPoint(this._javaObject.getNumChildren()); } - /** - * If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin - */ - get originNode() { return wrapJoinPoint(this._javaObject.getOriginNode()); } - /** - * Returns the parent node in the AST, or undefined if it is the root node - */ - get parent() { return wrapJoinPoint(this._javaObject.getParent()); } - /** - * Returns the node that declares the scope that is a parent of the scope of this node - */ - get parentRegion() { return wrapJoinPoint(this._javaObject.getParentRegion()); } - /** - * The pragmas associated with this node - */ - get pragmas() { return wrapJoinPoint(this._javaObject.getPragmas()); } - /** - * Returns the node that comes after this node, or undefined if there is none - */ - get rightJp() { return wrapJoinPoint(this._javaObject.getRightJp()); } - /** - * Returns the 'program' joinpoint - */ - get root() { return wrapJoinPoint(this._javaObject.getRoot()); } - /** - * The nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array - */ - get scopeNodes() { return wrapJoinPoint(this._javaObject.getScopeNodes()); } - /** - * Returns an array with the siblings that came before this node - */ - get siblingsLeft() { return wrapJoinPoint(this._javaObject.getSiblingsLeft()); } - /** - * Returns an array with the siblings that come after this node - */ - get siblingsRight() { return wrapJoinPoint(this._javaObject.getSiblingsRight()); } - /** - * Converts this join point to a statement, or returns undefined if it was not possible - */ - get stmt() { return wrapJoinPoint(this._javaObject.getStmt()); } - get type() { return wrapJoinPoint(this._javaObject.getType()); } - set type(value) { this._javaObject.setType(unwrapJoinPoint(value)); } - /** - * True, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)' - */ - astIsInstance(className) { return wrapJoinPoint(this._javaObject.astIsInstance(unwrapJoinPoint(className))); } - /** - * True if the given node is a descendant of this node - */ - contains(jp) { return wrapJoinPoint(this._javaObject.contains(unwrapJoinPoint(jp))); } - /** - * Looks for an ancestor joinpoint name, walking back on the AST - */ - getAncestor(type) { return wrapJoinPoint(this._javaObject.getAncestor(unwrapJoinPoint(type))); } - /** - * @deprecated Looks for an ancestor AST name, walking back on the AST - */ - getAstAncestor(type) { return wrapJoinPoint(this._javaObject.getAstAncestor(unwrapJoinPoint(type))); } - /** - * Returns the child of the node at the given index, considering null nodes - */ - getAstChild(index) { return wrapJoinPoint(this._javaObject.getAstChild(unwrapJoinPoint(index))); } - /** - * Looks for an ancestor joinpoint name, walking back on the joinpoint chain - */ - getChainAncestor(type) { return wrapJoinPoint(this._javaObject.getChainAncestor(unwrapJoinPoint(type))); } - /** - * Returns the child of the node at the given index, ignoring null nodes - */ - getChild(index) { return wrapJoinPoint(this._javaObject.getChild(unwrapJoinPoint(index))); } - /** - * Retrieves the descendants of the given type - */ - getDescendants(type) { return wrapJoinPoint(this._javaObject.getDescendants(unwrapJoinPoint(type))); } - /** - * Retrieves the descendants of the given type, including the node itself - */ - getDescendantsAndSelf(type) { return wrapJoinPoint(this._javaObject.getDescendantsAndSelf(unwrapJoinPoint(type))); } - /** - * Looks in the descendants for the first node of the given type - */ - getFirstJp(type) { return wrapJoinPoint(this._javaObject.getFirstJp(unwrapJoinPoint(type))); } - /** - * String with the full Java class name of the type of the Java field with the provided name - */ - getJavaFieldType(fieldName) { return wrapJoinPoint(this._javaObject.getJavaFieldType(unwrapJoinPoint(fieldName))); } - /** - * Java Class instance with the type of the given key - */ - getKeyType(key) { return wrapJoinPoint(this._javaObject.getKeyType(unwrapJoinPoint(key))); } - /** - * Retrives values that have been associated to nodes of the AST with 'setUserField' - */ - getUserField(fieldName) { return wrapJoinPoint(this._javaObject.getUserField(unwrapJoinPoint(fieldName))); } - /** - * The value associated with the given property key - */ - getValue(key) { return wrapJoinPoint(this._javaObject.getValue(unwrapJoinPoint(key))); } - /** - * True, if the given join point or AST node is the same (== test) as the current join point AST node - */ - hasNode(nodeOrJp) { return wrapJoinPoint(this._javaObject.hasNode(unwrapJoinPoint(nodeOrJp))); } - /** - * List with the values of fields that are join points, recursively - */ - jpFields(recursive = false) { return wrapJoinPoint(this._javaObject.jpFields(unwrapJoinPoint(recursive))); } - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - copy() { return wrapJoinPoint(this._javaObject.copy()); } - /** - * Clears all properties from the .data object - */ - dataClear() { return wrapJoinPoint(this._javaObject.dataClear()); } - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - deepCopy() { return wrapJoinPoint(this._javaObject.deepCopy()); } - /** - * Removes the node associated to this joinpoint from the AST - */ - detach() { return wrapJoinPoint(this._javaObject.detach()); } - /** - * Inserts the given join point after this join point - */ - insertAfter(p1) { return wrapJoinPoint(this._javaObject.insertAfter(unwrapJoinPoint(p1))); } - /** - * Inserts the given join point before this join point - */ - insertBefore(p1) { return wrapJoinPoint(this._javaObject.insertBefore(unwrapJoinPoint(p1))); } - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - */ - messageToUser(message) { return wrapJoinPoint(this._javaObject.messageToUser(unwrapJoinPoint(message))); } - /** - * Removes the children of this node - */ - removeChildren() { return wrapJoinPoint(this._javaObject.removeChildren()); } - /** - * Replaces this node with the given node - */ - replaceWith(p1) { return wrapJoinPoint(this._javaObject.replaceWith(unwrapJoinPoint(p1))); } - /** - * Overload which accepts a list of strings - */ - replaceWithStrings(node) { return wrapJoinPoint(this._javaObject.replaceWithStrings(unwrapJoinPoint(node))); } - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - */ - setData(source) { return wrapJoinPoint(this._javaObject.setData(JSON.stringify(source))); } - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - */ - setFirstChild(node) { return wrapJoinPoint(this._javaObject.setFirstChild(unwrapJoinPoint(node))); } - /** - * Sets the commented that are embedded in a node - */ - setInlineComments(p1) { return wrapJoinPoint(this._javaObject.setInlineComments(unwrapJoinPoint(p1))); } - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - */ - setLastChild(node) { return wrapJoinPoint(this._javaObject.setLastChild(unwrapJoinPoint(node))); } - /** - * Sets the type of a node, if it has a type - */ - setType(type) { return wrapJoinPoint(this._javaObject.setType(unwrapJoinPoint(type))); } - /** - * Associates arbitrary values to nodes of the AST - */ - setUserField(p1, p2) { return wrapJoinPoint(this._javaObject.setUserField(unwrapJoinPoint(p1), unwrapJoinPoint(p2))); } - /** - * Sets the value associated with the given property key - */ - setValue(key, value) { return wrapJoinPoint(this._javaObject.setValue(unwrapJoinPoint(key), unwrapJoinPoint(value))); } - /** - * Replaces this join point with a comment with the same contents as .code - */ - toComment(prefix = "", suffix = "") { return wrapJoinPoint(this._javaObject.toComment(unwrapJoinPoint(prefix), unwrapJoinPoint(suffix))); } -} -export class Attribute extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } -} -/** - * Utility joinpoint, to represent certain problems when generating join points - */ -export class ClavaException extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get exception() { return wrapJoinPoint(this._javaObject.getException()); } - get exceptionType() { return wrapJoinPoint(this._javaObject.getExceptionType()); } - get message() { return wrapJoinPoint(this._javaObject.getMessage()); } -} -export class Comment extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get text() { return wrapJoinPoint(this._javaObject.getText()); } - set text(value) { this._javaObject.setText(unwrapJoinPoint(value)); } - setText(text) { return wrapJoinPoint(this._javaObject.setText(unwrapJoinPoint(text))); } -} -/** - * Represents one declaration (e.g., int foo(){return 0;}) or definition (e.g., int foo();) in the code - */ -export class Decl extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The attributes (e.g. Pure, CUDAGlobal) associated to this decl - */ - get attrs() { return wrapJoinPoint(this._javaObject.getAttrs()); } -} -/** - * Utility joinpoint, to represent empty nodes when directly accessing the tree - */ -export class Empty extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class Expression extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * A 'decl' join point that represents the declaration associated with this expression, or undefined if there is none - */ - get decl() { return wrapJoinPoint(this._javaObject.getDecl()); } - /** - * Returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise - */ - get implicitCast() { return wrapJoinPoint(this._javaObject.getImplicitCast()); } - /** - * True if the expression is part of an argument of a function call - */ - get isFunctionArgument() { return wrapJoinPoint(this._javaObject.getIsFunctionArgument()); } - get use() { return wrapJoinPoint(this._javaObject.getUse()); } - get vardecl() { return wrapJoinPoint(this._javaObject.getVardecl()); } -} -/** - * Represents a source file (.c, .cpp., .cl, etc) - */ -export class FileJp extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * The path to the source folder that was given as the base folder of this file - */ - get baseSourcePath() { return wrapJoinPoint(this._javaObject.getBaseSourcePath()); } - /** - * The output of the parser if there were errors during parsing - */ - get errorOutput() { return wrapJoinPoint(this._javaObject.getErrorOutput()); } - /** - * A Java file to the file that originated this translation unit - */ - get file() { return wrapJoinPoint(this._javaObject.getFile()); } - /** - * True if this file contains a 'main' method - */ - get hasMain() { return wrapJoinPoint(this._javaObject.getHasMain()); } - /** - * True if there were errors during parsing - */ - get hasParsingErrors() { return wrapJoinPoint(this._javaObject.getHasParsingErrors()); } - /** - * The includes of this file - */ - get includes() { return wrapJoinPoint(this._javaObject.getIncludes()); } - /** - * True if this file is considered a C++ file - */ - get isCxx() { return wrapJoinPoint(this._javaObject.getIsCxx()); } - /** - * True if this file is considered a header file - */ - get isHeader() { return wrapJoinPoint(this._javaObject.getIsHeader()); } - /** - * True if this file is an OpenCL filetype - */ - get isOpenCL() { return wrapJoinPoint(this._javaObject.getIsOpenCL()); } - /** - * The name of the file - */ - get name() { return wrapJoinPoint(this._javaObject.getName()); } - /** - * The name of the file - */ - set name(value) { this._javaObject.setName(unwrapJoinPoint(value)); } - /** - * The folder of the source file - */ - get path() { return wrapJoinPoint(this._javaObject.getPath()); } - /** - * The path to the file relative to the base source path - */ - get relativeFilepath() { return wrapJoinPoint(this._javaObject.getRelativeFilepath()); } - /** - * The path to the folder of the source file relative to the base source path - */ - get relativeFolderpath() { return wrapJoinPoint(this._javaObject.getRelativeFolderpath()); } - /** - * The path to the folder of the source file relative to the base source path - */ - set relativeFolderpath(value) { this._javaObject.setRelativeFolderpath(unwrapJoinPoint(value)); } - /** - * The name of the source folder of this file, or undefined if it has none - */ - get sourceFoldername() { return wrapJoinPoint(this._javaObject.getSourceFoldername()); } - /** - * The complete path to the file that will be generated by the weaver, given a destination folder - */ - getDestinationFilepath(destinationFolderpath) { return wrapJoinPoint(this._javaObject.getDestinationFilepath(unwrapJoinPoint(destinationFolderpath))); } - /** - * Adds a C include to the current file. If the file already has the include, it does nothing - */ - addCInclude(name, isAngled = false) { return wrapJoinPoint(this._javaObject.addCInclude(unwrapJoinPoint(name), unwrapJoinPoint(isAngled))); } - /** - * Adds a function to the file that returns void and has no parameters - */ - addFunction(name) { return wrapJoinPoint(this._javaObject.addFunction(unwrapJoinPoint(name))); } - /** - * Adds a global variable to this file - */ - addGlobal(name, type, initValue) { return wrapJoinPoint(this._javaObject.addGlobal(unwrapJoinPoint(name), unwrapJoinPoint(type), unwrapJoinPoint(initValue))); } - /** - * Adds an include to the current file. If the file already has the include, it does nothing - */ - addInclude(name, isAngled = false) { return wrapJoinPoint(this._javaObject.addInclude(unwrapJoinPoint(name), unwrapJoinPoint(isAngled))); } - /** - * Overload of addInclude which accepts a join point - */ - addIncludeJp(jp) { return wrapJoinPoint(this._javaObject.addIncludeJp(unwrapJoinPoint(jp))); } - /** - * Adds the node in the join point to the start of the file - */ - insertBegin(p1) { return wrapJoinPoint(this._javaObject.insertBegin(unwrapJoinPoint(p1))); } - /** - * Adds the node in the join point to the end of the file - */ - insertEnd(p1) { return wrapJoinPoint(this._javaObject.insertEnd(unwrapJoinPoint(p1))); } - /** - * Recompiles only this file, returns a join point to the new recompiled file, or throws an exception if a problem happens - */ - rebuild() { return wrapJoinPoint(this._javaObject.rebuild()); } - /** - * Recompiles only this file, returns a join point to the new recompiled file, or returns a clavaException join point if a problem happens - */ - rebuildTry() { return wrapJoinPoint(this._javaObject.rebuildTry()); } - /** - * Changes the name of the file - */ - setName(filename) { return wrapJoinPoint(this._javaObject.setName(unwrapJoinPoint(filename))); } - /** - * Sets the path to the folder of the source file relative to the base source path - */ - setRelativeFolderpath(path) { return wrapJoinPoint(this._javaObject.setRelativeFolderpath(unwrapJoinPoint(path))); } - /** - * Writes the code of this file to a given folder - */ - write(destinationFoldername) { return wrapJoinPoint(this._javaObject.write(unwrapJoinPoint(destinationFoldername))); } -} -export class ImplicitValue extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * Represents an include directive (e.g., #include ) - */ -export class Include extends Decl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * True if this is an angled include (i.e., system include) - */ - get isAngled() { return wrapJoinPoint(this._javaObject.getIsAngled()); } - /** - * The name of the include - */ - get name() { return wrapJoinPoint(this._javaObject.getName()); } - /** - * The path to the folder of the source file of the include, relative to the name of the include - */ - get relativeFolderpath() { return wrapJoinPoint(this._javaObject.getRelativeFolderpath()); } -} -export class InitList extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * [May be undefined] If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements - */ - get arrayFiller() { return wrapJoinPoint(this._javaObject.getArrayFiller()); } -} -export class Literal extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class MemberAccess extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * True if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar) - */ - get arrow() { return wrapJoinPoint(this._javaObject.getArrow()); } - /** - * True if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar) - */ - set arrow(value) { this._javaObject.setArrow(unwrapJoinPoint(value)); } - /** - * Expression of the base of this member access - */ - get base() { return wrapJoinPoint(this._javaObject.getBase()); } - get memberChain() { return wrapJoinPoint(this._javaObject.getMemberChain()); } - get memberChainNames() { return wrapJoinPoint(this._javaObject.getMemberChainNames()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } - setArrow(isArrow) { return wrapJoinPoint(this._javaObject.setArrow(unwrapJoinPoint(isArrow))); } -} -/** - * Represents a decl with a name - */ -export class NamedDecl extends Decl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get isPublic() { return wrapJoinPoint(this._javaObject.getIsPublic()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } - set name(value) { this._javaObject.setName(unwrapJoinPoint(value)); } - get qualifiedName() { return wrapJoinPoint(this._javaObject.getQualifiedName()); } - set qualifiedName(value) { this._javaObject.setQualifiedName(unwrapJoinPoint(value)); } - get qualifiedPrefix() { return wrapJoinPoint(this._javaObject.getQualifiedPrefix()); } - set qualifiedPrefix(value) { this._javaObject.setQualifiedPrefix(unwrapJoinPoint(value)); } - /** - * Sets the name of this namedDecl - */ - setName(name) { return wrapJoinPoint(this._javaObject.setName(unwrapJoinPoint(name))); } - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - */ - setQualifiedName(name) { return wrapJoinPoint(this._javaObject.setQualifiedName(unwrapJoinPoint(name))); } - /** - * Sets the qualified prefix of this namedDecl - */ - setQualifiedPrefix(qualifiedPrefix) { return wrapJoinPoint(this._javaObject.setQualifiedPrefix(unwrapJoinPoint(qualifiedPrefix))); } -} -export class NewExpr extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class Op extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get isBitwise() { return wrapJoinPoint(this._javaObject.getIsBitwise()); } - /** - * The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary' - */ - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - get operator() { return wrapJoinPoint(this._javaObject.getOperator()); } -} -export class ParenExpr extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * Returns the expression inside this parenthesis expression - */ - get subExpr() { return wrapJoinPoint(this._javaObject.getSubExpr()); } -} -/** - * Represents a pragma in the code (e.g., #pragma kernel) - */ -export class Pragma extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * Everything that is after the name of the pragma - */ - get content() { return wrapJoinPoint(this._javaObject.getContent()); } - /** - * Everything that is after the name of the pragma - */ - set content(value) { this._javaObject.setContent(unwrapJoinPoint(value)); } - /** - * The name of the pragma. E.g. for #pragma foo bar, returns 'foo' - */ - get name() { return wrapJoinPoint(this._javaObject.getName()); } - /** - * The name of the pragma. E.g. for #pragma foo bar, returns 'foo' - */ - set name(value) { this._javaObject.setName(unwrapJoinPoint(value)); } - /** - * The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations - */ - get target() { return wrapJoinPoint(this._javaObject.getTarget()); } - /** - * All the nodes below the target node, including the target node, up until a pragma with the name given by argument 'endPragma'. If no end pragma is found, returns the same result as if not providing the argument - */ - getTargetNodes(endPragma) { return wrapJoinPoint(this._javaObject.getTargetNodes(unwrapJoinPoint(endPragma))); } - setContent(content) { return wrapJoinPoint(this._javaObject.setContent(unwrapJoinPoint(content))); } - setName(name) { return wrapJoinPoint(this._javaObject.setName(unwrapJoinPoint(name))); } -} -/** - * Represents the complete program and is the top-most joinpoint in the hierarchy - */ -export class Program extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get baseFolder() { return wrapJoinPoint(this._javaObject.getBaseFolder()); } - get defaultFlags() { return wrapJoinPoint(this._javaObject.getDefaultFlags()); } - /** - * Paths to includes that the current program depends on - */ - get extraIncludes() { return wrapJoinPoint(this._javaObject.getExtraIncludes()); } - /** - * Link libraries of external projects the current program depends on - */ - get extraLibs() { return wrapJoinPoint(this._javaObject.getExtraLibs()); } - /** - * Paths to folders of projects that the current program depends on - */ - get extraProjects() { return wrapJoinPoint(this._javaObject.getExtraProjects()); } - /** - * Paths to sources that the current program depends on - */ - get extraSources() { return wrapJoinPoint(this._javaObject.getExtraSources()); } - /** - * The source files in this program - */ - get files() { return wrapJoinPoint(this._javaObject.getFiles()); } - get includeFolders() { return wrapJoinPoint(this._javaObject.getIncludeFolders()); } - /** - * True if the program was compiled with a C++ standard - */ - get isCxx() { return wrapJoinPoint(this._javaObject.getIsCxx()); } - /** - * A function join point with the main function of the program, if one is available - */ - get main() { return wrapJoinPoint(this._javaObject.getMain()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } - /** - * The name of the standard (e.g., c99, c++11) - */ - get standard() { return wrapJoinPoint(this._javaObject.getStandard()); } - /** - * The flag of the standard (e.g., -std=c++11) - */ - get stdFlag() { return wrapJoinPoint(this._javaObject.getStdFlag()); } - get userFlags() { return wrapJoinPoint(this._javaObject.getUserFlags()); } - get weavingFolder() { return wrapJoinPoint(this._javaObject.getWeavingFolder()); } - /** - * Adds a path to an include that the current program depends on - */ - addExtraInclude(path) { return wrapJoinPoint(this._javaObject.addExtraInclude(unwrapJoinPoint(path))); } - /** - * Adds a path based on a git repository to an include that the current program depends on - */ - addExtraIncludeFromGit(gitRepo, path) { return wrapJoinPoint(this._javaObject.addExtraIncludeFromGit(unwrapJoinPoint(gitRepo), unwrapJoinPoint(path))); } - /** - * Adds a library (e.g., -pthreads) that the current program depends on - */ - addExtraLib(lib) { return wrapJoinPoint(this._javaObject.addExtraLib(unwrapJoinPoint(lib))); } - /** - * Adds a path to a source that the current program depends on - */ - addExtraSource(path) { return wrapJoinPoint(this._javaObject.addExtraSource(unwrapJoinPoint(path))); } - /** - * Adds a path based on a git repository to a source that the current program depends on - */ - addExtraSourceFromGit(gitRepo, path) { return wrapJoinPoint(this._javaObject.addExtraSourceFromGit(unwrapJoinPoint(gitRepo), unwrapJoinPoint(path))); } - /** - * Adds a file join point to the current program - */ - addFile(file) { return wrapJoinPoint(this._javaObject.addFile(unwrapJoinPoint(file))); } - /** - * Adds a file join point to the current program, from the given path, which can be either a Java File or a String - */ - addFileFromPath(filepath) { return wrapJoinPoint(this._javaObject.addFileFromPath(unwrapJoinPoint(filepath))); } - /** - * Adds a path based on a git repository to a project that the current program depends on - */ - addProjectFromGit(gitRepo, libs, path) { return wrapJoinPoint(this._javaObject.addProjectFromGit(unwrapJoinPoint(gitRepo), unwrapJoinPoint(libs), unwrapJoinPoint(path))); } - /** - * Registers a function to be executed when the program exits - */ - atexit(func) { return wrapJoinPoint(this._javaObject.atexit(unwrapJoinPoint(func))); } - /** - * Discards the AST at the top of the ASt stack - */ - pop() { return wrapJoinPoint(this._javaObject.pop()); } - /** - * Creates a copy of the current AST and pushes it to the top of the AST stack - */ - push() { return wrapJoinPoint(this._javaObject.push()); } - /** - * Recompiles the program currently represented by the AST, transforming literal code into AST nodes. Returns true if all files could be parsed correctly, or false otherwise - */ - rebuild() { return wrapJoinPoint(this._javaObject.rebuild()); } - /** - * Similar to rebuild, but tries to fix compilation errors. Resulting program may not represent the originally intended functionality - */ - rebuildFuzzy() { return wrapJoinPoint(this._javaObject.rebuildFuzzy()); } -} -/** - * Common class of struct, union and class - */ -export class RecordJp extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get fields() { return wrapJoinPoint(this._javaObject.getFields()); } - get functions() { return wrapJoinPoint(this._javaObject.getFunctions()); } - /** - * True if this particular join point is an implementation (i.e. has its body fully specified), false otherwise - */ - get isImplementation() { return wrapJoinPoint(this._javaObject.getIsImplementation()); } - /** - * True if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise - */ - get isPrototype() { return wrapJoinPoint(this._javaObject.getIsPrototype()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - /** - * Adds a field to a record (struct, class). - */ - addField(field) { return wrapJoinPoint(this._javaObject.addField(unwrapJoinPoint(field))); } -} -export class Statement extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get isFirst() { return wrapJoinPoint(this._javaObject.getIsFirst()); } - get isLast() { return wrapJoinPoint(this._javaObject.getIsLast()); } -} -/** - * Represets a struct declaration - */ -export class Struct extends RecordJp { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export class Switch extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The case statements inside this switch - */ - get cases() { return wrapJoinPoint(this._javaObject.getCases()); } - /** - * The condition of this switch statement - */ - get condition() { return wrapJoinPoint(this._javaObject.getCondition()); } - /** - * The default case statement of this switch statement or undefined if it does not have a default case - */ - get getDefaultCase() { return wrapJoinPoint(this._javaObject.getGetDefaultCase()); } - /** - * True if there is a default case in this switch statement, false otherwise - */ - get hasDefaultCase() { return wrapJoinPoint(this._javaObject.getHasDefaultCase()); } -} -export class SwitchCase extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * A pragma that references a point in the code and sticks to it - */ -export class Tag extends Pragma { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "id", - }; - /** - * The ID of the pragma - */ - get id() { return wrapJoinPoint(this._javaObject.getId()); } -} -export class TernaryOp extends Op { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get cond() { return wrapJoinPoint(this._javaObject.getCond()); } - get falseExpr() { return wrapJoinPoint(this._javaObject.getFalseExpr()); } - get trueExpr() { return wrapJoinPoint(this._javaObject.getTrueExpr()); } -} -export class This extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class Type extends Joinpoint { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get arrayDims() { return wrapJoinPoint(this._javaObject.getArrayDims()); } - get arraySize() { return wrapJoinPoint(this._javaObject.getArraySize()); } - get constant() { return wrapJoinPoint(this._javaObject.getConstant()); } - /** - * Single-step desugar. Returns the type itself if it does not have sugar - */ - get desugar() { return wrapJoinPoint(this._javaObject.getDesugar()); } - /** - * Single-step desugar. Returns the type itself if it does not have sugar - */ - set desugar(value) { this._javaObject.setDesugar(unwrapJoinPoint(value)); } - /** - * Completely desugars the type - */ - get desugarAll() { return wrapJoinPoint(this._javaObject.getDesugarAll()); } - /** - * A tree representation of the fields of this type - */ - get fieldTree() { return wrapJoinPoint(this._javaObject.getFieldTree()); } - get hasSugar() { return wrapJoinPoint(this._javaObject.getHasSugar()); } - get hasTemplateArgs() { return wrapJoinPoint(this._javaObject.getHasTemplateArgs()); } - get isArray() { return wrapJoinPoint(this._javaObject.getIsArray()); } - /** - * True if this is a type declared with the 'auto' keyword - */ - get isAuto() { return wrapJoinPoint(this._javaObject.getIsAuto()); } - get isBuiltin() { return wrapJoinPoint(this._javaObject.getIsBuiltin()); } - get isPointer() { return wrapJoinPoint(this._javaObject.getIsPointer()); } - get isTopLevel() { return wrapJoinPoint(this._javaObject.getIsTopLevel()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - /** - * Ignores certain types (e.g., DecayedType) - */ - get normalize() { return wrapJoinPoint(this._javaObject.getNormalize()); } - get templateArgsStrings() { return wrapJoinPoint(this._javaObject.getTemplateArgsStrings()); } - get templateArgsTypes() { return wrapJoinPoint(this._javaObject.getTemplateArgsTypes()); } - set templateArgsTypes(value) { this._javaObject.setTemplateArgsTypes(unwrapJoinPoint(value)); } - /** - * Maps names of join point fields that represent type join points, to their respective values - */ - get typeFields() { return wrapJoinPoint(this._javaObject.getTypeFields()); } - /** - * If the type encapsulates another type, returns the encapsulated type - */ - get unwrap() { return wrapJoinPoint(this._javaObject.getUnwrap()); } - /** - * Returns a new node based on this type with the qualifier const - */ - asConst() { return wrapJoinPoint(this._javaObject.asConst()); } - /** - * Sets the desugared type of this type - */ - setDesugar(desugaredType) { return wrapJoinPoint(this._javaObject.setDesugar(unwrapJoinPoint(desugaredType))); } - /** - * Sets a single template argument type of a template type - */ - setTemplateArgType(index, templateArgType) { return wrapJoinPoint(this._javaObject.setTemplateArgType(unwrapJoinPoint(index), unwrapJoinPoint(templateArgType))); } - /** - * Sets the template argument types of a template type - */ - setTemplateArgsTypes(templateArgTypes) { return wrapJoinPoint(this._javaObject.setTemplateArgsTypes(unwrapJoinPoint(templateArgTypes))); } - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - */ - setTypeFieldByValueRecursive(currentValue, newValue) { return wrapJoinPoint(this._javaObject.setTypeFieldByValueRecursive(unwrapJoinPoint(currentValue), unwrapJoinPoint(newValue))); } - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - */ - setUnderlyingType(oldValue, newValue) { return wrapJoinPoint(this._javaObject.setUnderlyingType(unwrapJoinPoint(oldValue), unwrapJoinPoint(newValue))); } -} -/** - * Base node for declarations which introduce a typedef-name - */ -export class TypedefNameDecl extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -/** - * Represents the type of a typedef. - */ -export class TypedefType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The typedef declaration associated with this typedef type - */ - get decl() { return wrapJoinPoint(this._javaObject.getDecl()); } - /** - * The type that is being typedef'd - */ - get underlyingType() { return wrapJoinPoint(this._javaObject.getUnderlyingType()); } -} -export class UnaryExprOrType extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get argExpr() { return wrapJoinPoint(this._javaObject.getArgExpr()); } - get argType() { return wrapJoinPoint(this._javaObject.getArgType()); } - set argType(value) { this._javaObject.setArgType(unwrapJoinPoint(value)); } - get hasArgExpr() { return wrapJoinPoint(this._javaObject.getHasArgExpr()); } - get hasTypeExpr() { return wrapJoinPoint(this._javaObject.getHasTypeExpr()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - setArgType(argType) { return wrapJoinPoint(this._javaObject.setArgType(unwrapJoinPoint(argType))); } -} -export class UnaryOp extends Op { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get isPointerDeref() { return wrapJoinPoint(this._javaObject.getIsPointerDeref()); } - get operand() { return wrapJoinPoint(this._javaObject.getOperand()); } -} -export class UndefinedType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * A reference to a variable - */ -export class Varref extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get declaration() { return wrapJoinPoint(this._javaObject.getDeclaration()); } - /** - * True if this variable reference has a MS-style property, false otherwise - */ - get hasProperty() { return wrapJoinPoint(this._javaObject.getHasProperty()); } - /** - * True if this varref represents a function call - */ - get isFunctionCall() { return wrapJoinPoint(this._javaObject.getIsFunctionCall()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } - set name(value) { this._javaObject.setName(unwrapJoinPoint(value)); } - /** - * If this variable reference has a MS-style property, returns the property name. Returns undefined otherwise - */ - get property() { return wrapJoinPoint(this._javaObject.getProperty()); } - /** - * Expression from where the attribute 'use' is calculated. In certain cases (e.g., array access, pointer dereference) the 'use' attribute is not calculated on the node itself, but on an ancestor of the node. This attribute returns that node - */ - get useExpr() { return wrapJoinPoint(this._javaObject.getUseExpr()); } - setName(name) { return wrapJoinPoint(this._javaObject.setName(unwrapJoinPoint(name))); } -} -export class WrapperStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get content() { return wrapJoinPoint(this._javaObject.getContent()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } -} -export class AccessSpecifier extends Decl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "kind", - }; - /** - * The type of specifier. Can return 'public', 'protected', 'private' or 'none' - */ - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } -} -export class AdjustedType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The type that is being adjusted - */ - get originalType() { return wrapJoinPoint(this._javaObject.getOriginalType()); } -} -export class ArrayAccess extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * Expression representing the variable of the array access (can be a varref, memberAccess...) - */ - get arrayVar() { return wrapJoinPoint(this._javaObject.getArrayVar()); } - /** - * If the array access is done over a variable, returns the name of the variable. Equivalent to $arrayAccess.arrayVar.name - */ - get name() { return wrapJoinPoint(this._javaObject.getName()); } - /** - * The number of subscripts of this array access - */ - get numSubscripts() { return wrapJoinPoint(this._javaObject.getNumSubscripts()); } - /** - * A view of the current arrayAccess without the last subscript, or undefined if this arrayAccess only has one subscript - */ - get parentAccess() { return wrapJoinPoint(this._javaObject.getParentAccess()); } - /** - * Expression of the array access subscript - */ - get subscript() { return wrapJoinPoint(this._javaObject.getSubscript()); } -} -export class ArrayType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get elementType() { return wrapJoinPoint(this._javaObject.getElementType()); } - set elementType(value) { this._javaObject.setElementType(unwrapJoinPoint(value)); } - /** - * Sets the element type of the array - */ - setElementType(arrayElementType) { return wrapJoinPoint(this._javaObject.setElementType(unwrapJoinPoint(arrayElementType))); } -} -export class AsmStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get clobbers() { return wrapJoinPoint(this._javaObject.getClobbers()); } - get isSimple() { return wrapJoinPoint(this._javaObject.getIsSimple()); } - get isVolatile() { return wrapJoinPoint(this._javaObject.getIsVolatile()); } -} -export class BinaryOp extends Op { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get isAssignment() { return wrapJoinPoint(this._javaObject.getIsAssignment()); } - get left() { return wrapJoinPoint(this._javaObject.getLeft()); } - set left(value) { this._javaObject.setLeft(unwrapJoinPoint(value)); } - get right() { return wrapJoinPoint(this._javaObject.getRight()); } - set right(value) { this._javaObject.setRight(unwrapJoinPoint(value)); } - setLeft(left) { return wrapJoinPoint(this._javaObject.setLeft(unwrapJoinPoint(left))); } - setRight(right) { return wrapJoinPoint(this._javaObject.setRight(unwrapJoinPoint(right))); } -} -export class BoolLiteral extends Literal { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get value() { return wrapJoinPoint(this._javaObject.getValue()); } -} -export class Break extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The enclosing statement related to this break. It should be either a loop or a switch statement. - */ - get enclosingStmt() { return wrapJoinPoint(this._javaObject.getEnclosingStmt()); } -} -export class BuiltinType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get builtinKind() { return wrapJoinPoint(this._javaObject.getBuiltinKind()); } - /** - * True, if ot is a floating type (e.g., float, double) - */ - get isFloat() { return wrapJoinPoint(this._javaObject.getIsFloat()); } - /** - * True, if it is an integer type - */ - get isInteger() { return wrapJoinPoint(this._javaObject.getIsInteger()); } - /** - * True, if it is a signed integer type - */ - get isSigned() { return wrapJoinPoint(this._javaObject.getIsSigned()); } - /** - * True, if it is an unsigned integer type - */ - get isUnsigned() { return wrapJoinPoint(this._javaObject.getIsUnsigned()); } - /** - * True, if it is the type 'void' - */ - get isVoid() { return wrapJoinPoint(this._javaObject.getIsVoid()); } -} -export class Call extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * An alias for 'args' - */ - get argList() { return wrapJoinPoint(this._javaObject.getArgList()); } - /** - * An array with the arguments of the call - */ - get args() { return wrapJoinPoint(this._javaObject.getArgs()); } - /** - * A 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found - */ - get declaration() { return wrapJoinPoint(this._javaObject.getDeclaration()); } - /** - * A 'function' join point that represents the function definition of the call; 'undefined' if no definition was found - */ - get definition() { return wrapJoinPoint(this._javaObject.getDefinition()); } - /** - * A function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function) - */ - get directCallee() { return wrapJoinPoint(this._javaObject.getDirectCallee()); } - /** - * A function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration - */ - get function() { return wrapJoinPoint(this._javaObject.getFunction()); } - /** - * The function type of the call, which includes the return type and the types of the parameters - */ - get functionType() { return wrapJoinPoint(this._javaObject.getFunctionType()); } - get isMemberAccess() { return wrapJoinPoint(this._javaObject.getIsMemberAccess()); } - get isStmtCall() { return wrapJoinPoint(this._javaObject.getIsStmtCall()); } - get memberAccess() { return wrapJoinPoint(this._javaObject.getMemberAccess()); } - get memberNames() { return wrapJoinPoint(this._javaObject.getMemberNames()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } - set name(value) { this._javaObject.setName(unwrapJoinPoint(value)); } - get numArgs() { return wrapJoinPoint(this._javaObject.getNumArgs()); } - /** - * The return type of the call - */ - get returnType() { return wrapJoinPoint(this._javaObject.getReturnType()); } - /** - * Similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function - */ - get signature() { return wrapJoinPoint(this._javaObject.getSignature()); } - getArg(index) { return wrapJoinPoint(this._javaObject.getArg(unwrapJoinPoint(index))); } - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - */ - addArg(p1, p2) { return wrapJoinPoint(this._javaObject.addArg(unwrapJoinPoint(p1), unwrapJoinPoint(p2))); } - /** - * Tries to inline this call - */ - inline() { return wrapJoinPoint(this._javaObject.inline()); } - setArg(index, expr) { return wrapJoinPoint(this._javaObject.setArg(unwrapJoinPoint(index), unwrapJoinPoint(expr))); } - setArgFromString(index, expr) { return wrapJoinPoint(this._javaObject.setArgFromString(unwrapJoinPoint(index), unwrapJoinPoint(expr))); } - /** - * Changes the name of the call - */ - setName(name) { return wrapJoinPoint(this._javaObject.setName(unwrapJoinPoint(name))); } - /** - * Wraps this call with a possibly new wrapping function - */ - wrap(name) { return wrapJoinPoint(this._javaObject.wrap(unwrapJoinPoint(name))); } -} -export class Case extends SwitchCase { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The instructions that are associated with this case in the source code. This does not represent what instructions are actually executed (e.g., if a case does not have a break, does not show instructions of the next case) - */ - get instructions() { return wrapJoinPoint(this._javaObject.getInstructions()); } - /** - * True if this is a default case, false otherwise - */ - get isDefault() { return wrapJoinPoint(this._javaObject.getIsDefault()); } - /** - * True if this case does not contain instructions (i.e., it is directly above another case), false otherwise - */ - get isEmpty() { return wrapJoinPoint(this._javaObject.getIsEmpty()); } - /** - * The case statement that comes after this case, or undefined if there are no more case statements - */ - get nextCase() { return wrapJoinPoint(this._javaObject.getNextCase()); } - /** - * The first statement that is not a case that will be executed by this case statement - */ - get nextInstruction() { return wrapJoinPoint(this._javaObject.getNextInstruction()); } - /** - * The values that the case statement will match. It can return zero (e.g., 'default:'), one (e.g., 'case 1:') or two (e.g., 'case 2...4:') expressions, depending on the format of the case - */ - get values() { return wrapJoinPoint(this._javaObject.getValues()); } -} -export class Cast extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get fromType() { return wrapJoinPoint(this._javaObject.getFromType()); } - /** - * @deprecated Use expr.implicitCast instead - */ - get isImplicitCast() { return wrapJoinPoint(this._javaObject.getIsImplicitCast()); } - get subExpr() { return wrapJoinPoint(this._javaObject.getSubExpr()); } - get toType() { return wrapJoinPoint(this._javaObject.getToType()); } -} -export class CilkSpawn extends Call { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export class CilkSync extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * Represents a C++ class - */ -export class Class extends RecordJp { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * All the classes this class inherits from - */ - get allBases() { return wrapJoinPoint(this._javaObject.getAllBases()); } - /** - * All the methods of this class, including inherited ones - */ - get allMethods() { return wrapJoinPoint(this._javaObject.getAllMethods()); } - /** - * The classes this class directly inherits from - */ - get bases() { return wrapJoinPoint(this._javaObject.getBases()); } - /** - * Class join points can either represent declarations or definitions, returns the definition of this class, if present, or the first declaration, if only declarations are present - */ - get canonical() { return wrapJoinPoint(this._javaObject.getCanonical()); } - /** - * The implementation (or definition) of this class present in the AST, or undefined if none is found - */ - get implementation() { return wrapJoinPoint(this._javaObject.getImplementation()); } - /** - * True, if contains at least one pure function - */ - get isAbstract() { return wrapJoinPoint(this._javaObject.getIsAbstract()); } - /** - * True if this is the class returned by the 'canonical' attribute - */ - get isCanonical() { return wrapJoinPoint(this._javaObject.getIsCanonical()); } - /** - * True, if all functions are pure - */ - get isInterface() { return wrapJoinPoint(this._javaObject.getIsInterface()); } - /** - * The methods declared by this class - */ - get methods() { return wrapJoinPoint(this._javaObject.getMethods()); } - /** - * The prototypes (or declarations) of this class present in the AST, if any - */ - get prototypes() { return wrapJoinPoint(this._javaObject.getPrototypes()); } - /** - * Adds a method to a class. If the given method has a definition, creates an equivalent declaration and adds it to the class, otherwise simply added the declaration to the class. In both cases, the declaration is only added to the class if there is no declaration already with the same signature. - */ - addMethod(method) { return wrapJoinPoint(this._javaObject.addMethod(unwrapJoinPoint(method))); } -} -export class Continue extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class CudaKernelCall extends Call { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get config() { return wrapJoinPoint(this._javaObject.getConfig()); } - set config(value) { this._javaObject.setConfig(unwrapJoinPoint(value)); } - setConfig(args) { return wrapJoinPoint(this._javaObject.setConfig(unwrapJoinPoint(args))); } - setConfigFromStrings(args) { return wrapJoinPoint(this._javaObject.setConfigFromStrings(unwrapJoinPoint(args))); } -} -export class DeclStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The declarations in this statement - */ - get decls() { return wrapJoinPoint(this._javaObject.getDecls()); } -} -/** - * Represents a decl that comes from a declarator (e.g., function, field, variable) - */ -export class Declarator extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export class Default extends SwitchCase { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class DeleteExpr extends Expression { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * Represents a type that was referred to using an elaborated type keyword, e.g., struct S, or via a qualified name, e.g., N::M::type, or both. This type is used to keep track of a type name as written in the source code, including tag keywords and any nested-name-specifiers. The type itself is always 'sugar', used to express what was written in the source code but containing no additional semantic information. - */ -export class ElaboratedType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The keyword of this elaborated type, if present. Can be one of: struct, interface, union, class, enum, typename - */ - get keyword() { return wrapJoinPoint(this._javaObject.getKeyword()); } - /** - * The type that is being prefixed with the qualifier - */ - get namedType() { return wrapJoinPoint(this._javaObject.getNamedType()); } - /** - * The qualifier of this elaborated type, if present (e.g., A::) - */ - get qualifier() { return wrapJoinPoint(this._javaObject.getQualifier()); } -} -export class EmptyStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -/** - * Represents an enum - */ -export class EnumDecl extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get enumerators() { return wrapJoinPoint(this._javaObject.getEnumerators()); } -} -export class EnumeratorDecl extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export class ExprStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * The expression join point associated to this exprStmt - */ - get expr() { return wrapJoinPoint(this._javaObject.getExpr()); } -} -/** - * Represents a member of a struct/union/class - */ -export class Field extends Declarator { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export class FloatLiteral extends Literal { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get value() { return wrapJoinPoint(this._javaObject.getValue()); } -} -/** - * Represents a function declaration or definition - */ -export class FunctionJp extends Declarator { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get body() { return wrapJoinPoint(this._javaObject.getBody()); } - set body(value) { this._javaObject.setBody(unwrapJoinPoint(value)); } - get calls() { return wrapJoinPoint(this._javaObject.getCalls()); } - /** - * Function join points can either represent declarations or definitions, returns the definition of this function, if present, or the first declaration, if only declarations are present - */ - get canonical() { return wrapJoinPoint(this._javaObject.getCanonical()); } - /** - * Returns the first prototype of this function that could be found, or undefined if there is none - */ - get declarationJp() { return wrapJoinPoint(this._javaObject.getDeclarationJp()); } - /** - * Returns the prototypes of this function that are present in the code. If there are none, returns an empty array - */ - get declarationJps() { return wrapJoinPoint(this._javaObject.getDeclarationJps()); } - /** - * Returns the implementation of this function if there is one, or undefined otherwise - */ - get definitionJp() { return wrapJoinPoint(this._javaObject.getDefinitionJp()); } - /** - * The type of the call, which includes the return type and the types of the parameters - */ - get functionType() { return wrapJoinPoint(this._javaObject.getFunctionType()); } - /** - * The type of the call, which includes the return type and the types of the parameters - */ - set functionType(value) { this._javaObject.setFunctionType(unwrapJoinPoint(value)); } - /** - * True if this particular function join point has a body, false otherwise - * - * @deprecated Use .isImplementation instead - */ - get hasDefinition() { return wrapJoinPoint(this._javaObject.getHasDefinition()); } - get id() { return wrapJoinPoint(this._javaObject.getId()); } - /** - * True, if this is the function returned by the 'canonical' attribute - */ - get isCanonical() { return wrapJoinPoint(this._javaObject.getIsCanonical()); } - get isCudaKernel() { return wrapJoinPoint(this._javaObject.getIsCudaKernel()); } - get isDelete() { return wrapJoinPoint(this._javaObject.getIsDelete()); } - /** - * True if this particular function join point is an implementation (i.e. has a body), false otherwise - */ - get isImplementation() { return wrapJoinPoint(this._javaObject.getIsImplementation()); } - get isInline() { return wrapJoinPoint(this._javaObject.getIsInline()); } - get isModulePrivate() { return wrapJoinPoint(this._javaObject.getIsModulePrivate()); } - /** - * True if this particular function join point is a prototype (i.e. does not have a body), false otherwise - */ - get isPrototype() { return wrapJoinPoint(this._javaObject.getIsPrototype()); } - get isPure() { return wrapJoinPoint(this._javaObject.getIsPure()); } - get isVirtual() { return wrapJoinPoint(this._javaObject.getIsVirtual()); } - get paramNames() { return wrapJoinPoint(this._javaObject.getParamNames()); } - get params() { return wrapJoinPoint(this._javaObject.getParams()); } - set params(value) { this._javaObject.setParams(unwrapJoinPoint(value)); } - get returnType() { return wrapJoinPoint(this._javaObject.getReturnType()); } - set returnType(value) { this._javaObject.setReturnType(unwrapJoinPoint(value)); } - /** - * A string with the signature of this function (e.g., name of the function, plus the parameters types) - */ - get signature() { return wrapJoinPoint(this._javaObject.getSignature()); } - /** - * The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC) - */ - get storageClass() { return wrapJoinPoint(this._javaObject.getStorageClass()); } - /** - * The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC) - */ - set storageClass(value) { this._javaObject.setStorageClass(unwrapJoinPoint(value)); } - getDeclaration(withReturnType) { return wrapJoinPoint(this._javaObject.getDeclaration(unwrapJoinPoint(withReturnType))); } - /** - * Adds a new parameter to the function - */ - addParam(p1, p2) { return wrapJoinPoint(this._javaObject.addParam(unwrapJoinPoint(p1), unwrapJoinPoint(p2))); } - /** - * Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class - */ - clone(newName, insert = true) { return wrapJoinPoint(this._javaObject.clone(unwrapJoinPoint(newName), unwrapJoinPoint(insert))); } - /** - * Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided). - */ - cloneOnFile(p1, p2) { return wrapJoinPoint(this._javaObject.cloneOnFile(unwrapJoinPoint(p1), unwrapJoinPoint(p2))); } - /** - * Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - */ - insertReturn(p1) { return wrapJoinPoint(this._javaObject.insertReturn(unwrapJoinPoint(p1))); } - /** - * Creates a new call to this function - */ - newCall(args) { return wrapJoinPoint(this._javaObject.newCall(unwrapJoinPoint(args))); } - /** - * Sets the body of the function - */ - setBody(body) { return wrapJoinPoint(this._javaObject.setBody(unwrapJoinPoint(body))); } - /** - * Sets the type of the function - */ - setFunctionType(functionType) { return wrapJoinPoint(this._javaObject.setFunctionType(unwrapJoinPoint(functionType))); } - /** - * Sets the parameter of the function at the given position - */ - setParam(p1, p2, p3) { return wrapJoinPoint(this._javaObject.setParam(unwrapJoinPoint(p1), unwrapJoinPoint(p2), unwrapJoinPoint(p3))); } - /** - * Sets the type of a parameter of the function - */ - setParamType(index, newType) { return wrapJoinPoint(this._javaObject.setParamType(unwrapJoinPoint(index), unwrapJoinPoint(newType))); } - /** - * Sets the parameters of the function - */ - setParams(params) { return wrapJoinPoint(this._javaObject.setParams(unwrapJoinPoint(params))); } - /** - * Overload that accepts strings that represent type-varname pairs (e.g., int param1) - */ - setParamsFromStrings(params) { return wrapJoinPoint(this._javaObject.setParamsFromStrings(unwrapJoinPoint(params))); } - /** - * Sets the return type of the function - */ - setReturnType(returnType) { return wrapJoinPoint(this._javaObject.setReturnType(unwrapJoinPoint(returnType))); } - /** - * Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise. - */ - setStorageClass(storageClass) { return wrapJoinPoint(this._javaObject.setStorageClass(unwrapJoinPoint(storageClass))); } -} -export class FunctionType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get paramTypes() { return wrapJoinPoint(this._javaObject.getParamTypes()); } - get returnType() { return wrapJoinPoint(this._javaObject.getReturnType()); } - set returnType(value) { this._javaObject.setReturnType(unwrapJoinPoint(value)); } - /** - * Sets the type of a parameter of the FunctionType. Be careful that if you directly change the type of a paramemter and the function type is associated with a function declaration, this change will not be reflected in the function. If you want to change the type of a parameter of a function declaration, use $function.setParaType - */ - setParamType(index, newType) { return wrapJoinPoint(this._javaObject.setParamType(unwrapJoinPoint(index), unwrapJoinPoint(newType))); } - /** - * Sets the return type of the FunctionType - */ - setReturnType(newType) { return wrapJoinPoint(this._javaObject.setReturnType(unwrapJoinPoint(newType))); } -} -export class GotoStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get label() { return wrapJoinPoint(this._javaObject.getLabel()); } - set label(value) { this._javaObject.setLabel(unwrapJoinPoint(value)); } - /** - * Sets the label of the goto - */ - setLabel(label) { return wrapJoinPoint(this._javaObject.setLabel(unwrapJoinPoint(label))); } -} -export class If extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get cond() { return wrapJoinPoint(this._javaObject.getCond()); } - set cond(value) { this._javaObject.setCond(unwrapJoinPoint(value)); } - get condDecl() { return wrapJoinPoint(this._javaObject.getCondDecl()); } - get else() { return wrapJoinPoint(this._javaObject.getElse()); } - set else(value) { this._javaObject.setElse(unwrapJoinPoint(value)); } - get then() { return wrapJoinPoint(this._javaObject.getThen()); } - set then(value) { this._javaObject.setThen(unwrapJoinPoint(value)); } - /** - * Sets the condition of the if - */ - setCond(cond) { return wrapJoinPoint(this._javaObject.setCond(unwrapJoinPoint(cond))); } - /** - * Sets the body of the else - */ - setElse(elseStatement) { return wrapJoinPoint(this._javaObject.setElse(unwrapJoinPoint(elseStatement))); } - /** - * Sets the body of the if - */ - setThen(then) { return wrapJoinPoint(this._javaObject.setThen(unwrapJoinPoint(then))); } -} -export class IncompleteArrayType extends ArrayType { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class IntLiteral extends Literal { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get value() { return wrapJoinPoint(this._javaObject.getValue()); } -} -export class LabelDecl extends NamedDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get labelStmt() { return wrapJoinPoint(this._javaObject.getLabelStmt()); } -} -export class LabelStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get decl() { return wrapJoinPoint(this._javaObject.getDecl()); } - set decl(value) { this._javaObject.setDecl(unwrapJoinPoint(value)); } - /** - * Sets the label of the label statement - */ - setDecl(label) { return wrapJoinPoint(this._javaObject.setDecl(unwrapJoinPoint(label))); } -} -export class Loop extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "kind", - }; - get body() { return wrapJoinPoint(this._javaObject.getBody()); } - set body(value) { this._javaObject.setBody(unwrapJoinPoint(value)); } - /** - * The statement of the loop condition - */ - get cond() { return wrapJoinPoint(this._javaObject.getCond()); } - /** - * The statement of the loop condition - */ - set cond(value) { this._javaObject.setCond(unwrapJoinPoint(value)); } - get condRelation() { return wrapJoinPoint(this._javaObject.getCondRelation()); } - set condRelation(value) { this._javaObject.setCondRelation(unwrapJoinPoint(value)); } - get controlVar() { return wrapJoinPoint(this._javaObject.getControlVar()); } - get controlVarref() { return wrapJoinPoint(this._javaObject.getControlVarref()); } - /** - * The expression of the last value of the control variable (e.g. 'length' in 'i < length;') - */ - get endValue() { return wrapJoinPoint(this._javaObject.getEndValue()); } - /** - * The expression of the last value of the control variable (e.g. 'length' in 'i < length;') - */ - set endValue(value) { this._javaObject.setEndValue(unwrapJoinPoint(value)); } - /** - * True if the condition of the loop in the canonical format, and is one of: <, <=, >, >= - */ - get hasCondRelation() { return wrapJoinPoint(this._javaObject.getHasCondRelation()); } - /** - * Uniquely identifies the loop inside the program - */ - get id() { return wrapJoinPoint(this._javaObject.getId()); } - /** - * The statement of the loop initialization - */ - get init() { return wrapJoinPoint(this._javaObject.getInit()); } - /** - * The statement of the loop initialization - */ - set init(value) { this._javaObject.setInit(unwrapJoinPoint(value)); } - /** - * The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;') - */ - get initValue() { return wrapJoinPoint(this._javaObject.getInitValue()); } - /** - * The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;') - */ - set initValue(value) { this._javaObject.setInitValue(unwrapJoinPoint(value)); } - get isInnermost() { return wrapJoinPoint(this._javaObject.getIsInnermost()); } - get isOutermost() { return wrapJoinPoint(this._javaObject.getIsOutermost()); } - get isParallel() { return wrapJoinPoint(this._javaObject.getIsParallel()); } - set isParallel(value) { this._javaObject.setIsParallel(unwrapJoinPoint(value)); } - get iterations() { return wrapJoinPoint(this._javaObject.getIterations()); } - get iterationsExpr() { return wrapJoinPoint(this._javaObject.getIterationsExpr()); } - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - set kind(value) { this._javaObject.setKind(unwrapJoinPoint(value)); } - get nestedLevel() { return wrapJoinPoint(this._javaObject.getNestedLevel()); } - get rank() { return wrapJoinPoint(this._javaObject.getRank()); } - /** - * The statement of the loop step - */ - get step() { return wrapJoinPoint(this._javaObject.getStep()); } - /** - * The statement of the loop step - */ - set step(value) { this._javaObject.setStep(unwrapJoinPoint(value)); } - /** - * The expression of the iteration step - */ - get stepValue() { return wrapJoinPoint(this._javaObject.getStepValue()); } - /** - * Tests whether the loops are interchangeable. This is a conservative test. - */ - isInterchangeable(otherLoop) { return wrapJoinPoint(this._javaObject.isInterchangeable(unwrapJoinPoint(otherLoop))); } - /** - * Interchanges two for loops, if possible - */ - interchange(otherLoop) { return wrapJoinPoint(this._javaObject.interchange(unwrapJoinPoint(otherLoop))); } - /** - * Sets the body of the loop - */ - setBody(body) { return wrapJoinPoint(this._javaObject.setBody(unwrapJoinPoint(body))); } - /** - * Sets the conditional statement of the loop. Works with loops of kind 'for' - */ - setCond(condCode) { return wrapJoinPoint(this._javaObject.setCond(unwrapJoinPoint(condCode))); } - /** - * Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge - */ - setCondRelation(operator) { return wrapJoinPoint(this._javaObject.setCondRelation(unwrapJoinPoint(operator))); } - /** - * Sets the end value of the loop. Works with loops of kind 'for' - */ - setEndValue(initCode) { return wrapJoinPoint(this._javaObject.setEndValue(unwrapJoinPoint(initCode))); } - /** - * Sets the init statement of the loop - */ - setInit(initCode) { return wrapJoinPoint(this._javaObject.setInit(unwrapJoinPoint(initCode))); } - /** - * Sets the init value of the loop. Works with loops of kind 'for' - */ - setInitValue(initCode) { return wrapJoinPoint(this._javaObject.setInitValue(unwrapJoinPoint(initCode))); } - /** - * Sets the attribute 'isParallel' of the loop - */ - setIsParallel(isParallel) { return wrapJoinPoint(this._javaObject.setIsParallel(unwrapJoinPoint(isParallel))); } - /** - * Sets the kind of the loop - */ - setKind(kind) { return wrapJoinPoint(this._javaObject.setKind(unwrapJoinPoint(kind))); } - /** - * Sets the step statement of the loop. Works with loops of kind 'for' - */ - setStep(stepCode) { return wrapJoinPoint(this._javaObject.setStep(unwrapJoinPoint(stepCode))); } - /** - * Applies loop tiling to this loop. - */ - tile(blockSize, reference, useTernary = true) { return wrapJoinPoint(this._javaObject.tile(unwrapJoinPoint(blockSize), unwrapJoinPoint(reference), unwrapJoinPoint(useTernary))); } -} -/** - * Special pragma that can be used to mark scopes (e.g., #pragma lara marker loop1) - */ -export class Marker extends Pragma { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "id", - }; - /** - * A scope, associated with this marker - */ - get contents() { return wrapJoinPoint(this._javaObject.getContents()); } - get id() { return wrapJoinPoint(this._javaObject.getId()); } -} -export class MemberCall extends Call { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get base() { return wrapJoinPoint(this._javaObject.getBase()); } - get rootBase() { return wrapJoinPoint(this._javaObject.getRootBase()); } -} -/** - * Represents a C++ class method declaration or definition - */ -export class Method extends FunctionJp { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - get record() { return wrapJoinPoint(this._javaObject.getRecord()); } - /** - * Removes the of the method - */ - removeRecord() { return wrapJoinPoint(this._javaObject.removeRecord()); } -} -/** - * Represents an OpenMP pragma (e.g., #pragma omp parallel) - */ -export class Omp extends Pragma { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "kind", - }; - /** - * The names of the kinds of all clauses in the pragma, or empty array if no clause is defined - */ - get clauseKinds() { return wrapJoinPoint(this._javaObject.getClauseKinds()); } - /** - * An integer expression, or undefined if no 'collapse' clause is defined - */ - get collapse() { return wrapJoinPoint(this._javaObject.getCollapse()); } - /** - * An integer expression, or undefined if no 'collapse' clause is defined - */ - set collapse(value) { this._javaObject.setCollapse(unwrapJoinPoint(value)); } - /** - * The variable names of all copyin clauses, or empty array if no copyin clause is defined - */ - get copyin() { return wrapJoinPoint(this._javaObject.getCopyin()); } - /** - * The variable names of all copyin clauses, or empty array if no copyin clause is defined - */ - set copyin(value) { this._javaObject.setCopyin(unwrapJoinPoint(value)); } - /** - * One of 'shared' or 'none', or undefined if no 'default' clause is defined - */ - get default() { return wrapJoinPoint(this._javaObject.getDefault()); } - /** - * One of 'shared' or 'none', or undefined if no 'default' clause is defined - */ - set default(value) { this._javaObject.setDefault(unwrapJoinPoint(value)); } - /** - * The variable names of all firstprivate clauses, or empty array if no firstprivate clause is defined - */ - get firstprivate() { return wrapJoinPoint(this._javaObject.getFirstprivate()); } - /** - * The variable names of all firstprivate clauses, or empty array if no firstprivate clause is defined - */ - set firstprivate(value) { this._javaObject.setFirstprivate(unwrapJoinPoint(value)); } - /** - * The kind of the directive - */ - get kind() { return wrapJoinPoint(this._javaObject.getKind()); } - /** - * The kind of the directive - */ - set kind(value) { this._javaObject.setKind(unwrapJoinPoint(value)); } - /** - * The variable names of all lastprivate clauses, or empty array if no lastprivate clause is defined - */ - get lastprivate() { return wrapJoinPoint(this._javaObject.getLastprivate()); } - /** - * The variable names of all lastprivate clauses, or empty array if no lastprivate clause is defined - */ - set lastprivate(value) { this._javaObject.setLastprivate(unwrapJoinPoint(value)); } - /** - * An integer expression, or undefined if no 'num_threads' clause is defined - */ - get numThreads() { return wrapJoinPoint(this._javaObject.getNumThreads()); } - /** - * An integer expression, or undefined if no 'num_threads' clause is defined - */ - set numThreads(value) { this._javaObject.setNumThreads(unwrapJoinPoint(value)); } - /** - * An integer expression, or undefined if no 'ordered' clause with a parameter is defined - */ - get ordered() { return wrapJoinPoint(this._javaObject.getOrdered()); } - /** - * An integer expression, or undefined if no 'ordered' clause with a parameter is defined - */ - set ordered(value) { this._javaObject.setOrdered(unwrapJoinPoint(value)); } - /** - * The variable names of all private clauses, or empty array if no private clause is defined - */ - get private() { return wrapJoinPoint(this._javaObject.getPrivate()); } - /** - * The variable names of all private clauses, or empty array if no private clause is defined - */ - set private(value) { this._javaObject.setPrivate(unwrapJoinPoint(value)); } - /** - * One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined - */ - get procBind() { return wrapJoinPoint(this._javaObject.getProcBind()); } - /** - * One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined - */ - set procBind(value) { this._javaObject.setProcBind(unwrapJoinPoint(value)); } - /** - * The reduction kinds in the reductions clauses of the this pragma, or empty array if no reduction is defined - */ - get reductionKinds() { return wrapJoinPoint(this._javaObject.getReductionKinds()); } - /** - * An integer expression, or undefined if no 'schedule' clause with chunk size is defined - */ - get scheduleChunkSize() { return wrapJoinPoint(this._javaObject.getScheduleChunkSize()); } - /** - * An integer expression, or undefined if no 'schedule' clause with chunk size is defined - */ - set scheduleChunkSize(value) { this._javaObject.setScheduleChunkSize(unwrapJoinPoint(value)); } - /** - * One of 'static', 'dynamic', 'guided', 'auto' or 'runtime', or undefined if no 'schedule' clause is defined - */ - get scheduleKind() { return wrapJoinPoint(this._javaObject.getScheduleKind()); } - /** - * One of 'static', 'dynamic', 'guided', 'auto' or 'runtime', or undefined if no 'schedule' clause is defined - */ - set scheduleKind(value) { this._javaObject.setScheduleKind(unwrapJoinPoint(value)); } - /** - * A list with possible values of 'monotonic', 'nonmonotonic' or 'simd', or undefined if no 'schedule' clause with modifiers is defined - */ - get scheduleModifiers() { return wrapJoinPoint(this._javaObject.getScheduleModifiers()); } - /** - * A list with possible values of 'monotonic', 'nonmonotonic' or 'simd', or undefined if no 'schedule' clause with modifiers is defined - */ - set scheduleModifiers(value) { this._javaObject.setScheduleModifiers(unwrapJoinPoint(value)); } - /** - * The variable names of all shared clauses, or empty array if no shared clause is defined - */ - get shared() { return wrapJoinPoint(this._javaObject.getShared()); } - /** - * The variable names of all shared clauses, or empty array if no shared clause is defined - */ - set shared(value) { this._javaObject.setShared(unwrapJoinPoint(value)); } - /** - * The variable names for the given reduction kind, or empty array if no reduction of that kind is defined - */ - getReduction(kind) { return wrapJoinPoint(this._javaObject.getReduction(unwrapJoinPoint(kind))); } - /** - * True if the directive has at least one clause of the given clause kind, false otherwise - */ - hasClause(clauseName) { return wrapJoinPoint(this._javaObject.hasClause(unwrapJoinPoint(clauseName))); } - /** - * True if it is legal to use the given clause kind in this directive, false otherwise - */ - isClauseLegal(clauseName) { return wrapJoinPoint(this._javaObject.isClauseLegal(unwrapJoinPoint(clauseName))); } - /** - * Removes any clause of the given kind from the OpenMP pragma - */ - removeClause(clauseKind) { return wrapJoinPoint(this._javaObject.removeClause(unwrapJoinPoint(clauseKind))); } - /** - * Sets the value of the collapse clause of an OpenMP pragma - */ - setCollapse(p1) { return wrapJoinPoint(this._javaObject.setCollapse(unwrapJoinPoint(p1))); } - /** - * Sets the variables of a copyin clause of an OpenMP pragma - */ - setCopyin(newVariables) { return wrapJoinPoint(this._javaObject.setCopyin(unwrapJoinPoint(newVariables))); } - /** - * Sets the value of the default clause of an OpenMP pragma - */ - setDefault(newDefault) { return wrapJoinPoint(this._javaObject.setDefault(unwrapJoinPoint(newDefault))); } - /** - * Sets the variables of a firstprivate clause of an OpenMP pragma - */ - setFirstprivate(newVariables) { return wrapJoinPoint(this._javaObject.setFirstprivate(unwrapJoinPoint(newVariables))); } - /** - * Sets the directive kind of the OpenMP pragma. Any unsupported clauses will be discarded - */ - setKind(directiveKind) { return wrapJoinPoint(this._javaObject.setKind(unwrapJoinPoint(directiveKind))); } - /** - * Sets the variables of a lastprivate clause of an OpenMP pragma - */ - setLastprivate(newVariables) { return wrapJoinPoint(this._javaObject.setLastprivate(unwrapJoinPoint(newVariables))); } - /** - * Sets the value of the num_threads clause of an OpenMP pragma - */ - setNumThreads(newExpr) { return wrapJoinPoint(this._javaObject.setNumThreads(unwrapJoinPoint(newExpr))); } - /** - * Sets the value of the ordered clause of an OpenMP pragma - */ - setOrdered(parameters) { return wrapJoinPoint(this._javaObject.setOrdered(unwrapJoinPoint(parameters))); } - /** - * Sets the variables of a private clause of an OpenMP pragma - */ - setPrivate(newVariables) { return wrapJoinPoint(this._javaObject.setPrivate(unwrapJoinPoint(newVariables))); } - /** - * Sets the value of the proc_bind clause of an OpenMP pragma - */ - setProcBind(newBind) { return wrapJoinPoint(this._javaObject.setProcBind(unwrapJoinPoint(newBind))); } - /** - * Sets the variables for a given kind of a reduction clause of an OpenMP pragma - */ - setReduction(kind, newVariables) { return wrapJoinPoint(this._javaObject.setReduction(unwrapJoinPoint(kind), unwrapJoinPoint(newVariables))); } - /** - * Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - */ - setScheduleChunkSize(p1) { return wrapJoinPoint(this._javaObject.setScheduleChunkSize(unwrapJoinPoint(p1))); } - /** - * Sets the value of the schedule clause of an OpenMP pragma - */ - setScheduleKind(scheduleKind) { return wrapJoinPoint(this._javaObject.setScheduleKind(unwrapJoinPoint(scheduleKind))); } - /** - * Sets the value of the modifiers in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - */ - setScheduleModifiers(modifiers) { return wrapJoinPoint(this._javaObject.setScheduleModifiers(unwrapJoinPoint(modifiers))); } - /** - * Sets the variables of a shared clause of an OpenMP pragma - */ - setShared(newVariables) { return wrapJoinPoint(this._javaObject.setShared(unwrapJoinPoint(newVariables))); } -} -export class ParenType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get innerType() { return wrapJoinPoint(this._javaObject.getInnerType()); } - set innerType(value) { this._javaObject.setInnerType(unwrapJoinPoint(value)); } - /** - * Sets the inner type of this paren type - */ - setInnerType(innerType) { return wrapJoinPoint(this._javaObject.setInnerType(unwrapJoinPoint(innerType))); } -} -export class PointerType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get pointee() { return wrapJoinPoint(this._javaObject.getPointee()); } - set pointee(value) { this._javaObject.setPointee(unwrapJoinPoint(value)); } - /** - * Number of pointer levels from this pointer - */ - get pointerLevels() { return wrapJoinPoint(this._javaObject.getPointerLevels()); } - /** - * Sets the pointee type of this pointer type - */ - setPointee(pointeeType) { return wrapJoinPoint(this._javaObject.setPointee(unwrapJoinPoint(pointeeType))); } -} -export class QualType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get qualifiers() { return wrapJoinPoint(this._javaObject.getQualifiers()); } - get unqualifiedType() { return wrapJoinPoint(this._javaObject.getUnqualifiedType()); } -} -export class ReturnStmt extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get returnExpr() { return wrapJoinPoint(this._javaObject.getReturnExpr()); } -} -/** - * Represents a group of statements - */ -export class Scope extends Statement { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * Returns the descendant statements of this scope, excluding other scopes, loops, ifs and wrapper statements - */ - get allStmts() { return wrapJoinPoint(this._javaObject.getAllStmts()); } - get firstStmt() { return wrapJoinPoint(this._javaObject.getFirstStmt()); } - get lastStmt() { return wrapJoinPoint(this._javaObject.getLastStmt()); } - /** - * True if the scope does not have curly braces - */ - get naked() { return wrapJoinPoint(this._javaObject.getNaked()); } - /** - * True if the scope does not have curly braces - */ - set naked(value) { this._javaObject.setNaked(unwrapJoinPoint(value)); } - /** - * The statement that owns the scope (e.g., function, loop...) - */ - get owner() { return wrapJoinPoint(this._javaObject.getOwner()); } - /** - * Returns the direct (children) statements of this scope - */ - get stmts() { return wrapJoinPoint(this._javaObject.getStmts()); } - /** - * The number of statements in the scope, including the statements inside the declaration and bodies of structures such as ifs and loops, and not considering comments and pragmas. If flat is true, does not consider the statements inside structures such as ifs and loops (e.g., a loop counts as one statement) - */ - getNumStatements(flat = false) { return wrapJoinPoint(this._javaObject.getNumStatements(unwrapJoinPoint(flat))); } - /** - * Adds a new local variable to this scope - */ - addLocal(name, type, initValue) { return wrapJoinPoint(this._javaObject.addLocal(unwrapJoinPoint(name), unwrapJoinPoint(type), unwrapJoinPoint(initValue))); } - /** - * CFG tester - */ - cfg() { return wrapJoinPoint(this._javaObject.cfg()); } - /** - * Clears the contents of this scope (untested) - */ - clear() { return wrapJoinPoint(this._javaObject.clear()); } - /** - * DFG tester - */ - dfg() { return wrapJoinPoint(this._javaObject.dfg()); } - insertBegin(p1) { return wrapJoinPoint(this._javaObject.insertBegin(unwrapJoinPoint(p1))); } - insertEnd(p1) { return wrapJoinPoint(this._javaObject.insertEnd(unwrapJoinPoint(p1))); } - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - */ - insertReturn(p1) { return wrapJoinPoint(this._javaObject.insertReturn(unwrapJoinPoint(p1))); } - /** - * Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces) - */ - setNaked(isNaked) { return wrapJoinPoint(this._javaObject.setNaked(unwrapJoinPoint(isNaked))); } -} -export class TagType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - /** - * A 'decl' join point that represents the declaration of this tag type - */ - get decl() { return wrapJoinPoint(this._javaObject.getDecl()); } - get name() { return wrapJoinPoint(this._javaObject.getName()); } -} -export class TemplateSpecializationType extends Type { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get args() { return wrapJoinPoint(this._javaObject.getArgs()); } - get firstArgType() { return wrapJoinPoint(this._javaObject.getFirstArgType()); } - get numArgs() { return wrapJoinPoint(this._javaObject.getNumArgs()); } - get templateName() { return wrapJoinPoint(this._javaObject.getTemplateName()); } -} -/** - * Declaration of a typedef-name via the 'typedef' type specifier - */ -export class TypedefDecl extends TypedefNameDecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -/** - * Represents a variable declaration or definition - */ -export class Vardecl extends Declarator { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; - /** - * The vardecl corresponding to the actual definition. For global variables, returns the vardecl of the file where it is actually defined (instead of the vardecl that defines an external link to the variable) - */ - get definition() { return wrapJoinPoint(this._javaObject.getDefinition()); } - /** - * True, if vardecl has an initialization value - */ - get hasInit() { return wrapJoinPoint(this._javaObject.getHasInit()); } - /** - * If vardecl has an initialization value, returns an expression with that value - */ - get init() { return wrapJoinPoint(this._javaObject.getInit()); } - /** - * If vardecl has an initialization value, returns an expression with that value - */ - set init(value) { this._javaObject.setInit(unwrapJoinPoint(value)); } - /** - * The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit - */ - get initStyle() { return wrapJoinPoint(this._javaObject.getInitStyle()); } - /** - * True, if this variable does not have local storage. This includes all global variables as well as static variables declared within a function. - */ - get isGlobal() { return wrapJoinPoint(this._javaObject.getIsGlobal()); } - /** - * True, if vardecl is a function parameter - */ - get isParam() { return wrapJoinPoint(this._javaObject.getIsParam()); } - /** - * Storage class specifier, which can be none, extern, static, __private_extern__, auto, register - */ - get storageClass() { return wrapJoinPoint(this._javaObject.getStorageClass()); } - /** - * Storage class specifier, which can be none, extern, static, __private_extern__, auto, register - */ - set storageClass(value) { this._javaObject.setStorageClass(unwrapJoinPoint(value)); } - /** - * If vardecl already has an initialization, removes it. - */ - removeInit(removeConst = true) { return wrapJoinPoint(this._javaObject.removeInit(unwrapJoinPoint(removeConst))); } - /** - * Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - */ - setInit(p1) { return wrapJoinPoint(this._javaObject.setInit(unwrapJoinPoint(p1))); } - /** - * Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl - */ - setStorageClass(storageClass) { return wrapJoinPoint(this._javaObject.setStorageClass(unwrapJoinPoint(storageClass))); } - /** - * Creates a new varref based on this vardecl - */ - varref() { return wrapJoinPoint(this._javaObject.varref()); } -} -export class VariableArrayType extends ArrayType { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get sizeExpr() { return wrapJoinPoint(this._javaObject.getSizeExpr()); } - set sizeExpr(value) { this._javaObject.setSizeExpr(unwrapJoinPoint(value)); } - /** - * Sets the size expression of this variable array type - */ - setSizeExpr(sizeExpr) { return wrapJoinPoint(this._javaObject.setSizeExpr(unwrapJoinPoint(sizeExpr))); } -} -export class Body extends Scope { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; -} -export class CilkFor extends Loop { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "kind", - }; -} -export class EnumType extends TagType { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: null, - }; - get integerType() { return wrapJoinPoint(this._javaObject.getIntegerType()); } -} -export class Param extends Vardecl { - /** - * @internal - */ - static _defaultAttributeInfo = { - name: "name", - }; -} -export var StorageClass; -(function (StorageClass) { - StorageClass["AUTO"] = "auto"; - StorageClass["EXTERN"] = "extern"; - StorageClass["NONE"] = "none"; - StorageClass["PRIVATE_EXTERN"] = "private_extern"; - StorageClass["REGISTER"] = "register"; - StorageClass["STATIC"] = "static"; -})(StorageClass || (StorageClass = {})); -export var Relation; -(function (Relation) { - Relation["EQ"] = "eq"; - Relation["GE"] = "ge"; - Relation["GT"] = "gt"; - Relation["LE"] = "le"; - Relation["LT"] = "lt"; - Relation["NE"] = "ne"; -})(Relation || (Relation = {})); -const JoinpointMapper = { - joinpoint: Joinpoint, - attribute: Attribute, - clavaException: ClavaException, - comment: Comment, - decl: Decl, - empty: Empty, - expression: Expression, - file: FileJp, - implicitValue: ImplicitValue, - include: Include, - initList: InitList, - literal: Literal, - memberAccess: MemberAccess, - namedDecl: NamedDecl, - newExpr: NewExpr, - op: Op, - parenExpr: ParenExpr, - pragma: Pragma, - program: Program, - record: RecordJp, - statement: Statement, - struct: Struct, - switch: Switch, - switchCase: SwitchCase, - tag: Tag, - ternaryOp: TernaryOp, - this: This, - type: Type, - typedefNameDecl: TypedefNameDecl, - typedefType: TypedefType, - unaryExprOrType: UnaryExprOrType, - unaryOp: UnaryOp, - undefinedType: UndefinedType, - varref: Varref, - wrapperStmt: WrapperStmt, - accessSpecifier: AccessSpecifier, - adjustedType: AdjustedType, - arrayAccess: ArrayAccess, - arrayType: ArrayType, - asmStmt: AsmStmt, - binaryOp: BinaryOp, - boolLiteral: BoolLiteral, - break: Break, - builtinType: BuiltinType, - call: Call, - case: Case, - cast: Cast, - cilkSpawn: CilkSpawn, - cilkSync: CilkSync, - class: Class, - continue: Continue, - cudaKernelCall: CudaKernelCall, - declStmt: DeclStmt, - declarator: Declarator, - default: Default, - deleteExpr: DeleteExpr, - elaboratedType: ElaboratedType, - emptyStmt: EmptyStmt, - enumDecl: EnumDecl, - enumeratorDecl: EnumeratorDecl, - exprStmt: ExprStmt, - field: Field, - floatLiteral: FloatLiteral, - function: FunctionJp, - functionType: FunctionType, - gotoStmt: GotoStmt, - if: If, - incompleteArrayType: IncompleteArrayType, - intLiteral: IntLiteral, - labelDecl: LabelDecl, - labelStmt: LabelStmt, - loop: Loop, - marker: Marker, - memberCall: MemberCall, - method: Method, - omp: Omp, - parenType: ParenType, - pointerType: PointerType, - qualType: QualType, - returnStmt: ReturnStmt, - scope: Scope, - tagType: TagType, - templateSpecializationType: TemplateSpecializationType, - typedefDecl: TypedefDecl, - vardecl: Vardecl, - variableArrayType: VariableArrayType, - body: Body, - cilkFor: CilkFor, - enumType: EnumType, - param: Param, -}; -let registered = false; -if (!registered) { - registerJoinpointMapper(JoinpointMapper); - registered = true; -} -//# sourceMappingURL=Joinpoints.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/Clava.js b/ClavaLaraApi/src-lara/clava/clava/Clava.js deleted file mode 100644 index f56fc3302c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/Clava.js +++ /dev/null @@ -1,185 +0,0 @@ -import { wrapJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.js"; -import Io from "@specs-feup/lara/api/lara/Io.js"; -import JavaInterop from "@specs-feup/lara/api/lara/JavaInterop.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import Weaver from "@specs-feup/lara/api/weaver/Weaver.js"; -import WeaverOptions from "@specs-feup/lara/api/weaver/WeaverOptions.js"; -import ClavaJavaTypes from "./ClavaJavaTypes.js"; -import ClavaDataStore from "./util/ClavaDataStore.js"; -export default class Clava { - /** - * Enables/disables library SpecsLogger for printing. - *

- * By default, is disabled. - */ - static useSpecsLogger = false; - /** - * Returns the standard being used for compilation. - */ - static getStandard() { - return Clava.getProgram().standard; - } - static isCxx() { - return Clava.getProgram().isCxx; - } - static rebuild() { - return Clava.getProgram().rebuild(); - } - static rebuildFuzzy() { - Clava.getProgram().rebuildFuzzy(); - } - /** - * @returns The folder of the first input source element, either itself, if a folder, or the parent folder, if it is a file. - */ - static getBaseFolder() { - return Clava.getProgram().baseFolder; - } - /** - * @returns The folder where the code represented by the AST will be written at the end of execution. - */ - static getWeavingFolder() { - return Clava.getProgram().weavingFolder; - } - /** - * @param $file - The file to add to the AST. - */ - static addFile($file) { - Clava.getProgram().addFile($file); - } - /** - * @param path - Path to an existing source file that will be added to the AST. If the file does not exists, throws an exception. - */ - static addExistingFile(path) { - const file = Io.getPath(path); - if (!file.isFile()) { - throw new Error("Clava.addExistingFile(): path " + - path.toString() + - " does not represent an existing file"); - } - const $file = wrapJoinPoint(ClavaJavaTypes.AstFactory.file(file.getAbsolutePath(), "")); - Clava.addFile($file); - } - static cLinkageBegin = `#ifdef __cplusplus -extern "C" { -#endif`; - static cLinkageEnd = `#ifdef __cplusplus -} -#endif`; - /** - * Launches a Clava weaving session. - * @param args - The arguments to pass to the weaver, as if it was launched from the command-line - * @returns True if the weaver execution without problems, false otherwise - */ - static runClava(args) { - // If string, separate arguments - if (typeof args === "string") { - args = ClavaJavaTypes.ArgumentsParser.newCommandLine().parse(args); - } - return ClavaJavaTypes.ClavaWeaverLauncher.execute(args); - } - /** - * Launches several Clava weaving sessions in parallel. - * - * @param argsLists - An array where each element is an array with the arguments to pass to the weaver, as if it was launched from the command-line - * @param threads - Number of threads to use - * @param clavaCommand - The command we should use to call Clava (e.g., /usr/local/bin/clava) - * - * @returns The results of each execution - */ - static runClavaParallel(argsLists, threads = -1, clavaCommand = ["clava"]) { - if (typeof clavaCommand === "string") { - clavaCommand = [clavaCommand]; - } - const jsonStrings = ClavaJavaTypes.ClavaWeaverLauncher.executeParallel(argsLists, threads, JavaInterop.arrayToStringList(clavaCommand), Clava.getData().getContextFolder().getAbsolutePath()); - // Read each json file into its own object - const results = jsonStrings.map((jsonString) => JSON.parse(jsonString)); - return results; - } - /** - * Creates a clone of the current AST and pushes the clone to the top of the current AST stack. If a $program join point is passed, that join point is added to the top of the stack instead. - * - * @param $program - program to push to the AST. - */ - static pushAst($program) { - if ($program === undefined) { - Clava.getProgram().push(); - return; - } - Weaver.getWeaverEngine().pushAst($program.node); - } - /** - * Discards the AST at the top of the current AST stack. - */ - static popAst() { - Clava.getProgram().pop(); - } - /** - * Clears all ASTs except for the one at the top of the stack. If there is one of none AST on the stack does nothing. - */ - static clearAstHistory() { - Weaver.getWeaverEngine().clearAppHistory(); - } - /** - * The current number of elements in the AST stack. - */ - static getStackSize() { - return Weaver.getWeaverEngine().getStackSize(); - } - /** - * Looks for a join point in the current AST. - * - * @param $jp - A join point from any AST - * @returns The equivalent join point from the AST at the top of the current AST stack - */ - static findJp($jp) { - // Get file - const $file = $jp.getAncestor("file"); - if ($file === undefined) { - console.error("Could not find a file for '" + $jp.joinPointType + "'", "Clava.findJp"); - return undefined; - } - const $newJp = ClavaJavaTypes.CxxWeaverApi.findJp($file.filepath, $jp.astId); - if ($newJp === null) { - console.error("Could not find the given '" + - $jp.joinPointType + - "' in the current AST. Please verify if a rebuild was done", "Clava.findJp"); - return undefined; - } - return $newJp; - } - /** - * Writes the code of the current AST to the given folder. - */ - static writeCode(outputFoldername) { - const outputFolder = Io.mkdir(outputFoldername); - ClavaJavaTypes.CxxWeaverApi.writeCode(outputFolder); - return outputFolder; - } - /** - * @returns DataStore with the data of the current weaver - */ - static getData() { - return new ClavaDataStore(WeaverOptions.getData()); - } - /** - * @returns The join point $program. - */ - static getProgram() { - return Query.root(); - } - /** - * - * @returns A list of join points representing available user includes - */ - static getAvailableIncludes() { - return ClavaJavaTypes.CxxWeaverApi.getAvailableUserIncludes(); - } - /** - * - * @returns {J#Set} A set with paths to the include folders of the current configuration. - */ - static getIncludeFolders() { - return ClavaJavaTypes.CxxWeaverApi.getIncludeFolders(); - } -} -//# sourceMappingURL=Clava.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/ClavaCode.js b/ClavaLaraApi/src-lara/clava/clava/ClavaCode.js deleted file mode 100644 index 6132ca1f03..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/ClavaCode.js +++ /dev/null @@ -1,163 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { FileJp, FunctionJp, If, Loop, StorageClass, Vardecl, } from "../Joinpoints.js"; -import Clava from "./Clava.js"; -/** - * Utility methods related with the source code. - * - */ -export default class ClavaCode { - /** - * Writes the code corresponding to the current AST as a single file. - * - */ - static toSingleFile(fileOrBaseFolder, optionalFile) { - if (fileOrBaseFolder === undefined) { - fileOrBaseFolder = Clava.getWeavingFolder(); - const extension = Clava.isCxx() ? "cpp" : "c"; - optionalFile = "main." + extension; - } - const singleFileCode = ClavaCode.toSingleFileCode(); - let outputFile = Io.getPath(fileOrBaseFolder, optionalFile); - Io.writeFile(outputFile, singleFileCode); - // Copy includes - const baseFolder = outputFile.getParentFile(); - for (const $include of Clava.getAvailableIncludes()) { - outputFile = Io.getPath(baseFolder, $include.name); - Io.writeFile(outputFile, Io.readFile($include.filepath)); - } - } - /** - * Generates code for a single fime corresponding to the current AST. - * - * @returns The code of the current AST as a single file. - */ - static toSingleFileCode() { - const staticVerification = true; - const includes = new Set(); - let bodyCode = ""; - for (const $file of Query.search(FileJp)) { - if ($file.isHeader) { - continue; - } - // Deal with static declarations - const codeChanged = ClavaCode.renameStaticDeclarations($file, staticVerification); - if (codeChanged) { - bodyCode += $file.code + "\n"; - console.log("Generated file '" + - $file.filepath + - "' from AST, macros have disappeared"); - } - else { - bodyCode += Io.readFile($file.filepath) + "\n"; - } - // Collects all includes from input files, in order to put them at the beginning of the file - for (const $child of $file.astChildren) { - if ($child.astName === "IncludeDecl") { - includes.add($child.code); - } - } - } - const singleFileCode = Array.from(includes).join("\n") + "\n" + bodyCode; - return singleFileCode; - } - static renameStaticDeclarations($file, staticVerification) { - if (!staticVerification) { - return false; - } - let changedCode = false; - // Look for static declarations - for (const child of $file.children) { - if (child instanceof FunctionJp && - child.storageClass === StorageClass.STATIC) { - const newName = child.name + "_static_rename"; - child.name = newName; - changedCode = true; - } - if (child instanceof Vardecl && - child.storageClass === StorageClass.STATIC) { - console.log(child.code); - throw "Not yet supported for static variable declarations"; - } - } - return changedCode; - } - /** - * Tries to statically detect if a statement is executed only once. - * - * Restrictions: - * - Does not take into account runtime execution problems, such as exceptions; - * - Does not detect if the function is called indirectly through a function pointer; - * - * @returns True if it could be detected, within the restrictions, that the statement is only executed once. - */ - static isExecutedOnce($statement) { - // Go back until it finds the function body - let $currentScope = undefined; - if ($statement !== undefined) { - $currentScope = $statement.getAncestor("scope"); - } - while ($currentScope !== undefined) { - const $scopeOwner = $currentScope.owner; - // If finds a scope that is part of a loop or if/else, return false immediately - if ($scopeOwner instanceof Loop || $scopeOwner instanceof If) { - debug("ClavaCode.isExecutedOnce: failed because scope is part of loop or if"); - return false; - } - // If function, check if main function - if ($scopeOwner instanceof FunctionJp) { - const $function = $scopeOwner; - // If main, passes check - if ($function.name === "main") { - return true; - } - // Verify if function is called only once - const calls = $function.calls; - if (calls.length !== 1) { - debug("ClavaCode.isExecutedOnce: failed because function '" + - $function.name + - "' is called " + - calls.length + - " times"); - return false; - } - const $singleCall = calls[0]; - // Recursively call the function on the call statement - return ClavaCode.isExecutedOnce($singleCall.getAncestor("statement")); - } - $currentScope = $currentScope.getAncestor("scope"); - } - // Could not find the scope of the statement. Is it outside of a function? - debug("ClavaCode.isExecutedOnce: failed because scope could not be found"); - return false; - } - /** - * Returns the function definitions in the program with the given name. - * - * @param functionName - The name of the function to find - * @param isSingleFunction - If true, ensures there is a single definition with the given name - * @returns An array of function definitions, or a single function is 'isSingleFunction' is true - */ - static getFunctionDefinition(functionName, isSingleFunction) { - // Locate function - const functionSearch = Clava.getProgram() - .getDescendants("function") - .filter(($f) => { - const $function = $f; - return $function.name === functionName && $function.hasDefinition; - }); - // If single function false, return search results - if (!isSingleFunction) { - return functionSearch; - } - if (functionSearch.length === 0) { - throw `Could not find function with name '${functionName}'`; - } - if (functionSearch.length > 1) { - throw `Found more than one definition for function with name '${functionName}'`; - } - return functionSearch[0]; - } -} -//# sourceMappingURL=ClavaCode.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/ClavaJavaTypes.js b/ClavaLaraApi/src-lara/clava/clava/ClavaJavaTypes.js deleted file mode 100644 index 884156d2f4..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/ClavaJavaTypes.js +++ /dev/null @@ -1,62 +0,0 @@ -import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -/** - * Static variables with class names of Java classes used in the Clava API. - * - */ -export default class ClavaJavaTypes { - static get ClavaNodes() { - return JavaTypes.getType("pt.up.fe.specs.clava.ClavaNodes"); - } - static get ClavaNode() { - return JavaTypes.getType("pt.up.fe.specs.clava.ClavaNode"); - } - static get CxxJoinPoints() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.CxxJoinpoints"); - } - static get BuiltinKind() { - return JavaTypes.getType("pt.up.fe.specs.clava.ast.type.enums.BuiltinKind"); - } - static get CxxWeaver() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.CxxWeaver"); - } - static get CxxWeaverApi() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.CxxWeaverApi"); - } - static get CxxType() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.joinpoints.types.CxxType"); - } - static get Standard() { - return JavaTypes.getType("pt.up.fe.specs.clava.language.Standard"); - } - static get AstFactory() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.importable.AstFactory"); - } - static get ArgumentsParser() { - return JavaTypes.getType("pt.up.fe.specs.util.parsing.arguments.ArgumentsParser"); - } - static get ClavaWeaverLauncher() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher"); - } - static get MathExtraApiTools() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.MathExtraApiTools"); - } - static get HighLevelSynthesisAPI() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.hls.HighLevelSynthesisAPI"); - } - static get MemoiReport() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.memoi.MemoiReport"); - } - static get MemoiReportsMap() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.memoi.MemoiReportsMap"); - } - static get MemoiCodeGen() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.memoi.MemoiCodeGen"); - } - static get ClavaPetit() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.util.ClavaPetit"); - } - static get ClavaPlatforms() { - return JavaTypes.getType("pt.up.fe.specs.clava.weaver.importable.ClavaPlatforms"); - } -} -//# sourceMappingURL=ClavaJavaTypes.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/ClavaJoinPoints.js b/ClavaLaraApi/src-lara/clava/clava/ClavaJoinPoints.js deleted file mode 100644 index 1af07fc196..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/ClavaJoinPoints.js +++ /dev/null @@ -1,507 +0,0 @@ -import { unwrapJoinPoint, wrapJoinPoint, } from "@specs-feup/lara/api/LaraJoinPoint.js"; -import { arrayFromArgs, flattenArgsArray, } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import * as Joinpoints from "../Joinpoints.js"; -import Clava from "./Clava.js"; -import ClavaJavaTypes from "./ClavaJavaTypes.js"; -/** - * Utility methods related with the creation of new join points. - * - */ -export default class ClavaJoinPoints { - static toJoinPoint(node) { - return wrapJoinPoint(ClavaJavaTypes.CxxJoinPoints.createFromLara(node)); - } - /** - * @returns True, if the two AST nodes are equal (internal representation. Not actual Joinpoint types), in the sense that the underlying AST nodes are also equal, according to their .equals() method (might return true for different AST nodes). - * @internal - * @deprecated Internal representations of join points should not be exposed to the public API. - */ - static equals(jp1, jp2) { - return jp1.equals(jp2); - } - static builtinType(code) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.builtinType(code)); - } - static pointerFromBuiltin(code) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.pointerTypeFromBuiltin(code)); - } - static pointer($type) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.pointerType(unwrapJoinPoint($type))); - } - /** - * Builds an array type of constant dimensions. - * - * @param type - Represents the inner type of the array. If passed a string then it will be converted to a literal type. - * @param dims - Represents the dimensions of the array. - **/ - static constArrayType(type, ...dims) { - if (!Array.isArray(dims)) { - dims = arrayFromArgs(dims); - } - if (typeof type === "string") { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.constArrayType(type, Clava.getStandard(), dims)); - } - else if (type instanceof Joinpoints.Type) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.constArrayType(type.node, Clava.getStandard(), dims)); - } - else { - throw 'ClavaJoinPoints.constArrayType: illegal argument "type", needs to be either a string or a type join point'; - } - } - static variableArrayType($type, $sizeExpr) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.variableArrayType(unwrapJoinPoint($type), unwrapJoinPoint($sizeExpr))); - } - static incompleteArrayType($type) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.incompleteArrayType(unwrapJoinPoint($type))); - } - static exprLiteral(code, type) { - if (type === undefined) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.exprLiteral(code)); - } - if (typeof type === "string") { - type = this.builtinType(type); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.exprLiteral(code, unwrapJoinPoint(type))); - } - /** - * - * @param type - The type of the constructed object - * @param constructorArguments - Arguments passed to the constructor function - * - */ - static cxxConstructExpr(type, ...constructorArguments) { - const processedArguments = constructorArguments.map((arg) => { - if (typeof arg === "string") { - return this.exprLiteral(arg); - } - return arg; - }); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.cxxConstructExpr(unwrapJoinPoint(type), unwrapJoinPoint(processedArguments))); - } - static varDecl(varName, init) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.varDecl(varName, unwrapJoinPoint(init))); - } - static varDeclNoInit(varName, type) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.varDeclNoInit(varName, unwrapJoinPoint(type))); - } - /** - * Creates a new literal join point 'type'. - * - * @param typeString - The literal code of the type - */ - static typeLiteral(typeString) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.typeLiteral(typeString)); - } - /** - * Creates a new join point 'file'. - * - * @param filename - Name of the source file. If filename represents a path to an already existing file, literally adds the contents of the file to the join point. - * @param path - The path of the new file, relative to the output folder. Absolute paths are not allowed. This path will be required when including the file (e.g., #include "/") - */ - static file(filename, path = "") { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.file(unwrapJoinPoint(filename), path)); - } - /** - * @param filename - Name of the source file. - * @param source - The contents of the source file. - * @param path - The path of the new file, relative to the output folder. Absolute paths are not allowed. This path will be required when including the file (e.g., #include "/") - */ - static fileWithSource(filename, source, path = "") { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.file(filename, source, path)); - } - /** - * Creates a new literal join point 'stmt'. - * - * @param stmtString - The literal code of the statement. - */ - static stmtLiteral(stmtString) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.stmtLiteral(stmtString)); - } - static emptyStmt() { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.emptyStmt()); - } - /** - * Creates a new join point 'call'. - * - * @param $function - The function for which the call will refer to. - * @param callArgs - The arguments of the function. - */ - static call($function, ...callArgs) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.callFromFunction(unwrapJoinPoint($function), unwrapJoinPoint(flattenArgsArray(callArgs)))); - } - /** - * Creates a new join point 'call'. - * - * @param functionName - The name of the function to call. - * @param $returnType - The return type of the function. - * @param callArgs - The arguments of the function. - */ - static callFromName(functionName, $returnType, ...callArgs) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.call(functionName, unwrapJoinPoint($returnType), flattenArgsArray(callArgs).map(unwrapJoinPoint))); - } - /** - * Creates a new join point 'switch' - * - */ - static switchStmt($conditionExpr, ...cases) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.switchStmt(unwrapJoinPoint($conditionExpr), unwrapJoinPoint(flattenArgsArray(cases)))); - } - static omp(directiveName) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.omp(directiveName)); - } - static scope(...$jps) { - $jps = flattenArgsArray($jps); - if ($jps.length === 0) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.scope()); - } - const $stmts = $jps.map(($stmt) => { - const $normalizedStmt = $stmt.stmt; - if ($normalizedStmt === undefined) { - throw new Error(`Could not convert ${$stmt.joinPointType} to a statement, and a scope only accepts statements`); - } - return $normalizedStmt; - }); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.scope(unwrapJoinPoint($stmts))); - } - static varRef(decl, $type) { - if (typeof decl === "string") { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.varref(decl, unwrapJoinPoint($type))); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.varref(unwrapJoinPoint(decl))); - } - /** - * @param declName - The name of the varref. - * @deprecated use ClavaJoinPoints.varRef() instead - */ - static varRefFromDecl($namedDecl) { - return ClavaJoinPoints.varRef($namedDecl); - } - /** - * @param $expr - An expression to return. - */ - static returnStmt($expr) { - if ($expr === undefined) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.returnStmt()); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.returnStmt(unwrapJoinPoint($expr))); - } - /** - * Creates a new join point 'functionType'. - * - * @param $returnType - The return type of the function type. - * @param argTypes - The types of the arguments of the function type. - */ - static functionType($returnType, ...argTypes) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.functionType(unwrapJoinPoint($returnType), unwrapJoinPoint(flattenArgsArray(argTypes)))); - } - /** - * Creates a new join point 'function'. - * - * @param functionName - The name of the function. - * @param $functionType - The type of the function. - */ - static functionDeclFromType(functionName, $functionType) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.functionDeclFromType(functionName, unwrapJoinPoint($functionType))); - } - /** - * Creates a new join point 'function'. - * // TODO update docs - * - * @param functionName - The name of the function. - * @param $returnType - The return type of the function - * @param params - The parameters of the function. - */ - static functionDecl(functionName, $returnType, ...params) { - const $paramVarDecls = flattenArgsArray(params); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.functionDecl(functionName, unwrapJoinPoint($returnType), unwrapJoinPoint($paramVarDecls))); - } - static assign($leftHand, $rightHand) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.assignment(unwrapJoinPoint($leftHand), unwrapJoinPoint($rightHand))); - } - static compoundAssign(op, $leftHand, $rightHand) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.compoundAssignment(op, unwrapJoinPoint($leftHand), unwrapJoinPoint($rightHand))); - } - /** - * Creates a new join point 'if'. - * - * @param $condition - The condition of the if statement. If a string, it is converted to a literal expression. - * @param $then - The body of the if - * @param $else - The body of the else - * - */ - static ifStmt($condition, $then, $else) { - if (typeof $condition === "string") { - $condition = ClavaJoinPoints.exprLiteral($condition); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.ifStmt(unwrapJoinPoint($condition), unwrapJoinPoint($then), unwrapJoinPoint($else))); - } - /** - * Creates a new join point 'binaryOp'. - * - * @param op - The binary operator kind. - * @param $left - The left hand of the binary operator. If a string, it is converted to a literal expression. - * @param $right - The right hand of the binary operator. If a string, it is converted to a literal expression. - * @param $type - The return type of the operator. If a string, it is converted to a literal type. - */ - static binaryOp(op, $left, $right, $type = "int") { - if (typeof $left === "string") { - $left = ClavaJoinPoints.exprLiteral($left); - } - if (typeof $right === "string") { - $right = ClavaJoinPoints.exprLiteral($right); - } - if (typeof $type === "string") { - $type = ClavaJoinPoints.typeLiteral($type); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.binaryOp(op, unwrapJoinPoint($left), unwrapJoinPoint($right), unwrapJoinPoint($type))); - } - static unaryOp(op, $expr, $type) { - if (typeof $expr === "string") { - $expr = ClavaJoinPoints.exprLiteral($expr); - } - if (typeof $type === "string") { - $type = ClavaJoinPoints.typeLiteral($type); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.unaryOp(op, unwrapJoinPoint($expr), unwrapJoinPoint($type))); - } - /** - * Creates a new join point 'ternaryOp' - * - * @param $cond - The condition of the operator - * @param $trueExpr - The result when $cond evaluates to true - * @param $falseExpr - The result when $cond evaluates to false - * @param $type - The type of the operation - * @returns The newly created join point - */ - static ternaryOp($cond, $trueExpr, $falseExpr, $type) { - if (typeof $cond === "string") { - $cond = ClavaJoinPoints.exprLiteral($cond); - } - if (typeof $trueExpr === "string") { - $trueExpr = ClavaJoinPoints.exprLiteral($trueExpr); - } - if (typeof $falseExpr === "string") { - $falseExpr = ClavaJoinPoints.exprLiteral($falseExpr); - } - if (typeof $type === "string") { - $type = ClavaJoinPoints.typeLiteral($type); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.ternaryOp(unwrapJoinPoint($cond), unwrapJoinPoint($trueExpr), unwrapJoinPoint($falseExpr), unwrapJoinPoint($type))); - } - /** - * Creates a new join point 'expr' representing a parenthesis expression. - * - * @param $expr - The expression inside the parenthesis. If a string, it is converted to a literal expression. - */ - static parenthesis($expr) { - if (typeof $expr === "string") { - $expr = ClavaJoinPoints.exprLiteral($expr); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.parenthesis(unwrapJoinPoint($expr))); - } - /** - * @param doubleLiteral - The number that will be a double literal. - */ - static doubleLiteral(doubleLiteral) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.doubleLiteral(doubleLiteral)); - } - /** - * @param integerLiteral - The number that will be a integer literal. - */ - static integerLiteral(integerLiteral) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.integerLiteral(integerLiteral)); - } - /** - * @param $typedefDecl - A typedef declaration. - */ - static typedefType($typedefDecl) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.typedefType(unwrapJoinPoint($typedefDecl))); - } - /** - * @param $underlyingType - The underlying type of the typedef. - * @param identifier - The name of the typedef. - */ - static typedefDecl($underlyingType, identifier) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.typedefDecl(unwrapJoinPoint($underlyingType), identifier)); - } - /** - * @param $struct - a struct for the type - * @returns An elaborated type for the given struct. - */ - static structType($struct) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.structType(unwrapJoinPoint($struct))); - } - /** - * Represents an explicit C-style cast (e.g., (double) a). - * - */ - static cStyleCast($type, $expr) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.cStyleCast(unwrapJoinPoint($type), unwrapJoinPoint($expr))); - } - /** - * Creates an empty class with the given name and fields. - * - */ - static classDecl(className, ...fields) { - const flattenedFields = flattenArgsArray(fields); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.classDecl(className, unwrapJoinPoint(flattenedFields))); - } - /** - * Creates an array access from the given base that represents an array, and several subscripts. - * - * Must provide at least one subscript, base expression must be of type array, - * and have a defined number of dimensions. The number of subscripts must be lower or equal - * than the number of dimensions of the array type. - * - */ - static arrayAccess(base, ...subscripts) { - const flattenedSubscripts = flattenArgsArray(subscripts); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.arrayAccess(unwrapJoinPoint(base), unwrapJoinPoint(flattenedSubscripts))); - } - /** - * Creates a initialization list expression (initList) from the values. - * - * Must provide at least one value, the element type of the initList will be the same as the type of the first element. - * - */ - static initList(...values) { - const flattenedValues = flattenArgsArray(values); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.initList(unwrapJoinPoint(flattenedValues))); - } - /** - * Creates a field for a class. - * - */ - static field(fieldName, $fieldType) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.field(fieldName, unwrapJoinPoint($fieldType))); - } - /** - * Creates an access specifier (e.g., public:), for classes. - * - * @param accessSpecifier - One of public, protected, private or none. - */ - static accessSpecifier(accessSpecifier) { - // TODO: Make this an enum - return wrapJoinPoint(ClavaJavaTypes.AstFactory.accessSpecifier(accessSpecifier)); - } - /** - * Creates a new 'for' statement join point. - * - * @param $init - The initialization of the for statement. If a string, it is converted to a literal expression. - * @param $condition - The condition of the for statement. If a string, it is converted to a literal expression. - * @param $inc - The increment of the for statement. If a string, it is converted to a literal expression. - * @param $body - The body of the for statement. - * - */ - static forStmt($init, $condition, $inc, $body) { - if (typeof $init === "string") { - $init = ClavaJoinPoints.stmtLiteral($init); - } - if (typeof $condition === "string") { - $condition = ClavaJoinPoints.stmtLiteral($condition); - } - if (typeof $inc === "string") { - $inc = ClavaJoinPoints.stmtLiteral($inc); - } - if (typeof $body === "string") { - $body = ClavaJoinPoints.stmtLiteral($body); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.forStmt(unwrapJoinPoint($init), unwrapJoinPoint($condition), unwrapJoinPoint($inc), unwrapJoinPoint($body))); - } - static whileStmt($condition, $body) { - if (typeof $condition === "string") { - $condition = ClavaJoinPoints.stmtLiteral($condition); - } - if (typeof $body === "string") { - $body = ClavaJoinPoints.stmtLiteral($body); - } - return wrapJoinPoint(ClavaJavaTypes.AstFactory.whileStmt(unwrapJoinPoint($condition), unwrapJoinPoint($body))); - } - static param(name, $type) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.param(name, unwrapJoinPoint($type))); - } - /** - * Tries to convert the given source into a join point, or throws an exception if it is not possible. - * - * If source is a string: - * - If it can be converted to a builtinType, returns a builtinType; - * - Otherwise, returns a typeLiteral; - * - * If source is a join point: - * - If is a $type, returns itself; - * - If the property .type is not undefined, returns .type; - * - Otherwise, throws an exception; - * - * @param source - - * @returns A join point representing a type. - */ - static type(source) { - if (typeof source === "string") { - if (ClavaJavaTypes.BuiltinKind.isBuiltinKind(source)) { - return ClavaJoinPoints.builtinType(source); - } - return ClavaJoinPoints.typeLiteral(source); - } - if (source instanceof Joinpoints.Type) { - return source; - } - if (source.type !== undefined) { - return source.type; - } - throw new Error("ClavaJoinPoints.type: source is join point but is not a type, nor has a .type property: " + - source.joinPointType); - } - static exprStmt($expr) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.exprStmt(unwrapJoinPoint($expr))); - } - /** - * Creates an empty class with the given name and fields. - * - */ - static declStmt(...decls) { - const flattenedDecls = flattenArgsArray(decls); - return wrapJoinPoint(ClavaJavaTypes.AstFactory.declStmt(unwrapJoinPoint(flattenedDecls))); - } - /** - * Creates a comment join point from the given text. If text has one line, creates an inline comment, otherwise creates a multi-line comment. - * - * @param text - The text of the comment - * @returns A comment join point - * - */ - static comment(text) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.comment(text)); - } - static labelDecl(name) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.labelDecl(name)); - } - static labelStmt(nameOrDecl) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.labelStmt(unwrapJoinPoint(nameOrDecl))); - } - static gotoStmt(labelDecl) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.gotoStmt(unwrapJoinPoint(labelDecl))); - } - static breakStmt() { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.breakStmt()); - } - static defaultStmt() { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.defaultStmt()); - } - /** - * Creates a new literal join point 'decl'. - * - * @param declString - The literal code of the decl. - */ - static declLiteral(declString) { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.declLiteral(declString)); - } - /** - * Creates a new empty join point 'program'. - * - * @param declString - The literal code of the decl. - */ - static program() { - return wrapJoinPoint(ClavaJavaTypes.AstFactory.program()); - } -} -//# sourceMappingURL=ClavaJoinPoints.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/ClavaType.js b/ClavaLaraApi/src-lara/clava/clava/ClavaType.js deleted file mode 100644 index 9d7d462af2..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/ClavaType.js +++ /dev/null @@ -1,104 +0,0 @@ -import { ParenType, PointerType, VariableArrayType, } from "../Joinpoints.js"; -import ClavaJoinPoints from "./ClavaJoinPoints.js"; -import ClavaJavaTypes from "./ClavaJavaTypes.js"; -/** - * Utility methods related with the type join points. - * - */ -export default class ClavaType { - /** - * @param type - The type to visit - * @param exprFunction - A function that receives an $expr join point - * - * @returns The $type after applying the given exprFunction to its $expr nodes. If any of the fields of the type is visited, a copy of the type is returned. - */ - static visitExprInTypeCopy($type, exprFunction) { - if ($type instanceof PointerType) { - const $typeCopy = $type.copy(); - $typeCopy.setPointee(ClavaType.visitExprInTypeCopy($typeCopy.pointee, exprFunction)); - return $typeCopy; - } - if ($type instanceof ParenType) { - const $typeCopy = $type.copy(); - $typeCopy.setDesugar(ClavaType.visitExprInTypeCopy($typeCopy.desugar, exprFunction)); - return $typeCopy; - } - if ($type instanceof VariableArrayType) { - const $typeCopy = $type.copy(); - $typeCopy.setSizeExpr($typeCopy.sizeExpr.copy()); - exprFunction($typeCopy.sizeExpr); - return $typeCopy; - } - return $type; - } - /** - * @param type - A type join point that will be visited looking for $expr join points. Any visited nodes in the type (e.g., desugar) will be copied, so that the returned varrefs can be safely modified. - * @param varrefs - An array (possibly empty) where the $varref join points found in the given type will be stored - * - * @returns A copy of the given $type, to which the varrefs refer to - */ - static getVarrefsInTypeCopy($type, varrefs) { - const exprFunction = function ($expr) { - for (const $varref of $expr.getDescendantsAndSelf("varref")) { - varrefs.push($varref); - } - }; - return ClavaType.visitExprInTypeCopy($type, exprFunction); - } - /** - * Makes sure the given parameter is an expression join point. - * - * @param $expression - If a string, returns a literal expression with the code of the string. Otherwise, returns $expression - * @param isOptional - If false and $expression is undefined, throws an exception. Otherwise, returns undefined if $expression is undefined. - */ - static asExpression($expression, isOptional = false) { - if ($expression === undefined) { - if (isOptional) { - return undefined; - } - else { - throw "ClavaType.asExpression: $expression is undefined. If this is allowed, set 'isOptional' to true."; - } - } - return $expression; - } - /** - * Makes sure the given parameter is a statement join point. - * - * @param code - If a string, returns a literal statement with the code of the string. Otherwise, tries to transform the given node to a $statement - * @param isOptional - If false and code is undefined, throws an exception. Otherwise, returns undefined if code is undefined. - */ - static asStatement(code, isOptional = false) { - if (code === undefined) { - if (isOptional) { - return undefined; - } - else { - throw "ClavaType.asStatement: code is undefined. If this is allowed, set 'isOptional' to true."; - } - } - const newStmtNode = ClavaJavaTypes.ClavaNodes.toStmt(code.node); - return ClavaJoinPoints.toJoinPoint(newStmtNode); - } - /** - * Makes sure the given parameter is a type join point. - * - * @param $type - If a string, returns a literal type with the code of the string. Otherwise, returns $type - * - * @deprecated This method does not do anything, it is only kept for compatibility with the old API - */ - static asType($type) { - return $type; - } - /** - * Makes sure the given parameter is a scope join point. - * - * @param code - If a string, returns a literal statement with the code of the string. Otherwise, returns $statement - */ - static asScope(code) { - const $newStmt = ClavaType.asStatement(code); - const newScopeNode = ClavaJavaTypes.ClavaNodes.toCompoundStmt($newStmt?.node); - return ClavaJoinPoints.toJoinPoint(newScopeNode); - } -} -//# sourceMappingURL=ClavaType.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/Format.js b/ClavaLaraApi/src-lara/clava/clava/Format.js deleted file mode 100644 index 4189487606..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/Format.js +++ /dev/null @@ -1,22 +0,0 @@ -import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -export default class Format { - static addPrefix(str, prefix) { - return str - .split("\n") - .map((line) => prefix + line) - .join("\n"); - } - static addSuffix(str, suffix) { - return str - .split("\n") - .map((line) => line + suffix) - .join("\n"); - } - static addPrefixAndSuffix(str, prefix, suffix) { - return Format.addSuffix(Format.addPrefix(str, prefix), suffix); - } - static escape(str) { - return JavaTypes.SpecsStrings.escapeJson(str); - } -} -//# sourceMappingURL=Format.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/MathExtra.js b/ClavaLaraApi/src-lara/clava/clava/MathExtra.js deleted file mode 100644 index 0e1d2cf86c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/MathExtra.js +++ /dev/null @@ -1,48 +0,0 @@ -import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -import { Expression } from "../Joinpoints.js"; -import ClavaJavaTypes from "./ClavaJavaTypes.js"; -export default class MathExtra { - /** - * Attempts to simplify a mathematical expression. - * - * @param expression - The expression to simplify. - * @param constants - An object that maps variable names to constants. - * - * @returns Simplified expression - */ - static simplify(expression, constants) { - if (expression instanceof Expression) { - expression = expression.code; - } - const map = new JavaTypes.HashMap(); - if (constants !== undefined) { - for (const p in constants) { - map.put(p, constants[p]); - } - } - return ClavaJavaTypes.MathExtraApiTools.simplifyExpression(expression, map); - } - /** - * Attempts to convert a mathematical expression to valid C code (e.g., converts ^ to a call to pow()). - * - * @param expression - The expression to simplify. - * - * @returns Simplified expression as C code - */ - static convertToC(expression) { - return ClavaJavaTypes.MathExtraApiTools.convertToC(expression); - } - /** - * Attempts to simplify a mathematical expression, returning a string that represents C code. - * - * @param expression - The expression to simplify. - * @param constants - An object that maps variable names to constants. - * - * @returns Simplified expression as C code - */ - static simplifyToC(expression, constants) { - const simplifiedExpr = MathExtra.simplify(expression, constants); - return MathExtra.convertToC(simplifiedExpr); - } -} -//# sourceMappingURL=MathExtra.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/Analyser.js b/ClavaLaraApi/src-lara/clava/clava/analysis/Analyser.js deleted file mode 100644 index 5eaa99d4ac..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/Analyser.js +++ /dev/null @@ -1,3 +0,0 @@ -export default class Analyser { -} -//# sourceMappingURL=Analyser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/AnalyserResult.js b/ClavaLaraApi/src-lara/clava/clava/analysis/AnalyserResult.js deleted file mode 100644 index c78f273b9c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/AnalyserResult.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Abstract class created as a model for every result of analyser - */ -export default class AnalyserResult { - node; - fix; - name; - message; - constructor(name, node, message, fix) { - this.name = name; - this.node = node; - this.message = message; - this.fix = fix; - } - getName() { - return this.name; - } - getNode() { - return this.node; - } - getMessage() { - return this.message; - } - performFix() { - this.fix?.execute(); - } -} -//# sourceMappingURL=AnalyserResult.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/CheckBasedAnalyser.js b/ClavaLaraApi/src-lara/clava/clava/analysis/CheckBasedAnalyser.js deleted file mode 100644 index 34f28c86c8..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/CheckBasedAnalyser.js +++ /dev/null @@ -1,51 +0,0 @@ -import Analyser from "./Analyser.js"; -import ResultFormatManager from "./ResultFormatManager.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -/** - * Analyser that scan code to detect unsafe functions - */ -export default class CheckBasedAnalyser extends Analyser { - checkers = []; - resultFormatManager = new ResultFormatManager(); - fixFlag = false; - unsafeCounter = 0; - warningCounter = 0; - addChecker(checker) { - this.checkers.push(checker); - } - enableFixing() { - this.fixFlag = true; - } - disableFixing() { - this.fixFlag = false; - } - /** - * Check file for unsafe functions, each one of them being specified by a checker - * Analyser based on a list of checkers, each one of them is designed to spot one type of function. - * The analysis is performed node by node. - * - * @param $startNode - - * @returns fileResult - */ - analyse($startNode = Query.root()) { - const checkResultList = []; - for (const a of Query.searchFrom($startNode)) { - const $jp = a; - for (const checker of this.checkers) { - const checkResult = checker.check($jp); - if (checkResult === undefined) { - continue; - } - checkResultList.push(checkResult); - } - } - if (this.fixFlag) { - checkResultList.forEach((checkResult) => { - checkResult.performFix(); - }); - } - this.resultFormatManager.setAnalyserResultList(checkResultList); - return this.resultFormatManager.formatResultList($startNode); - } -} -//# sourceMappingURL=CheckBasedAnalyser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/CheckResult.js b/ClavaLaraApi/src-lara/clava/clava/analysis/CheckResult.js deleted file mode 100644 index b53ad7bbfa..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/CheckResult.js +++ /dev/null @@ -1,4 +0,0 @@ -import AnalyserResult from "./AnalyserResult.js"; -export default class CheckResult extends AnalyserResult { -} -//# sourceMappingURL=CheckResult.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/Checker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/Checker.js deleted file mode 100644 index 18b85132e0..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/Checker.js +++ /dev/null @@ -1,10 +0,0 @@ -export default class Checker { - name; - constructor(name) { - this.name = name; - } - getName() { - return this.name; - } -} -//# sourceMappingURL=Checker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/Fix.js b/ClavaLaraApi/src-lara/clava/clava/analysis/Fix.js deleted file mode 100644 index c780e18983..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/Fix.js +++ /dev/null @@ -1,15 +0,0 @@ -export default class Fix { - node; - fixAction; - constructor(node, fixAction) { - this.node = node; - this.fixAction = fixAction; - } - getNode() { - return this.node; - } - execute() { - this.fixAction(this.node); - } -} -//# sourceMappingURL=Fix.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/MessageGenerator.js b/ClavaLaraApi/src-lara/clava/clava/analysis/MessageGenerator.js deleted file mode 100644 index a9a070713d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/MessageGenerator.js +++ /dev/null @@ -1,55 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Clava from "../Clava.js"; -// Class sorting resultLists and generating an analysis report -export default class MessageGenerator { - globalFileResultList = {}; - printMessage; - writeFile; - constructor(printMessage = true, writeFile = false) { - this.printMessage = printMessage; - this.writeFile = writeFile; - } - enableFileOutput() { - this.writeFile = true; - } - append(resultList) { - if (resultList === undefined) { - return; - } - const fileName = resultList.fileName; - let fileResultList = this.globalFileResultList[fileName]; - if (fileResultList === undefined) { - fileResultList = []; - this.globalFileResultList[fileName] = fileResultList; - } - for (const result of resultList.list) { - fileResultList.push(result); - } - } - generateReport() { - if (this.globalFileResultList === undefined) { - return; - } - const allMessages = {}; - for (const fileName in this.globalFileResultList) { - const messages = []; - for (const result of this.globalFileResultList[fileName]) { - messages.push(fileName + "/l." + result.getNode().line + ": " + result.getMessage()); - } - if (this.writeFile || this.printMessage) { - const message = messages.join("\n"); - if (this.printMessage) { - console.log(message); - } - if (this.writeFile) { - const analysisFileName = Io.getPath(Clava.getData().getContextFolder(), "AnalysisReports/analysis_" + fileName + "_report.txt"); - Io.writeFile(analysisFileName, message); - } - } - // Store messages of file - allMessages[fileName] = messages; - } - return allMessages; - } -} -//# sourceMappingURL=MessageGenerator.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/ResultFormatManager.js b/ClavaLaraApi/src-lara/clava/clava/analysis/ResultFormatManager.js deleted file mode 100644 index 7f3d7bf7c2..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/ResultFormatManager.js +++ /dev/null @@ -1,30 +0,0 @@ -import ResultList from "./ResultList.js"; -/** - * Class to format the results from the analyser into a resultList - */ -export default class ResultFormatManager { - analyserResultList = []; - /** - * Create a new ResultList object with the filename - * - * @param $startNode - - * @returns resultList - */ - formatResultList($startNode) { - if (Object.entries(this.analyserResultList).length === 0) { - return; - } - const resultList = new ResultList($startNode.name); - for (const analyserResult of this.analyserResultList) { - if (analyserResult.getName() === undefined) { - continue; - } - resultList.append(analyserResult); - } - return resultList; - } - setAnalyserResultList(analyserResultList) { - this.analyserResultList = analyserResultList; - } -} -//# sourceMappingURL=ResultFormatManager.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/ResultList.js b/ClavaLaraApi/src-lara/clava/clava/analysis/ResultList.js deleted file mode 100644 index 603610ca7e..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/ResultList.js +++ /dev/null @@ -1,11 +0,0 @@ -export default class ResultList { - fileName; - list = []; - constructor(fileName) { - this.fileName = fileName; - } - append(result) { - this.list.push(result); - } -} -//# sourceMappingURL=ResultList.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsAnalyser.js b/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsAnalyser.js deleted file mode 100644 index fdce709965..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsAnalyser.js +++ /dev/null @@ -1,73 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { ArrayAccess, ArrayType, FunctionJp, Vardecl, } from "../../../Joinpoints.js"; -import Analyser from "../Analyser.js"; -import ResultFormatManager from "../ResultFormatManager.js"; -import BoundsResult from "./BoundsResult.js"; -/** - * Analyser that scan code to detect unsafe array accesses - */ -export default class BoundsAnalyser extends Analyser { - resultFormatManager = new ResultFormatManager(); - /** - * Check file for illegal access of an array with an invalid index - * @param $startNode - - * @returns fileResult - */ - analyse($startNode = Query.root()) { - let boundsResultList = []; - for (const $node of Query.searchFrom($startNode)) { - if (!($node instanceof FunctionJp)) { - continue; - } - for (const $child of $node.descendants) { - if ($child instanceof Vardecl && $child.type instanceof ArrayType) { - const lengths = $child.type.arrayDims; - if ($child.hasInit) { - boundsResultList.push(new BoundsResult("Unsafe array access", $child, " The index used to access the array is not valid (CWE-119). Please check the length of the array accessed.\n\n", $node.name, true, false, lengths)); - continue; - } - boundsResultList.push(new BoundsResult("Unsafe array access", $child, " The array being accessed has not been initialized (CWE-457).\n\n", $node.name, false, false, lengths)); - continue; - } - if ($child instanceof ArrayAccess) { - const arrayName = $child.arrayVar.code; - for (const result of boundsResultList) { - if (result.arrayName === arrayName) { - // list of indexes in square brackets - const indexes = $child.code.match(/\[[0-9]+\]/g); - if (indexes == null) { - continue; - } - for (let i = 0; i < indexes.length; i++) { - if (indexes[i].length > 1) { - // formats list of indexes - indexes.forEach((index) => index.substring(1, index.length - 1)); - } - if (result.initializedFlag === false) { - result.unsafeAccessFlag = true; - result.line = $child.line; - continue; - } - if (Number(indexes[i]) > result.lengths[i] - 1 || - Number(indexes[i]) < 0) { - // access out of bounds - result.unsafeAccessFlag = true; - result.line = $child.line; - continue; - } - } - } - } - } - } - } - boundsResultList = boundsResultList.filter((result) => result.unsafeAccessFlag === true); - this.resultFormatManager.setAnalyserResultList(boundsResultList); - const fileResult = this.resultFormatManager.formatResultList($startNode); - if (fileResult === undefined) { - return; - } - return fileResult; - } -} -//# sourceMappingURL=BoundsAnalyser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsResult.js b/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsResult.js deleted file mode 100644 index 90ac9e652d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/BoundsResult.js +++ /dev/null @@ -1,18 +0,0 @@ -import AnalyserResult from "../AnalyserResult.js"; -export default class BoundsResult extends AnalyserResult { - arrayName; - scopeName; - initializedFlag; - unsafeAccessFlag; - lengths; - line = undefined; - constructor(name, node, message, scopeName, initializedFlag, unsafeAccessFlag, lengths, fix) { - super(name, node, message, fix); - this.arrayName = node.name; - this.scopeName = scopeName; - this.initializedFlag = initializedFlag; - this.unsafeAccessFlag = unsafeAccessFlag; - this.lengths = lengths; - } -} -//# sourceMappingURL=BoundsResult.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeAnalyser.js b/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeAnalyser.js deleted file mode 100644 index 66aeb378f8..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeAnalyser.js +++ /dev/null @@ -1,74 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BinaryOp, Call, FunctionJp, Vardecl, } from "../../../Joinpoints.js"; -import Analyser from "../Analyser.js"; -import ResultFormatManager from "../ResultFormatManager.js"; -import DoubleFreeResult from "./DoubleFreeResult.js"; -/** - * Analyser that scan scopes to check double-freed or unfreed memory - */ -export default class DoubleFreeAnalyser extends Analyser { - resultFormatManager = new ResultFormatManager(); - static isDynamicAlloc($node) { - if ($node.code.match(/.*malloc|calloc|realloc.*/)) { - return 1; - } - return 0; - } - /** - * Check file for pointers not being freed or being freed two times in the same scope - * @param $startNode - - * @returns fileResult - */ - analyse($startNode) { - let doubleFreeResultList = []; - if ($startNode === undefined) { - $startNode = Query.root(); - } - for (const $node of Query.searchFrom($startNode)) { - if (!($node instanceof FunctionJp)) { - continue; - } - for (const $child of $node.descendants) { - //Check for dynamic pointer declaration - if (($child instanceof Vardecl || $child instanceof BinaryOp) && - DoubleFreeAnalyser.isDynamicAlloc($child)) { - const ptrName = $child instanceof Vardecl ? $child.name : $child.left.code; - for (const $grandChild of $child.descendants) { - if ($grandChild instanceof Call && - DoubleFreeAnalyser.isDynamicAlloc($grandChild)) { - const message = " Unfreed pointer in this scope. This can lead to a memory leak and a potential vunerability (CWE-401)." + - " Make sure it is freed somewhere in your program.\n\n"; - doubleFreeResultList.push(new DoubleFreeResult("Unfreed array", $child, message, ptrName, $node.name)); - } - } - } - if ($child instanceof Call && $child.name === "free") { - for (const result of doubleFreeResultList) { - if ($child.args[0].code === result.ptrName && - $node.name === result.scopeName) { - if (result.freedFlag === 0) { - result.freedFlag = 1; - result.message = ""; - } - else if (result.freedFlag === 1) { - result.freedFlag = -1; - result.name = "Double-freed array"; - result.message = - " Double-freed pointer in this scope. This could lead to a security vulnerability (CWE-415). Remove one of the calls to free().\n\n"; - } - } - } - } - } - } - // We have now a list of checker's name each leading to a list of CheckResult - doubleFreeResultList = doubleFreeResultList.filter((result) => result.freedFlag === 0); - this.resultFormatManager.setAnalyserResultList(doubleFreeResultList); - const fileResult = this.resultFormatManager.formatResultList($startNode); - if (fileResult === undefined) { - return; - } - return fileResult; - } -} -//# sourceMappingURL=DoubleFreeAnalyser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeResult.js b/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeResult.js deleted file mode 100644 index 8e29ab6f21..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/analysers/DoubleFreeResult.js +++ /dev/null @@ -1,12 +0,0 @@ -import AnalyserResult from "../AnalyserResult.js"; -export default class DoubleFreeResult extends AnalyserResult { - ptrName; - scopeName; - freedFlag = 0; - constructor(name, node, message, ptrName, scopeName, fix) { - super(name, node, message, fix); - this.ptrName = ptrName; - this.scopeName = scopeName; - } -} -//# sourceMappingURL=DoubleFreeResult.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChgrpChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChgrpChecker.js deleted file mode 100644 index 497a7af34c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChgrpChecker.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of chgrp functions - */ -export default class ChgrpChecker extends Checker { - advice = " This function uses paths to files, if an attacker can modify or move these files " + - " he can redirect the execution flow or create a race condition. Consider using fchgrp() instead (CWE-362).\n\n"; - constructor() { - super("chgrp"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "chgrp") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=ChgrpChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChmodChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChmodChecker.js deleted file mode 100644 index 81bdd9b2ca..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChmodChecker.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of chmod functions - */ -export default class ChmodChecker extends Checker { - advice = " This function uses paths to files, if an attacker can modify or move these files " + - " he can redirect the execution flow or create a race condition. Consider using fchmod() instead (CWE-362).\n\n"; - constructor() { - super("chmod"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "chmod") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=ChmodChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChownChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChownChecker.js deleted file mode 100644 index df2401e716..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ChownChecker.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of chown functions - */ -export default class ChownChecker extends Checker { - advice = " This function uses paths to files, if an attacker can modify or move these files " + - " he can redirect the execution flow or create a race condition. Consider using fchown() instead (CWE-362).\n\n"; - constructor() { - super("chown"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "chown") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=ChownChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/CinChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/CinChecker.js deleted file mode 100644 index 5ae03c55d4..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/CinChecker.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -export default class CinChecker extends Checker { - advice = " Using std::cin with operator>> is risky because there is no verification for buffer overflow. Consider using a safer way to retrieve user input (CWE-20).\n\n"; - constructor() { - super("cin"); - } - check($node) { - if (!($node instanceof Call) || - $node.name !== "operator>>" || - ($node.args[0].code !== "cin" && $node.args[0].code !== "std::cin")) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=CinChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ExecChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ExecChecker.js deleted file mode 100644 index e78f7bc0d1..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ExecChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of exec family functions - */ -export default class ExecChecker extends Checker { - advice = " This function executes another program used as parameter and can allow an attacker to execute his own code. " + - "Be extremely cautious when using this function and check inputs for a better security (CWE-78).\n\n"; - constructor() { - super("exec"); - } - check($node) { - if (!($node instanceof Call) || - !$node.name.match(/execl|execlp|execle|execv|execvp|execvpe/)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=ExecChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FprintfChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FprintfChecker.js deleted file mode 100644 index a06980918b..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FprintfChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of fprintf functions - */ -export default class FprintfChecker extends Checker { - advice = " Variable used as format string can be modified by an attacker.Use a constant format specification instead (CWE-134).\n\n"; - constructor() { - super("fprintf"); - } - check($node) { - if (!($node instanceof Call) || - $node.name !== "fprintf" || - $node.args[1].code.match(/\s*".*"\s*/)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=FprintfChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FscanfChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FscanfChecker.js deleted file mode 100644 index 8cdc28d9f0..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/FscanfChecker.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of fscanf functions - */ -export default class FscanfChecker extends Checker { - advice = " If there is no limit specification in the format specifier an attacker can cause buffer overflows. Use a size limitation in format specification (CWE-120, CWE-20).\n\n"; - constructor() { - super("fscanf"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "fscanf") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=FscanfChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/GetsChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/GetsChecker.js deleted file mode 100644 index a8075d9676..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/GetsChecker.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -import Fix from "../Fix.js"; -/** - * Check for the presence of gets functions - */ -export default class GetsChecker extends Checker { - advice = " Unsafe function gets() can be replaced by safer fgets()(Possible Fix). gets() doesn't check the length of the buffer: risk of buffer overflow (CWE-120, CWE-20).\n\n"; - constructor() { - super("gets"); - } - static fixAction($node) { - const newFunction = `fgets(${$node.args[0].code}, sizeof(${$node.args[0].code}), stdin)`; - $node.replaceWith(newFunction); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "gets") { - return; - } - return new CheckResult(this.name, $node, this.advice, new Fix($node, () => { - GetsChecker.fixAction($node); - })); - } -} -//# sourceMappingURL=GetsChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/LambdaChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/LambdaChecker.js deleted file mode 100644 index e054fe00cc..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/LambdaChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Vardecl } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of lambda objects using capture by reference - */ -export default class LambdaChecker extends Checker { - advice = " A lambda object must not outlive any of its reference captured objects." + - "Make sure that variables contained in the lambda expression will not use an obsolete pointer.(CWE-416).\n\n"; - constructor() { - super("lambda"); - } - check($node) { - if (!$node.code.match(/.*\[&\]\s*\(.*\)\s*\{.*\}.*/) || - !($node instanceof Vardecl)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=LambdaChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/MemcpyChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/MemcpyChecker.js deleted file mode 100644 index a542cbfdf1..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/MemcpyChecker.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of memcpy functions - */ -export default class MemcpyChecker extends Checker { - advice = " memcpy() doesn't check the length of the destination when copying: risk of buffer overflow. " + - "Check if the length of the destination is sufficient (CWE-120).\n\n"; - constructor() { - super("memcpy"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "memcpy") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=MemcpyChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/PrintfChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/PrintfChecker.js deleted file mode 100644 index 16ea32b7f3..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/PrintfChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of printf functions - */ -export default class PrintfChecker extends Checker { - advice = " Variable used as format string can be modified by an attacker. Use a constant format specification instead (CWE-134).\n\n"; - constructor() { - super("printf"); - } - check($node) { - if (!($node instanceof Call) || - $node.name !== "printf" || - $node.args[0].code.match(/\s*".*"\s*/)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=PrintfChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ScanfChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ScanfChecker.js deleted file mode 100644 index d05e6d753a..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/ScanfChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of scanf functions - */ -export default class ScanfChecker extends Checker { - advice = " If there is no limit specification in the format specifier an attacker can cause buffer overflows. Use a size limitation in format specification (CWE-120, CWE-20).\n\n"; - constructor() { - super("scanf"); - } - check($node) { - if (!($node instanceof Call) || - $node.name !== "scanf" || - $node.args[0].code.match(/\s*".*%[0-9]+[a-zA-Z]+.*"\s*/)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=ScanfChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SprintfChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SprintfChecker.js deleted file mode 100644 index d0c844f149..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SprintfChecker.js +++ /dev/null @@ -1,37 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -import Fix from "../Fix.js"; -/** - * Check for the presence of sprintf functions - */ -export default class SprintfChecker extends Checker { - advice = " Unsafe function sprintf() can be replaced by safer snprintf()(Possible Fix). sprintf() doesn't check the length of the buffer: risk of buffer overflow (CWE-120).\n\n"; - constructor() { - super("sprintf"); - } - static fixAction($node) { - let newFunction = `snprintf(${$node.args[0].code}, sizeof(${$node.args[0].code}), ${$node.args[1].code}`; - if ($node.args.length > 2) { - let i; - for (i = 2; i < $node.args.length; i++) { - newFunction += "," + $node.args[i].code; - } - } - newFunction += ")"; - $node.replaceWith(newFunction); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "sprintf") { - return; - } - if (!$node.args[1].code.match(/\s*".*"\s*/)) { - this.advice += - " Variable used as format string can be modified by an attacker. Use a constant format specification instead (CWE-134).\n\n"; - } - return new CheckResult(this.name, $node, this.advice, new Fix($node, () => { - SprintfChecker.fixAction($node); - })); - } -} -//# sourceMappingURL=SprintfChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcatChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcatChecker.js deleted file mode 100644 index 91cfc07333..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcatChecker.js +++ /dev/null @@ -1,26 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -import Fix from "../Fix.js"; -/** - * Check for the presence of strcat functions - */ -export default class StrcatChecker extends Checker { - advice = " Unsafe function strcat() can be replaced by safer strncat()(Possible Fix). Be careful though because strncat() doesn't null-terminate. strcat() doesn't check the length of the buffer: risk of buffer overflow (CWE-120).\n\n"; - constructor() { - super("strcat"); - } - static fixAction($node) { - const newFunction = `strncat(${$node.args[0].code}, ${$node.args[1].code}, sizeof(${$node.args[0].code}))`; - $node.replaceWith(newFunction); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "strcat") { - return; - } - return new CheckResult(this.name, $node, this.advice, new Fix($node, () => { - StrcatChecker.fixAction($node); - })); - } -} -//# sourceMappingURL=StrcatChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcpyChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcpyChecker.js deleted file mode 100644 index a5a9d5aca4..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/StrcpyChecker.js +++ /dev/null @@ -1,33 +0,0 @@ -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -import Fix from "../Fix.js"; -import { Call } from "../../../Joinpoints.js"; -import ClavaJoinPoints from "../../ClavaJoinPoints.js"; -/*Check for the presence of strcpy functions*/ -export default class StrcpyChecker extends Checker { - advice = " Unsafe function strcpy() can be replaced by safer strncpy()(Possible Fix). Be careful though because strncpy() doesn't null-terminate. strcpy() doesn't check the length of the buffer: risk of buffer overflow (CWE-120).\n\n"; - constructor() { - super("strcpy"); - } - static fixAction($jp) { - const newFunction = ClavaJoinPoints.callFromName("strncpy", ClavaJoinPoints.type("char *"), $jp.args[0], $jp.args[1], ClavaJoinPoints.exprLiteral(`sizeof(${$jp.args[0].code})`)); - $jp.replaceWith(newFunction); - } - check(node) { - if (!(node instanceof Call)) { - return; - } - if (node.name !== "strcpy") { - return; - } - return new CheckResult(this.name, node, this.advice, new Fix(node, ($jp) => { - if ($jp instanceof Call) { - StrcpyChecker.fixAction($jp); - } - else { - throw new Error("Invalid joinpoint type"); - } - })); - } -} -//# sourceMappingURL=StrcpyChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SyslogChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SyslogChecker.js deleted file mode 100644 index 5d0a2669a6..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SyslogChecker.js +++ /dev/null @@ -1,21 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of syslog functions - */ -export default class SyslogChecker extends Checker { - advice = " Variable used as format string can be modified by an attacker. Use a constant format specification instead (CWE-134).\n\n"; - constructor() { - super("syslog"); - } - check($node) { - if (!($node instanceof Call) || - $node.name !== "syslog" || - $node.args[1].code.match(/\s*".*"\s*/)) { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=SyslogChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SystemChecker.js b/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SystemChecker.js deleted file mode 100644 index 4f9987fa26..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/analysis/checkers/SystemChecker.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Call } from "../../../Joinpoints.js"; -import Checker from "../Checker.js"; -import CheckResult from "../CheckResult.js"; -/** - * Check for the presence of system functions - */ -export default class SystemChecker extends Checker { - advice = " This function executes the command used as parameter and can allow an attacker to execute his own code. " + - "Be extremely cautious when using this function and check inputs for a better security (CWE-78).\n\n"; - constructor() { - super("system"); - } - check($node) { - if (!($node instanceof Call) || $node.name !== "system") { - return; - } - return new CheckResult(this.name, $node, this.advice); - } -} -//# sourceMappingURL=SystemChecker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/cmake/CMaker.js b/ClavaLaraApi/src-lara/clava/clava/cmake/CMaker.js deleted file mode 100644 index bddc3efee8..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/cmake/CMaker.js +++ /dev/null @@ -1,349 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Platforms from "@specs-feup/lara/api/lara/Platforms.js"; -import { arrayFromArgs, debug, debugObject, } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import ProcessExecutor from "@specs-feup/lara/api/lara/util/ProcessExecutor.js"; -import Clava from "../Clava.js"; -import CMakerSources from "./CMakerSources.js"; -import CMakerUtils from "./CMakerUtils.js"; -import BenchmarkCompilationEngine from "@specs-feup/lara/api/lara/benchmark/BenchmarkCompilationEngine.js"; -/** - * Builds CMake configurations. - * - * @example - * new Cmaker() - * .setMinimumVersion("3.0.2") // Could have a standard minimum version - * .addSources(Io.getPaths(srcFolder, "*.cpp")) - * .addCxxFlags("-O3", "-std=c++11") - * .addLibs("stdc++") - * .addIncludes(srcFolder); - * .setVariable(name, value) - * cmaker.getCMake() - * cmaker.build(Io.getPath(srcFolder, "build")); - */ -export default class CMaker extends BenchmarkCompilationEngine { - static MINIMUM_VERSION = "3.10"; - static EXE_VAR = "EXE_NAME"; - static DEFAULT_BIN_FOLDER = "bin"; - makeCommand = "make"; - generator = undefined; - minimumVersion = CMaker.MINIMUM_VERSION; - cxxFlags = []; - cFlags = []; - libs = []; - sources; - includeFolders = new Set(); - printToConsole = false; - lastMakeOutput = undefined; - compiler = undefined; - customCMakeCode = undefined; - constructor(name = "cmaker-project", disableWeaving = false) { - super(name, disableWeaving); - this.sources = new CMakerSources(this.disableWeaving); - } - /** - * Custom CMake code that will be appended to the end of the CMake file. - * - * @param customCMakeCode - The code to append at the end of the CMake file. - */ - setCustomCMakeCode(customCMakeCode) { - this.customCMakeCode = customCMakeCode; - return this; - } - copy() { - const newCmaker = new CMaker(this.toolName, this.disableWeaving); - newCmaker.makeCommand = this.makeCommand; - newCmaker.generator = this.generator; - newCmaker.minimumVersion = this.minimumVersion; - newCmaker.cxxFlags = this.cxxFlags.slice(); - newCmaker.cFlags = this.cFlags.slice(); - newCmaker.libs = this.libs.slice(); - newCmaker.sources = this.sources.copy(); - newCmaker.includeFolders = structuredClone(this.includeFolders); - newCmaker.printToConsole = this.printToConsole; - newCmaker.lastMakeOutput = this.lastMakeOutput; - newCmaker.compiler = this.compiler; - return newCmaker; - } - /** - * @returns Object that can be used to specify the sources. - */ - getSources() { - return this.sources; - } - /** - * Sets the minimum version of the CMake file. - * - * @param version - String with minimum CMake version - */ - setMinimumVersion(version) { - this.minimumVersion = version; - return this; - } - /** - * Sets the name of the executable. - * - * @param name - String with the name of the executable. - */ - setName(name) { - this.toolName = name; - return this; - } - setCompiler(compiler) { - if (typeof compiler === "string") { - this.compiler = CMakerUtils.getCompiler(compiler); - } - else { - this.compiler = compiler; - } - return this; - } - /** - * Sets if output of external tools (e.g., cmake, make) should appear in the console. By default it is off. - */ - setPrintToolsOutput(printToolsOutput = false) { - this.printToConsole = printToolsOutput; - return this; - } - setGenerator(generator) { - this.generator = generator; - return this; - } - setMakeCommand(makeCommand) { - this.makeCommand = makeCommand; - return this; - } - /** - * Adds a variable number of Strings, one for each flag. - * - */ - addCxxFlags(...args) { - const flags = arrayFromArgs(args); - for (const flag of flags) { - this.cxxFlags.push(flag); - } - return this; - } - /** - * Adds a variable number of Strings, one for each flag. - * - */ - addCFlags(...args) { - const flags = arrayFromArgs(args); - for (const flag of flags) { - this.cFlags.push(flag); - } - return this; - } - addFlags(...args) { - const flags = arrayFromArgs(args); - this.addCFlags(...flags); - this.addCxxFlags(...flags); - return this; - } - /** - * Adds link-time libraries (e.g., m for math.h). - * - * @param arguments - a sequence of String with the name of the link-time libraries, as CMake would accept (e.g., "m"). - */ - addLibs(...args) { - const libs = arrayFromArgs(args); - this.libs.push(...libs); - return this; - } - getMakeOutput() { - if (this.lastMakeOutput === undefined) { - console.log("CMaker.getMakeOutput: there is not make output yet"); - return undefined; - } - return this.lastMakeOutput.getConsoleOutput(); - } - /** - * @param includeFolder - String representing an include folder - */ - addIncludeFolder(includeFolder) { - const parsedFolder = CMakerUtils.parsePath(includeFolder); - this.includeFolders.add(parsedFolder); - return this; - } - addCurrentAst() { - for (const userInclude of Clava.getData().getUserIncludes()) { - console.log("[" + this.toolName + "] Adding include: " + userInclude); - this.addIncludeFolder(userInclude); - } - // Write current version of the files to a temporary folder and add them - const currentAstFolder = Io.getPath(Io.getTempFolder(), "tempfolder_current_ast"); - // Clean folder - Io.deleteFolderContents(currentAstFolder); - // Create and populate source folder - const srcFolder = Io.getPath(currentAstFolder, "src"); - for (const $jp of Clava.getProgram().getDescendants("file")) { - const $file = $jp; - const destFolder = srcFolder; - const filepath = $file.write(destFolder.toString()); - if (!$file.isHeader) { - this.getSources().addSource(filepath); - } - } - // Add src folder as include - this.addIncludeFolder(srcFolder); - return this; - } - /** - * @returns The name of the executable that will be generated - */ - getExecutableName() { - let executable = this.toolName; - if (Platforms.isWindows()) { - executable += ".exe"; - } - return executable; - } - /** - * Builds the program currently defined in the CMaker object. - * - * @param cmakelistsFolder - The folder where the CMakeList files will be written - * @param builderFolder - The folder where the program will be built - * @param cmakeFlags - Additional flags that will be passed to CMake execution - * - * @returns File to the executable compiled by the build. - */ - build(cmakelistsFolder = Io.newRandomFolder(), builderFolder = Io.getPath(cmakelistsFolder, "build"), cmakeFlags) { - // Generate CMakeLists.txt - const cmakeFile = Io.getPath(cmakelistsFolder, "CMakeLists.txt"); - Io.writeFile(cmakeFile, this.getCode()); - const builderFolderpath = Io.mkdir(builderFolder).getAbsolutePath(); - // Execute CMake - let cmakeCmd = [ - "cmake", - `"${cmakeFile.getParentFile().getAbsolutePath()}"`, - ]; - if (cmakeFlags !== undefined) { - cmakeCmd.push(cmakeFlags); - } - if (this.generator !== undefined) { - cmakeCmd.push(`-G`); - cmakeCmd.push(`"${this.generator}"`); - } - if (this.compiler !== undefined) { - cmakeCmd.push(this.compiler.getCommandArgs()); - } - debug(() => `Executing CMake, calling '${cmakeCmd.join(" ")}' at '${builderFolderpath}'`); - const cmakeOutput = new ProcessExecutor(); - cmakeOutput - .setPrintToConsole(this.printToConsole) - .setWorkingDir(builderFolderpath) - .execute(...cmakeCmd); - const consoleOutput = cmakeOutput.getConsoleOutput(); - if (cmakeOutput.getReturnValue() === 0 && consoleOutput != undefined) { - debug("CMake output:"); - debug(consoleOutput); - } - else { - console.log("Cmaker.build: Could not generate makefile\n" + consoleOutput); - return; - } - // Execute make - debug(`Building, calling '${this.makeCommand}' at ' ${builderFolderpath} '`); - this.lastMakeOutput = new ProcessExecutor(); - this.lastMakeOutput - .setPrintToConsole(this.printToConsole) - .setWorkingDir(builderFolderpath) - .execute(this.makeCommand); - debug("Make output:"); - debugObject(this.lastMakeOutput.getConsoleOutput()); - const binPath = Io.getPath(builderFolderpath, CMaker.DEFAULT_BIN_FOLDER); - const executableFile = Io.getPath(binPath, this.getExecutableName()); - if (!Io.isFile(executableFile)) { - console.log(`Cmaker.build: Could not generate executable file '${this.getExecutableName()}', expected to be in the path '${executableFile.getAbsolutePath()}'`); - return; - } - return executableFile; - } - /*** CODE FUNCTIONS ***/ - /** - * @returns The CMake corresponding to the current configuration - */ - getCode() { - let code = ""; - // Minimum version - code += "cmake_minimum_required(VERSION " + this.minimumVersion + ")\n"; - // Project - code += "project(" + this.toolName + ")\n\n"; - // Executable - code += "set (" + CMaker.EXE_VAR + ' "' + this.toolName + '")\n\n'; - // Flags - code += this.getCxxFlagsCode(); - code += this.getCFlagsCode(); - // Directories - code += this.getProjectDirectoriesCode(); - // Sources - code += this.sources.getCode() + "\n\n"; - // Include folders - code += this.getIncludeFoldersCode(); - // Executable - code += "add_executable(${" + CMaker.EXE_VAR + "} "; - code += "${" + this.sources.getSourceVariables().join("} ${") + "}"; - code += ")\n\n"; - // Libs - this.addLibs(...Clava.getProgram().extraLibs); - code += "target_link_libraries(${" + CMaker.EXE_VAR + "} "; - code += '"' + this.libs.join('" "') + '")\n\n'; - // binary directories - code += ` - set_target_properties(\${EXE_NAME} - PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "\${CMAKE_BINARY_DIR}/${CMaker.DEFAULT_BIN_FOLDER}" - LIBRARY_OUTPUT_DIRECTORY "\${CMAKE_BINARY_DIR}/${CMaker.DEFAULT_BIN_FOLDER}" - RUNTIME_OUTPUT_DIRECTORY "\${CMAKE_BINARY_DIR}/${CMaker.DEFAULT_BIN_FOLDER}" - ) - `; - // Custom code - if (this.customCMakeCode !== undefined) { - code += this.customCMakeCode; - } - return code; - } - getProjectDirectoriesCode() { - const subDirs = Clava.getProgram().extraProjects; - return subDirs.reduce((acc, subDir) => { - return acc + `add_subdirectory("${subDir}" "${subDir}/bin")\n`; - }, ""); - } - getCxxFlagsCode() { - if (this.cxxFlags.length === 0) { - return ""; - } - return `set (CMAKE_CXX_FLAGS "\${CMAKE_CXX_FLAGS} ${this.cxxFlags.join(" ")}")\n\n`; - } - getCFlagsCode() { - if (this.cFlags.length === 0) { - return ""; - } - return `set (CMAKE_C_FLAGS "\${CMAKE_C_FLAGS} ${this.cFlags.join(" ")}")\n\n`; - } - getIncludeFoldersCode() { - // Add user includes - const includes = Array.from(this.includeFolders.values()); - // Add external includes if weaving is not disabled - if (!this.disableWeaving) { - this.addExtraIncludes(includes); - } - if (includes.length === 0) { - return ""; - } - return `include_directories("${includes.join('" "')}")\n\n`; - } - addExtraIncludes(includes) { - const extraIncludes = Clava.getProgram().extraIncludes; - for (const extraInclude of extraIncludes) { - if (Io.isFolder(extraInclude)) { - debug(`[CMAKER] Adding external include '${extraInclude}'`); - includes.push(CMakerUtils.parsePath(extraInclude)); - } - else { - console.log(`[CMAKER] Extra include ' ${extraInclude} ' is not a folder`); - } - } - } -} -//# sourceMappingURL=CMaker.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerSources.js b/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerSources.js deleted file mode 100644 index 5f03576444..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerSources.js +++ /dev/null @@ -1,146 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Clava from "../Clava.js"; -import CMakerUtils from "./CMakerUtils.js"; -/** - * Contains CMaker sources - */ -export default class CMakerSources { - untaggedSources = []; - taggedSources = {}; - tags = new Set(); - disableWeaving; - constructor(disableWeaving = false) { - this.disableWeaving = disableWeaving; - } - static VARIABLE_UNTAGGED_SOURCES = "CMAKER_SOURCES"; - static VARIABLE_EXTERNAL_SOURCES = "EXTERNAL_SOURCES"; - /** - * - */ - copy() { - const newCMakerSources = new CMakerSources(); - newCMakerSources.untaggedSources = this.untaggedSources.slice(); - newCMakerSources.taggedSources = structuredClone(this.taggedSources); - newCMakerSources.tags = structuredClone(this.tags); - newCMakerSources.disableWeaving = this.disableWeaving; - return newCMakerSources; - } - /** - * Adds the given sources. - * - * @param paths - Array with paths to sources - */ - addSources(paths) { - for (const path of paths) { - this.addSourcePrivate(this.untaggedSources, path); - } - } - /** - * Add the given sources. - */ - addSource(path) { - this.addSourcePrivate(this.untaggedSources, path); - } - /** - * Adds the given sources associated to a tag. - */ - addTaggedSources(tag, paths) { - // Get current tagged sources - let sources = this.taggedSources[tag]; - // If not defined, initialize it - if (sources === undefined) { - sources = []; - this.taggedSources[tag] = sources; - this.tags.add(tag); - } - for (const path of paths) { - this.addSourcePrivate(sources, path); - } - } - addSourcePrivate(sources, path) { - const parsedPath = CMakerUtils.parsePath(path); - sources.push(`"${parsedPath}"`); - } - /** - * @returns An array with the CMake variables that have source files - */ - getSourceVariables() { - const sources = []; - if (this.untaggedSources.length > 0) { - sources.push(CMakerSources.VARIABLE_UNTAGGED_SOURCES); - } - if (!this.disableWeaving) { - if (Clava.getProgram().extraSources.length > 0) { - sources.push(CMakerSources.VARIABLE_EXTERNAL_SOURCES); - } - } - for (const tag of this.tags.values()) { - sources.push(tag); - } - return sources; - } - parseSourcePath(path) { - return `"${CMakerUtils.parsePath(path)}"`; - } - /** - * @returns String with the CMake code that declares the current sources - */ - getCode() { - let code = ""; - // Add untagged sources - if (this.untaggedSources.length > 0) { - code += this.getCodeSource(CMakerSources.VARIABLE_UNTAGGED_SOURCES, this.untaggedSources); - } - // Add external sources if weaving is not disabled - if (!this.disableWeaving) { - code = this.addExternalSources(code); - } - for (const tag of this.tags.values()) { - const tagCode = this.getCodeSource(tag, this.taggedSources[tag]); - if (code.length !== 0) { - code += "\n"; - } - code += tagCode; - } - return code; - } - addExternalSources(code) { - const extraSources = Clava.getProgram().extraSources; - const extraSourcesArray = []; - for (const extraSource of extraSources) { - debug(`Adding external source '${extraSource}'`); - if (Io.isFile(extraSource)) { - extraSourcesArray.push(this.parseSourcePath(extraSource)); - } - else if (Io.isFolder(extraSource)) { - for (const sourcePath of Io.getPaths(extraSource)) { - extraSourcesArray.push(this.parseSourcePath(sourcePath)); - } - } - else { - console.log(`[CMAKER] Extra source ' ${extraSource} ' does not exist`); - } - } - if (extraSourcesArray.length > 0) { - if (code.length !== 0) { - code += "\n"; - } - code += this.getCodeSource(CMakerSources.VARIABLE_EXTERNAL_SOURCES, extraSourcesArray); - } - return code; - } - /** - * @returns String with the CMake code for a given source name and values - */ - getCodeSource(sourceName, values) { - const prefix = `set (${sourceName} `; - // Build space - let space = ""; - for (let i = 0; i < prefix.length; i++) { - space += " "; - } - return prefix + values.join("\n" + space) + "\n)"; - } -} -//# sourceMappingURL=CMakerSources.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerUtils.js b/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerUtils.js deleted file mode 100644 index f8e19fcc29..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/cmake/CMakerUtils.js +++ /dev/null @@ -1,25 +0,0 @@ -import ToolUtils from "@specs-feup/lara/api/lara/tool/ToolUtils.js"; -import GenericCMakeCompiler from "./compilers/GenericCMakeCompiler.js"; -export default class CMakerUtils extends ToolUtils { - static compilerTable = { - gcc: function () { - return new GenericCMakeCompiler("gcc", "g++"); - }, - clang: function () { - return new GenericCMakeCompiler("clang", "clang++"); - }, - icc: function () { - return new GenericCMakeCompiler("icc", "icpc"); - }, - }; - /** - * Creates a CMakerCompiler object based on a string with the name. - * - * @param compilerName - Name of the compiler. Currently supported names: 'gcc', 'clang', 'icc'. - * - */ - static getCompiler(compilerName) { - return CMakerUtils.compilerTable[compilerName](); - } -} -//# sourceMappingURL=CMakerUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/CMakeCompiler.js b/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/CMakeCompiler.js deleted file mode 100644 index fd9483e08c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/CMakeCompiler.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Interface that provides information about a CMake-supported compiler. - * - */ -export default class CMakeCompiler { - /** - * Generates the compiler-related arguments that are required when calling the CMake command. - */ - getCommandArgs() { - return `-DCMAKE_CXX_COMPILER=${this.getCxxCommand()} -DCMAKE_C_COMPILER=${this.getCCommand()}`; - } -} -//# sourceMappingURL=CMakeCompiler.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/GenericCMakeCompiler.js b/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/GenericCMakeCompiler.js deleted file mode 100644 index ec89ed3378..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/cmake/compilers/GenericCMakeCompiler.js +++ /dev/null @@ -1,21 +0,0 @@ -import CMakeCompiler from "./CMakeCompiler.js"; -/** - * Iterates over a list of values. - * - */ -export default class GenericCMakeCompiler extends CMakeCompiler { - c; - cxx; - constructor(c, cxx) { - super(); - this.c = c; - this.cxx = cxx; - } - getCxxCommand() { - return this.cxx; - } - getCCommand() { - return this.c; - } -} -//# sourceMappingURL=GenericCMakeCompiler.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/DecomposeResult.js b/ClavaLaraApi/src-lara/clava/clava/code/DecomposeResult.js deleted file mode 100644 index e0cf42282f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/DecomposeResult.js +++ /dev/null @@ -1,24 +0,0 @@ -export default class DecomposeResult { - precedingStmts; - $resultExpr; - succeedingStmts; - constructor(precedingStmts, $resultExpr, succeedingStmts = []) { - this.precedingStmts = precedingStmts; - this.$resultExpr = $resultExpr; - this.succeedingStmts = succeedingStmts; - } - /** - * Represents the statements to be placed before the use of the expression - * @deprecated use `precedingStmts` instead - */ - get stmts() { - return this.precedingStmts; - } - toString() { - const precedingCode = this.precedingStmts - .map((stmt) => stmt.code) - .join(" "); - return `${precedingCode} -> ${this.$resultExpr.code}`; - } -} -//# sourceMappingURL=DecomposeResult.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/DoToWhileStmt.js b/ClavaLaraApi/src-lara/clava/clava/code/DoToWhileStmt.js deleted file mode 100644 index 7a006adc5d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/DoToWhileStmt.js +++ /dev/null @@ -1,55 +0,0 @@ -import { Loop } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default function DoToWhileStmt($doStmt, labelSuffix) { - // do statements have an unconditional first iteration - const firstIterStmts = $doStmt.scopeNodes.map(($stmt) => $stmt.copy()); - const firstIterScope = ClavaJoinPoints.scope(...firstIterStmts); - $doStmt.insertBefore(firstIterScope); - // convert continues in first iteration to jumps to beginning of loop - const localContinues = [...findLocalContinue(firstIterScope)]; - if (localContinues.length > 0) { - const $labelDecl = ClavaJoinPoints.labelDecl(`__do_loop_head_${labelSuffix}`); - $doStmt.insertBefore(ClavaJoinPoints.labelStmt($labelDecl)); - for (const $continue of localContinues) { - $continue.replaceWith(ClavaJoinPoints.gotoStmt($labelDecl)); - } - } - // convert breaks in first iteration to jumps to after loop - const localBreaks = [...findLocalBreak(firstIterScope)]; - if (localBreaks.length > 0) { - const $labelDecl = ClavaJoinPoints.labelDecl(`__do_loop_end_${labelSuffix}`); - $doStmt.insertAfter(ClavaJoinPoints.emptyStmt()); - $doStmt.insertAfter(ClavaJoinPoints.labelStmt($labelDecl)); - for (const $break of localBreaks) { - $break.replaceWith(ClavaJoinPoints.gotoStmt($labelDecl)); - } - } - const $while = ClavaJoinPoints.whileStmt($doStmt.cond, $doStmt.body); - $doStmt.replaceWith($while); - return $while; -} -function* findLocalBreak($jp) { - if ($jp.astName === "BreakStmt") { - yield $jp; - return; - } - if ($jp instanceof Loop) { - return; - } - for (const $child of $jp.children) { - yield* findLocalBreak($child); - } -} -function* findLocalContinue($jp) { - if ($jp.astName === "ContinueStmt") { - yield $jp; - return; - } - if ($jp instanceof Loop) { - return; - } - for (const $child of $jp.children) { - yield* findLocalContinue($child); - } -} -//# sourceMappingURL=DoToWhileStmt.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/ForToWhileStmt.js b/ClavaLaraApi/src-lara/clava/clava/code/ForToWhileStmt.js deleted file mode 100644 index e9e01a510e..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/ForToWhileStmt.js +++ /dev/null @@ -1,83 +0,0 @@ -import { EmptyStmt, Loop } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Replaces for loop with an equivalent construct based on a while loop: - * ```c - * for (init; cond; step) { - * //... - * continue; - * //... - * //... - * } - * ``` - * becomes - * ```c - * { - * init; - * while (cond) { - * // ... - * goto __for_loop_step_${step_label_suffix}; - * // ... - * // ... - * __for_loop_step_${step_label_suffix}: - * step; - * } - * } - * ``` - * @param $forStmt - For-loop joinpoint - * @param stepLabelSuffix - Suffix to attach to the for loop step label, added in case there are `continue` statements to account for - * @returns The newly created replacement joinpoint - */ -export default function ForToWhileStmt($forStmt, stepLabelSuffix) { - // replace continues with gotos to the step statement for the new loop body - const localContinues = [...findLocalContinue($forStmt.body)]; - let loopStepStatements; - const initStmt = $forStmt.init ?? ClavaJoinPoints.emptyStmt(); - const condStmt = ($forStmt.cond === undefined || $forStmt.cond instanceof EmptyStmt) - ? ClavaJoinPoints.exprStmt(ClavaJoinPoints.integerLiteral(1)) - : $forStmt.cond; - const stepStmt = $forStmt.step ?? ClavaJoinPoints.emptyStmt(); - const scopeNodes = $forStmt.scopeNodes; - $forStmt.init?.replaceWith(ClavaJoinPoints.emptyStmt()); - $forStmt.cond?.replaceWith(ClavaJoinPoints.emptyStmt()); - $forStmt.step?.replaceWith(ClavaJoinPoints.emptyStmt()); - for (const $node of scopeNodes) { - $node.detach(); - } - if (localContinues.length > 0) { - const $labelDecl = ClavaJoinPoints.labelDecl(`__for_loop_step_${stepLabelSuffix}`); - loopStepStatements = [ClavaJoinPoints.labelStmt($labelDecl), stepStmt]; - for (const $continue of localContinues) { - $continue.replaceWith(ClavaJoinPoints.gotoStmt($labelDecl)); - } - } - else { - loopStepStatements = [stepStmt]; - } - const $scope = ClavaJoinPoints.scope(initStmt, ClavaJoinPoints.whileStmt(condStmt, ClavaJoinPoints.scope(...scopeNodes, ...loopStepStatements))); - $forStmt.replaceWith($scope); - return $scope; -} -/** - * find local continue statements in a loop: that is, recursively traverse the tree and return continue statements, - * while ignoring sub-trees starting from an inner loop - * - * TODO: optimization - ignore sub-trees that will for sure not contain ContinueStmt nodes - * - * @param $jp - - * @returns - */ -function* findLocalContinue($jp) { - if ($jp.astName === "ContinueStmt") { - yield $jp; - return; - } - if ($jp instanceof Loop) { - return; - } - for (const $child of $jp.children) { - yield* findLocalContinue($child); - } -} -; -//# sourceMappingURL=ForToWhileStmt.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/GlobalVariable.js b/ClavaLaraApi/src-lara/clava/clava/code/GlobalVariable.js deleted file mode 100644 index 40538480bc..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/GlobalVariable.js +++ /dev/null @@ -1,36 +0,0 @@ -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Adds and manages global variables. - */ -export default class GlobalVariable { - filesWithGlobal = new Set(); - varName; - $type; - initValue; - constructor(varName, $type, initValue) { - this.varName = varName; - this.$type = $type; - this.initValue = initValue; - } - /** - * @returns A reference to the global variable defined by this object. - */ - getRef($reference) { - // Check file for the reference point - const $file = $reference.getAncestor("file"); - if ($file === undefined) { - console.log(`GlobalVariable.getRef: Could not find the file for the reference point ${$reference.location}`); - } - else { - // Check if file already has this global variable declared - const fileId = $file.jpId; - if (!this.filesWithGlobal.has(fileId)) { - this.filesWithGlobal.add(fileId); - $file.addGlobal(this.varName, this.$type, this.initValue); - } - } - // Create varref - return ClavaJoinPoints.varRef(this.varName, this.$type); - } -} -//# sourceMappingURL=GlobalVariable.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/Inliner.js b/ClavaLaraApi/src-lara/clava/clava/code/Inliner.js deleted file mode 100644 index f72b947877..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/Inliner.js +++ /dev/null @@ -1,481 +0,0 @@ -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BinaryOp, Call, Expression, GotoStmt, Joinpoint, LabelDecl, LabelStmt, ParenExpr, ParenType, PointerType, StorageClass, Vardecl, VariableArrayType, Varref, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default class Inliner { - options; - variableIndex = 0; - labelNumber = 0; - /** - * - * @param options - Object with options. Supported options: 'prefix' (default: "__inline"), the prefix that will be used in the name of variables inserted by the Inliner - */ - constructor(options = { prefix: "__inline" }) { - this.options = options; - } - getInlinedVarName(originalVarName) { - const prefix = this.options["prefix"]; - return `${prefix}_${this.variableIndex}_${originalVarName}`; - } - hasCycle($function, _path = new Set()) { - if (_path.has($function.name)) { - return true; - } - _path.add($function.name); - for (const $jp of $function.getDescendants("exprStmt")) { - const $exprStmt = $jp; - const $expr = $exprStmt.expr; - if (!($expr instanceof BinaryOp && - $expr.isAssignment && - $expr.right instanceof Call) && - !($expr instanceof Call)) { - continue; - } - const $call = $expr instanceof Call ? $expr : $expr.right; - if (!($call instanceof Call) || - ($call instanceof Call && $call.definition == undefined)) { - continue; - } - if (this.hasCycle($call.definition, _path)) { - return true; - } - } - _path.delete($function.name); - return false; - } - inlineFunctionTree($function, _visited = new Set()) { - if ($function === undefined) { - return false; - } - debug("InlineFunctionTree called on " + $function.signature); - if (this.hasCycle($function)) { - return false; - } - if (_visited.has($function.name)) { - return true; - } - _visited.add($function.name); - for (const $jp of $function.getDescendants("exprStmt")) { - const $exprStmt = $jp; - const inlineData = this.checkInline($exprStmt); - if (inlineData === undefined) { - continue; - } - const $callee = inlineData.$call.definition; - this.inlineFunctionTree($callee, _visited); - this.inlinePrivate($exprStmt, inlineData); - } - return true; - } - getInitStmts($varDecl, $expr) { - const $assign = ClavaJoinPoints.assign(ClavaJoinPoints.varRef($varDecl), $expr); - return [ClavaJoinPoints.exprStmt($assign)]; - } - /** - * - * @param $exprStmt - - * @returns An object with the properties below or undefined if this exprStmt cannot be inlined. - * Only exprStmt that are an isolated call, or that are an assignment with a single call - * in the right-hand side can be inlined. - * - * - type: a string with either the value 'call' or 'assign', indicating the type of inlining - * that can be applied to the given exprStmt. - * - $target: if the type is 'assign', contains the left-hand side of the assignment. Otherwise, is undefined. - * - $call: the call to be inlined - * - */ - extractInlineData($exprStmt) { - if ($exprStmt.expr instanceof BinaryOp && - $exprStmt.expr.isAssignment && - $exprStmt.expr.right instanceof Call) { - return { - type: "assignment", - $target: $exprStmt.expr.left, - $call: $exprStmt.expr.right, - }; - } - if ($exprStmt.expr instanceof Call) { - return { - type: "call", - $target: undefined, - $call: $exprStmt.expr, - }; - } - return undefined; - } - /** - * Check if the given $exprStmt can be inlined or not. If it can, returns an object with information important for inlining, - * otherwise returns undefined. - * - * A call can be inline if the following rules apply: - * - The exprStmt is an isolated call, or an assignment with a single call in the right-hand side. - * - The call has a definition/implementation available. - * - The call is not a function that is part of the system headers. - * - * @param $exprStmt - - * @returns An object with the properties below or undefined if this exprStmt cannot be inlined. - * - * - type: a string with either the value 'call' or 'assign', indicating the type of inlining - * that can be applied to the given exprStmt. - * - $target: if the type is 'assign', contains the left-hand side of the assignment. Otherwise, is undefined. - * - $call: the call to be inlined - * - */ - checkInline($exprStmt) { - // Extract inline information - const inlineData = this.extractInlineData($exprStmt); - if (inlineData === undefined) { - return undefined; - } - // Check if call has an implementation - if (!inlineData.$call.function.isImplementation) { - debug(`Inliner: call '${inlineData.$call.toString()}' not inlined because implementation was not found`); - return undefined; - } - // Ignore functions that are part of the system headers - if (inlineData.$call.function.isInSystemHeader) { - debug(`Inliner: call '${inlineData.$call.toString()}' not inlined function belongs to a system header`); - return undefined; - } - return inlineData; - } - inline($exprStmt) { - const inlineData = this.checkInline($exprStmt); - if (inlineData === undefined) { - return false; - } - this.inlinePrivate($exprStmt, inlineData); - return true; - } - inlinePrivate($exprStmt, inlineData) { - debug("InlinePrivate called on " + $exprStmt.code + "@" + $exprStmt.location); - const $target = inlineData.$target; - const $call = inlineData.$call; - let args = $call.args; - if (!Array.isArray(args)) { - args = [args]; - } - const $function = $call.function; - if ($function.getDescendants("returnStmt").length > 1) { - throw new Error(`'${$function.name}' cannot be inlined: more than one return statement`); - } - const params = $function.params; - const newVariableMap = new Map(); - const paramDeclStmts = []; - // TODO: args can be greater than params, if varargs. How to deal with this? - for (let i = 0; i < params.length; i++) { - const $arg = args[i]; - const $param = params[i]; - // Arrays cannot be assigned - // If param is array or pointer, there is no need to add declaration, - // simply rename the param to the name of the arg - //if ($param.type.isArray || $param.type.isPointer) { - if ($param.type.isArray) { - newVariableMap.set($param.name, $arg); - } - else { - const newName = this.getInlinedVarName($param.name); - const $varDecl = ClavaJoinPoints.varDeclNoInit(newName, $param.type); - const $varDeclStmt = ClavaJoinPoints.declStmt($varDecl); - const $initStmts = this.getInitStmts($varDecl, $arg); - newVariableMap.set($param.name, $varDecl); - paramDeclStmts.push($varDeclStmt, ...$initStmts); - } - } - for (const jp of $function.body.getDescendants("declStmt")) { - const stmt = jp; - const $varDecl = stmt.decls[0]; - if (!($varDecl instanceof Vardecl)) { - continue; - } - const newName = this.getInlinedVarName($varDecl.name); - const $newDecl = ClavaJoinPoints.varDeclNoInit(newName, $varDecl.type); - newVariableMap.set($varDecl.name, $newDecl); - } - const $newNodes = $function.body.copy(); - this.processBodyToInline($newNodes, newVariableMap, $call); - // Remove/replace return statements - if ($exprStmt.expr instanceof BinaryOp && $exprStmt.expr.isAssignment) { - for (const $jp of $newNodes.getDescendants("returnStmt")) { - const $returnStmt = $jp; - if ($target === undefined) { - throw new Error("Expected $target to be defined when exprStmt is an assignment"); - } - else if ($returnStmt.returnExpr !== null && - $returnStmt.returnExpr !== undefined) { - $returnStmt.replaceWith(ClavaJoinPoints.exprStmt(ClavaJoinPoints.assign($target, $returnStmt.returnExpr))); - } - else { - $returnStmt.detach(); - } - } - } - else if ($exprStmt.expr instanceof Call) { - for (const $returnStmt of $newNodes.getDescendants("returnStmt")) { - // Replace the return with a nop (i.e. empty statement), in case there is a label before. Otherwise, just remove return - const left = $returnStmt.siblingsLeft; - if (left.length > 0 && left[left.length - 1] instanceof LabelStmt) { - $returnStmt.replaceWith(ClavaJoinPoints.emptyStmt()); - } - else { - $returnStmt.detach(); - } - } - } - // For any calls inside $newNodes, add forward declarations before the function, if they have definition - // TODO: this should be done for calls of functions that are on this file. For other files, the corresponding include - // should be added - const $parentFunction = $call.getAncestor("function"); - const addedDeclarations = new Set(); - for (const $newCall of Query.searchFrom($newNodes, Call)) { - // Ignore functions that are part of the system headers - if ($newCall.function.isInSystemHeader) { - continue; - } - if (addedDeclarations.has($newCall.function.id)) { - continue; - } - addedDeclarations.add($newCall.function.id); - const $newFunctionDecl = ClavaJoinPoints.functionDeclFromType($newCall.function.name, $newCall.function.functionType); - $parentFunction.insertBefore($newFunctionDecl); - } - // Let the function body be on its own scope - // If the function uses local labels they must appear at the beginning of the scope - const inlinedScope = paramDeclStmts.length === 0 - ? $newNodes - : ClavaJoinPoints.scope(...paramDeclStmts, $newNodes); - $exprStmt.replaceWith(inlinedScope); - this.variableIndex++; - } - processBodyToInline($newNodes, newVariableMap, $call) { - this.updateVarDecls($newNodes, newVariableMap); - this.updateVarrefs($newNodes, newVariableMap, $call); - this.updateVarrefsInTypes($newNodes, newVariableMap, $call); - this.renameLabels(); - } - /** - * Labels need to be renamed, to avoid duplicated labels. - */ - renameLabels() { - // Maps label names to new LabelDecl - const newLabels = {}; - // Visit all gotoStmt and labelStmt - for (const jp of Query.search(Joinpoint, { - self: ($jp) => $jp instanceof GotoStmt || $jp instanceof LabelStmt, - })) { - const $jp = jp; - // Get original label - const $labelDecl = $jp instanceof GotoStmt ? $jp.label : $jp.decl; - // Get new label, or create if it does not exist yet - let $newLabelDecl = newLabels[$labelDecl.name]; - if ($newLabelDecl === undefined) { - const newLabelName = this.createNewLabelName($labelDecl.name); - $newLabelDecl = ClavaJoinPoints.labelDecl(newLabelName); - newLabels[$labelDecl.name] = $newLabelDecl; - } - // Replace label - if ($jp instanceof GotoStmt) { - $jp.label = $newLabelDecl; - } - else { - $jp.decl = $newLabelDecl; - } - } - // If there are any label decls, rename them - for (const $labelDecl of Query.search(LabelDecl)) { - const $newLabelDecl = newLabels[$labelDecl.name]; - $labelDecl.replaceWith($newLabelDecl); - } - } - static LABEL_PREFIX_REGEX = /^inliner_\d+_.+$/; - createNewLabelName(previousName) { - // Check if has inliner prefix - if (!Inliner.LABEL_PREFIX_REGEX.test(previousName)) { - const labelNumber = this.labelNumber; - this.labelNumber += 1; - return "inliner_" + labelNumber + "_" + previousName; - } - // Label has already been generated by this function, update number - const newName = previousName.substring("inliner_".length); - // Get number - const underscoreIndex = newName.indexOf("_"); - const labelNumber = this.labelNumber; - this.labelNumber += 1; - // Generate new label - return ("inliner_" + labelNumber + "_" + newName.substring(underscoreIndex + 1)); - } - updateVarDecls($newNodes, newVariableMap) { - // Replace decl stmts of old vardecls with vardecls of new names (params are not included) - for (const $jp of $newNodes.getDescendants("declStmt")) { - const $declStmt = $jp; - const decls = $declStmt.decls; - for (const $varDecl of decls) { - if (!($varDecl instanceof Vardecl)) { - continue; - } - const newVar = newVariableMap.get($varDecl.name); - // If not found, just continue - if (newVar === undefined) { - debug(`Could not find variable ${$varDecl.name} in variable map`); - continue; - } - else if (!(newVar instanceof Vardecl)) { - throw new Error(`Expected newVar to be a Vardecl, but it is a ${newVar.joinPointType}`); - } - // Replace decl - $declStmt.replaceWith(ClavaJoinPoints.declStmt(newVar)); - } - } - } - updateVarrefs($newNodes, newVariableMap, $call) { - // Update varrefs - for (const $jp of $newNodes.getDescendants("varref")) { - const $varRef = $jp; - if ($varRef.kind === "function_call") { - continue; - } - const $varDecl = $varRef.decl; - // If global variable, will not be in the variable map - if ($varDecl !== undefined && $varDecl.isGlobal) { - // Copy vardecl to work over it - const $varDeclNoInit = $varDecl.copy(); - // Remove initialization - $varDeclNoInit.removeInit(false); - // Change storage class to extern - $varDeclNoInit.storageClass = StorageClass.EXTERN; - $call.getAncestor("function").insertBefore($varDeclNoInit); - continue; - } - // Verify if there is a mapping - const newVar = newVariableMap.get($varDecl.name); - if (newVar === undefined) { - throw new Error("Could not find variable " + - $varDecl.name + - "@" + - $varRef.location + - " in variable map"); - } - // If vardecl, map contains reference to old vardecl, create a varref from the new vardecl - if (newVar instanceof Vardecl) { - $varRef.replaceWith(ClavaJoinPoints.varRef(newVar)); - } - // If expression, simply replace varref with the expression - else if (newVar instanceof Expression) { - const $adaptedVar = - // If varref, does not need parenthesis - newVar instanceof Varref - ? newVar - : // For other expressions, if parent is already a parenthesis, does not need to add a new one - $varRef.parent instanceof ParenExpr - ? newVar - : // Add parenthesis - ClavaJoinPoints.parenthesis(newVar); - $varRef.replaceWith($adaptedVar); - } - else { - throw new Error("Not defined when newVar is of type '" + - newVar.joinPointType + - "'"); - } - } - } - updateVarrefsInTypes($newNodes, newVariableMap, $call) { - // Update varrefs inside types - for (const $jp of $newNodes.descendants) { - // If no type, ignore - if (!$jp.hasType) { - continue; - } - const type = $jp.type; - const updatedType = this.updateType(type, $call, newVariableMap); - if (updatedType !== type) { - $jp.type = updatedType; - } - } - } - updateType(type, $call, newVariableMap) { - // Since any type node can be shared, any change must be made in copies - // If pointer type, check pointee - if (type instanceof PointerType) { - const original = type.pointee; - const updated = this.updateType(original, $call, newVariableMap); - if (original !== updated) { - const newType = type.copy(); - newType.pointee = updated; - return newType; - } - } - if (type instanceof ParenType) { - const original = type.innerType; - const updated = this.updateType(original, $call, newVariableMap); - if (original !== updated) { - const newType = type.copy(); - newType.innerType = updated; - return newType; - } - } - if (type instanceof VariableArrayType) { - // Has to track changes both for element type and its own array expression - // Either was, has to update this type - let hasChanges = false; - // Element type - const original = type.elementType; - const updated = this.updateType(original, $call, newVariableMap); - if (original !== updated) { - hasChanges = true; - } - // TODO: I have no idea if this type cast is correct. - const $sizeExprCopy = type.sizeExpr.copy(); - // Update any children of sizeExpr - for (const $varRef of Query.searchFrom($sizeExprCopy, Varref)) { - const $newVarref = this.updateVarRef($varRef, $call, newVariableMap); - if ($newVarref !== $varRef) { - hasChanges = true; - $varRef.replaceWith($newVarref); - } - } - // Update top expr, if needed - const $newVarref = this.updateVarRef($sizeExprCopy, $call, newVariableMap); - if ($newVarref !== $sizeExprCopy) { - hasChanges = true; - } - if (hasChanges) { - const newType = type.copy(); - newType.elementType = updated; - newType.sizeExpr = $newVarref; - return newType; - } - } - // By default, return type with no changes - return type; - } - updateVarRef($varRef, $call, newVariableMap) { - const $varDecl = $varRef.decl; - // If global variable, will not be in the variable map - if ($varDecl !== undefined && $varDecl.isGlobal) { - // Copy vardecl to work over it - const $varDeclNoInit = $varDecl.copy(); - // Remove initialization - $varDeclNoInit.removeInit(false); - // Change storage class to extern - $varDeclNoInit.storageClass = StorageClass.EXTERN; - $call.getAncestor("function").insertBefore($varDeclNoInit); - return $varRef; - } - const newVar = newVariableMap.get($varDecl.name); - // If not found, just return - if (newVar === undefined) { - return $varRef; - } - // If vardecl, create a new varref - if (newVar instanceof Vardecl) { - return ClavaJoinPoints.varRef(newVar); - } - // If expression, return expression - if (newVar instanceof Expression) { - return newVar; - } - throw new Error(`Case not supported, newVar of type '${newVar.joinPointType}'`); - } -} -//# sourceMappingURL=Inliner.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/Outliner.js b/ClavaLaraApi/src-lara/clava/clava/code/Outliner.js deleted file mode 100644 index 99d54a5e8f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/Outliner.js +++ /dev/null @@ -1,415 +0,0 @@ -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { AdjustedType, ArrayType, BuiltinType, Decl, DeclStmt, FileJp, FunctionJp, Param, PointerType, ReturnStmt, Statement, Vardecl, Varref, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default class Outliner { - verbose = true; - defaultPrefix = "__outlined_function_"; - /** - * Sets the verbosity of the outliner, with false being the equivalent of a silent mode (true is the default) - * @param verbose - the verbosity of the outliner - */ - setVerbosity(verbose) { - this.verbose = verbose; - } - /** - * Sets the prefix used for the autogenerated names of the outlined functions - * @param prefix - the prefix to be used - */ - setDefaultPrefix(prefix) { - this.defaultPrefix = prefix; - } - /** - * Applies function outlining to a code region delimited by two statements. - * Function outlining is the process of removing a section of code from a function and placing it in a new function. - * The beginning and end of the code region must be at the same scope level. - * @param begin - the first statement of the outlining region - * @param end - the last statement of the outlining region - * @returns an array with the joinpoints of the outlined function and the call to it. - * These values are merely references, and all changes have already been committed to the AST at this point - */ - outline(begin, end) { - return this.outlineWithName(begin, end, this.generateFunctionName()); - } - /** - * Applies function outlining to a code region delimited by two statements. - * Function outlining is the process of removing a section of code from a function and placing it in a new function. - * The beginning and end of the code region must be at the same scope level. - * @param begin - the first statement of the outlining region - * @param end - the last statement of the outlining region - * @param functionName - the name to give to the outlined function - * @returns an array with the joinpoints of the outlined function and the call to it. - * These values are merely references, and all changes have already been committed to the AST at this point - */ - outlineWithName(begin, end, functionName) { - this.printMsg('Attempting to outline a region into a function named "' + - functionName + - '"'); - //------------------------------------------------------------------------------ - if (!this.checkOutline(begin, end)) { - this.printMsg("Provided code region is not outlinable! Aborting..."); - return; - } - this.printMsg("Provided code region is outlinable"); - //------------------------------------------------------------------------------ - const wrappers = this.wrapBeginAndEnd(begin, end); - begin = wrappers[0]; - end = wrappers[1]; - this.printMsg("Wrapped outline region with begin and ending comments"); - //------------------------------------------------------------------------------ - const parentFun = this.findParentFunction(begin); - if (parentFun == null) { - this.printMsg("Could not find parent function! Aborting..."); - return; - } - const split = this.splitRegions(parentFun, begin, end); - let region = split[1]; - const prologue = split[0]; - const epilogue = split[2]; - this.printMsg("Found " + region.length + " statements for the outline region"); - this.printMsg("Prologue has " + - prologue.length + - " statements, and epilogue has " + - epilogue.length); - //------------------------------------------------------------------------------ - const globals = this.findGlobalVars(); - this.printMsg("Found " + globals.length + " global variable(s)"); - //------------------------------------------------------------------------------ - const callPlaceholder = ClavaJoinPoints.stmtLiteral("//placeholder for the call to " + functionName); - begin.insertBefore(callPlaceholder); - this.printMsg("Created a placeholder call to the new function"); - //------------------------------------------------------------------------------ - const declareBefore = this.findDeclsWithDependency(region, epilogue); - region = region.filter((stmt) => !(stmt instanceof DeclStmt && declareBefore.includes(stmt))); - for (let i = declareBefore.length - 1; i >= 0; i--) { - const decl = declareBefore[i]; - decl.detach(); - begin.insertBefore(decl); - prologue.push(decl); - } - this.printMsg("Moved declarations from outline region to immediately before the region"); - //------------------------------------------------------------------------------ - const referencedInRegion = this.findRefsInRegion(region); - const funParams = this.createParams(referencedInRegion); - const fun = this.createFunction(functionName, region, funParams); - this.printMsg('Successfully created function "' + functionName + '"'); - //------------------------------------------------------------------------------ - const callArgs = this.createArgs(fun, prologue, parentFun); - let call = this.createCall(callPlaceholder, fun, callArgs); - this.printMsg('Successfully created call to "' + functionName + '"'); - //------------------------------------------------------------------------------ - // At this point, if the function has a premature return, it will be returning a value - // of that type instead of void. We change the function to return void now at this point, - // by doing a) adding a new parameter for the return value of the premature return; b) a new - // boolean parameter that is set to true if the function returns prematurely; c) we declare these - // two variables before the function call and d) if the boolean is set to 1 after the call, we - // return from the caller with the value returned by the callee. - const newCall = this.ensureVoidReturn(fun, call); - if (newCall != null) { - this.printMsg("Ensured that the outlined function returns void by parameterizing the early return(s)"); - call = newCall; - } - else { - this.printMsg("No need to ensure that the outlined function returns void, as it has no early returns"); - } - //------------------------------------------------------------------------------ - begin.detach(); - end.detach(); - this.printMsg("Outliner cleanup finished"); - return [fun, call]; - } - /** - * Verifies if a code region can undergo function outlining. - * This check is performed automatically by the outliner itself, but it can be invoked manually if desired. - * @param begin - the first statement of the outlining region - * @param end - the last statement of the outlining region - * @returns true if the outlining region is valid, false otherwise - */ - checkOutline(begin, end) { - let outlinable = true; - if (this.findParentFunction(begin) == null) { - this.printMsg("Requirement not met: outlinable region must be inside a function"); - outlinable = false; - } - if (begin.parent.astId != end.parent.astId) { - this.printMsg("Requirement not met: begin and end joinpoints are not at the same scope level"); - outlinable = false; - } - return outlinable; - } - ensureVoidReturn(fun, call) { - const returnStmts = this.findNonvoidReturnStmts([fun]); - if (returnStmts.length == 0) { - return null; - } - // actions before the function call - const type = returnStmts[0].children[0].type; - const resId = IdGenerator.next("__rtr_val_"); - const resVar = ClavaJoinPoints.varDeclNoInit(resId, type); - const boolId = IdGenerator.next("__rtr_flag_"); - const boolVar = ClavaJoinPoints.varDecl(boolId, ClavaJoinPoints.integerLiteral(0)); - const resVarRef = resVar.varref(); - const boolVarRef = boolVar.varref(); - call.insertBefore(resVar); - call.insertBefore(boolVar); - // actions in the function itself - const params = this.createParams([resVarRef, boolVarRef]); - fun.addParam(params[0]); - fun.addParam(params[1]); - for (const ret of returnStmts) { - const resVarParam = fun.params[fun.params.length - 2]; - const derefResVarParam = ClavaJoinPoints.unaryOp("*", resVarParam.varref()); - const retVal = ret.children[0]; - retVal.detach(); - const op1 = ClavaJoinPoints.binaryOp("=", derefResVarParam, retVal, resVarParam.type); - ret.insertBefore(ClavaJoinPoints.exprStmt(op1)); - const boolVarParam = fun.params[fun.params.length - 1]; - const newVarref = ClavaJoinPoints.varRef(boolVarParam); - const derefBoolVarParam = ClavaJoinPoints.unaryOp("*", newVarref); - const trueVal = ClavaJoinPoints.integerLiteral(1); - const op2 = ClavaJoinPoints.binaryOp("=", derefBoolVarParam, trueVal, boolVarParam.type); - ret.insertBefore(op2); - } - fun.setType(ClavaJoinPoints.type("void")); - // actions on the function call - const resVarAddr = ClavaJoinPoints.unaryOp("&", resVarRef); - const boolVarAddr = ClavaJoinPoints.unaryOp("&", boolVarRef); - const allArgs = call.argList.concat([resVarAddr, boolVarAddr]); - call = this.createCall(call, fun, allArgs); - // actions after the function call - const returnStmt = ClavaJoinPoints.returnStmt(resVarRef); - const scope = ClavaJoinPoints.scope(); - scope.setFirstChild(returnStmt); - const ifStmt = ClavaJoinPoints.ifStmt(boolVarRef, scope); - call.insertAfter(ifStmt); - return call; - } - wrapBeginAndEnd(begin, end) { - const beginWrapper = ClavaJoinPoints.stmtLiteral("//begin of the outline region"); - const endWrapper = ClavaJoinPoints.stmtLiteral("//end of the outline region"); - begin.insertBefore(beginWrapper); - end.insertAfter(endWrapper); - return [beginWrapper, endWrapper]; - } - findParentFunction(jp) { - while (!(jp instanceof FunctionJp)) { - if (jp instanceof FileJp) { - return null; - } - jp = jp.parent; - } - return jp; - } - findGlobalVars() { - const globals = []; - for (const decl of Query.search(Vardecl)) { - if (decl.isGlobal) { - globals.push(decl); - } - } - return globals; - } - createCall(placeholder, fun, args) { - const call = ClavaJoinPoints.call(fun, ...args); - placeholder.replaceWith(call); - return call; - } - createArgs(fun, prologue, parentFun) { - const decls = []; - // get decls from the prologue - for (const stmt of prologue) { - for (const decl of Query.searchFrom(stmt, Vardecl)) { - decls.push(decl); - } - } - // get decls from the parent function params - for (const param of Query.searchFrom(parentFun, Param)) { - decls.push(param.definition); - } - // no need to handle global vars - they are not parameters - const args = []; - for (const param of fun.params) { - for (const decl of decls) { - if (decl.name === param.name) { - const ref = ClavaJoinPoints.varRef(decl); - if (param.type instanceof PointerType && - ref.type instanceof BuiltinType) { - const addressOfScalar = ClavaJoinPoints.unaryOp("&", ref); - args.push(addressOfScalar); - } - else { - args.push(ref); - } - break; - } - } - } - return args; - } - createFunction(name, region, params) { - let oldFun = region[0]; - while (!(oldFun instanceof FunctionJp)) { - oldFun = oldFun.parent; - } - let retType = ClavaJoinPoints.type("void"); - const returnStmts = this.findNonvoidReturnStmts(region); - if (returnStmts.length > 0) { - retType = returnStmts[0].children[0].type; - this.printMsg(`Found ${returnStmts.length} return statement(s) in the outline region`); - } - const fun = ClavaJoinPoints.functionDecl(name, retType, ...params); - oldFun.insertBefore(fun); - const scope = ClavaJoinPoints.scope(); - fun.setBody(scope); - for (const stmt of region) { - stmt.detach(); - scope.insertEnd(stmt); - } - // make sure scalar refs are now dereferenced pointers to params - this.scalarsToPointers(region, params); - return fun; - } - findNonvoidReturnStmts(startingPoints) { - const returnStmts = []; - for (const stmt of startingPoints) { - for (const ret of Query.searchFrom(stmt, ReturnStmt)) { - if (ret.numChildren > 0) { - returnStmts.push(ret); - } - } - } - return returnStmts; - } - scalarsToPointers(region, params) { - for (const stmt of region) { - for (const varref of Query.searchFrom(stmt, Varref)) { - for (const param of params) { - if (param.name === varref.name && - varref.type instanceof BuiltinType) { - const newVarref = ClavaJoinPoints.varRef(param); - const op = ClavaJoinPoints.unaryOp("*", newVarref); - varref.replaceWith(op); - } - } - } - } - } - createParams(varrefs) { - const params = []; - for (const ref of varrefs) { - const name = ref.name; - const varType = ref.type; - if (varType instanceof ArrayType || - varType instanceof AdjustedType || - varType instanceof PointerType) { - const param = ClavaJoinPoints.param(name, varType); - params.push(param); - } - else if (varType instanceof BuiltinType) { - const newType = ClavaJoinPoints.pointer(varType); - const param = ClavaJoinPoints.param(name, newType); - params.push(param); - } - else { - console.log("Unsuported param type: " + varType.joinPointType); - } - } - this.printMsg("Created " + params.length + " param(s) for the outlined function"); - return params; - } - findRefsInRegion(region) { - const declsNames = []; - for (const stmt of region) { - for (const decl of Query.searchFrom(stmt, Decl)) { - declsNames.push(decl.name); - } - } - const varrefs = []; - const varrefsNames = []; - for (const stmt of region) { - for (const varref of Query.searchFrom(stmt, Varref)) { - // may need to filter for other types, like macros, etc - // select all varrefs with no matching decl in the region, except globals - if (!varrefsNames.includes(varref.name) && - !varref.isFunctionCall && - !declsNames.includes(varref.name) && - !varref.decl.isGlobal) { - varrefs.push(varref); - varrefsNames.push(varref.name); - } - } - } - this.printMsg("Found " + - varrefsNames.length + - " external variable references inside outline region"); - return varrefs; - } - findDeclsWithDependency(region, epilogue) { - const regionDecls = []; - const regionDeclsNames = []; - for (const stmt of region) { - if (stmt instanceof DeclStmt) { - regionDecls.push(stmt); - regionDeclsNames.push(stmt.children[0].name); - } - } - const epilogueVarrefsNames = []; - for (const stmt of epilogue) { - // also gets function names... could it cause an issue? - for (const varref of Query.searchFrom(stmt, Varref)) { - epilogueVarrefsNames.push(varref.name); - } - } - const declsWithDependency = []; - for (let i = 0; i < regionDecls.length; i++) { - const varName = regionDeclsNames[i]; - if (epilogueVarrefsNames.includes(varName)) { - declsWithDependency.push(regionDecls[i]); - } - } - this.printMsg("Found " + - declsWithDependency.length + - " declaration(s) referenced after the outline region"); - return declsWithDependency; - } - splitRegions(fun, begin, end) { - const prologue = []; - const region = []; - const epilogue = []; - let inPrologue = true; - let inRegion = false; - for (const stmt of Query.searchFrom(fun, Statement)) { - if (inPrologue) { - if (stmt.astId == begin.astId) { - region.push(stmt); - inPrologue = false; - inRegion = true; - } - else { - prologue.push(stmt); - } - } - if (inRegion) { - // we only want statements at the scope level, we can get the children later - if (stmt.parent.astId == begin.parent.astId) { - region.push(stmt); - if (stmt.astId == end.astId) { - inRegion = false; - } - } - } - if (!inPrologue && !inRegion) { - epilogue.push(stmt); - } - } - return [prologue, region, epilogue]; - } - printMsg(msg) { - if (this.verbose) - console.log("[Outliner] " + msg); - } - generateFunctionName() { - return IdGenerator.next(this.defaultPrefix); - } -} -//# sourceMappingURL=Outliner.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/RemoveShadowing.js b/ClavaLaraApi/src-lara/clava/clava/code/RemoveShadowing.js deleted file mode 100644 index 67909d87bd..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/RemoveShadowing.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function RemoveShadowing($function) { - const usedNames = new Set(); - let aliasIndex = 0; - for (const $param of $function.params) { - usedNames.add($param.name); - } - for (const $jp of $function.body.getDescendants("vardecl")) { - const $vardecl = $jp; - if (usedNames.has($vardecl.name)) { - // TODO: ensure the new name is not part of the usedNames - const newName = `${$vardecl.name}_${aliasIndex++}`; - $vardecl.name = newName; - usedNames.add(newName); - } - } -} -//# sourceMappingURL=RemoveShadowing.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/SimplifyAssignment.js b/ClavaLaraApi/src-lara/clava/clava/code/SimplifyAssignment.js deleted file mode 100644 index a9613bfa76..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/SimplifyAssignment.js +++ /dev/null @@ -1,31 +0,0 @@ -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Simplifies assignments of the type `a += b` into the equivalent expression `a = a + b` - * @param $complexAssignment - The expression to simplify - */ -export default function SimplifyAssignment($complexAssignment) { - // early return if current node is not suitable for this transform - if (!ops.has($complexAssignment.operator)) { - return; - } - const $lValue = $complexAssignment.left; - const $rValue = $complexAssignment.right; - const $binaryOp = ClavaJoinPoints.binaryOp(ops.get($complexAssignment.operator), $lValue.copy(), $rValue, $complexAssignment.type); - $complexAssignment.replaceWith(ClavaJoinPoints.assign($lValue, $binaryOp)); -} -/** - * Non-assignment counterparts of complex assignment operators (lookup table) - */ -const ops = new Map([ - ["*=", "*"], - ["/=", "/"], - ["%=", "%"], - ["+=", "+"], - ["-=", "-"], - ["<<=", "<<"], - [">>=", ">>"], - ["&=", "&"], - ["^=", "^"], - ["|=", "|"], -]); -//# sourceMappingURL=SimplifyAssignment.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/SimplifyTernaryOp.js b/ClavaLaraApi/src-lara/clava/clava/code/SimplifyTernaryOp.js deleted file mode 100644 index 8b46dfeb26..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/SimplifyTernaryOp.js +++ /dev/null @@ -1,44 +0,0 @@ -import { BinaryOp, TernaryOp } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Simplifies a statement like: - * - * ```c - * x = y ? a : b; - * ``` - * - * Into: - * - * ```c - * if (y) { - * x = a; - * } else { - * x = b; - * } - * ``` - * - * $assignmentStmt must be an expression statement (not an inline expression, such as in a - * varDecl or within another expression). The expression statement must only contain an assignment - * operator, and the rvalue must be a ternary operator. - * - * Otherwise the function will immediately return. - * - * @param $assignmentStmt - Expression statement containing an assignment where the right hand side is a ternary operator - */ -export default function SimplifyTernaryOp($assignmentStmt) { - // early return if current node is not suitable - if (!($assignmentStmt.expr instanceof BinaryOp && - $assignmentStmt.expr.isAssignment && - $assignmentStmt.expr.right instanceof TernaryOp)) { - return; - } - const $assignment = $assignmentStmt.expr; - const $ternaryOp = $assignment.right; - const $trueStmt = $assignmentStmt.copy(); - $trueStmt.expr.right = $ternaryOp.trueExpr; - const $falseStmt = $assignmentStmt.copy(); - $falseStmt.expr.right = $ternaryOp.falseExpr; - const $ifStmt = ClavaJoinPoints.ifStmt($ternaryOp.cond, ClavaJoinPoints.scope($trueStmt), ClavaJoinPoints.scope($falseStmt)); - $assignmentStmt.replaceWith($ifStmt); -} -//# sourceMappingURL=SimplifyTernaryOp.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/code/StatementDecomposer.js b/ClavaLaraApi/src-lara/clava/clava/code/StatementDecomposer.js deleted file mode 100644 index 6c8d245488..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/code/StatementDecomposer.js +++ /dev/null @@ -1,272 +0,0 @@ -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import { BinaryOp, Call, Case, DeclStmt, EmptyStmt, ExprStmt, LabelStmt, MemberCall, ReturnStmt, Scope, Statement, TernaryOp, UnaryOp, Vardecl, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import DecomposeResult from "./DecomposeResult.js"; -/** - * Decomposes complex statements into several simpler ones. - */ -export default class StatementDecomposer { - tempPrefix; - startIndex; - constructor(tempPrefix = "decomp_", startIndex = 0) { - this.tempPrefix = tempPrefix; - this.startIndex = startIndex; - } - newTempVarname() { - const varName = `${this.tempPrefix}${this.startIndex}`; - this.startIndex++; - return varName; - } - /** - * Some Joinpoints might generate invalid code under certain conditions. This method checks - * for those cases and adds an empty statement to the AST to fix them. - * - * @param $jp - Joinpoint to be scrutinized - */ - ensureValidNode($jp) { - if (!($jp instanceof Statement) || $jp instanceof EmptyStmt) { - const parentStmt = $jp.getAncestor("statement"); - if (parentStmt === undefined) - return; - this.ensureValidNode(parentStmt); - return; - } - // If preceeding statement is a CaseStmt or a LabelStmt it might generate invalid code if a declaration is inserted - // Add empty statement after the label to avoid this situation - const $leftStmt = $jp.leftJp; - if ($leftStmt === undefined || - (!($leftStmt instanceof Case) && !($leftStmt instanceof LabelStmt))) - return; - debug(`StatementDecomposer: statement just before label, inserting empty statement after as a precaution`); - $leftStmt.insertAfter(ClavaJoinPoints.emptyStmt()); - } - /** - * If the given statement can be decomposed in two or more statements, replaces the statement with the decomposition. - * - * @param $stmt - A statement that will be decomposed. - */ - decomposeAndReplace($stmt) { - const stmts = this.decompose($stmt); - // No statements to replace - if (stmts.length === 0) { - return; - } - // Replace stmt with array of statements - $stmt.replaceWith(stmts); - } - /** - * @param $stmt - A statement that will be decomposed. - * @returns An array with the new statements, or an empty array if no decomposition could be made - */ - decompose($stmt) { - try { - return this.decomposeStmt($stmt); - } - catch (e) { - console.log(`StatementDecomposer: ${String(e)}`); - return []; - } - } - decomposeStmt($stmt) { - // Unsupported - if ($stmt instanceof Scope || $stmt.joinPointType === "statement") { - debug(`StatementDecomposer: skipping scope or generic statement join point`); - return []; - } - this.ensureValidNode($stmt); - if ($stmt instanceof ExprStmt) { - return this.decomposeExprStmt($stmt); - } - if ($stmt instanceof ReturnStmt) { - return this.decomposeReturnStmt($stmt); - } - if ($stmt instanceof DeclStmt) { - return this.decomposeDeclStmt($stmt); - } - debug(`StatementDecomposer: not implemented for statement of type ${$stmt.joinPointType}`); - return []; - } - decomposeExprStmt($stmt) { - // Statement represents an expression - const $expr = $stmt.expr; - const { precedingStmts, succeedingStmts } = this.decomposeExpr($expr); - return [...precedingStmts, ...succeedingStmts]; - } - decomposeReturnStmt($stmt) { - // Return may contain an expression - const $expr = $stmt.returnExpr; - if ($expr === undefined) { - return []; - } - const { precedingStmts, $resultExpr } = this.decomposeExpr($expr); - const $newReturnStmt = ClavaJoinPoints.returnStmt($resultExpr); - return [...precedingStmts, $newReturnStmt]; - } - decomposeDeclStmt($stmt) { - // declStmt can have one or more declarations - const $decls = $stmt.decls; - return $decls.flatMap(($decl) => this.decomposeDecl($decl)); - } - decomposeDecl($decl) { - if (!($decl instanceof Vardecl)) { - debug(`StatementDecomposer.decomposeDeclStmt: not implemented for decl of type ${$decl.joinPointType}`); - return [ClavaJoinPoints.declStmt($decl)]; - } - // If vardecl has init, decompose expression - if ($decl.hasInit) { - const decomposeResult = this.decomposeExpr($decl.init); - //expr = newStmts.concat(decomposeResult.stmts); - $decl.init = decomposeResult.$resultExpr; - return [ - ...decomposeResult.precedingStmts, - ClavaJoinPoints.declStmt($decl), - ...decomposeResult.succeedingStmts, - ]; - } - return [ClavaJoinPoints.declStmt($decl)]; - } - decomposeExpr($expr) { - this.ensureValidNode($expr); - if ($expr instanceof BinaryOp) { - return this.decomposeBinaryOp($expr); - } - if ($expr instanceof UnaryOp) { - return this.decomposeUnaryOp($expr); - } - if ($expr instanceof TernaryOp) { - return this.decomposeTernaryOp($expr); - } - if ($expr instanceof Call) { - return this.decomposeCall($expr); - } - if ($expr.numChildren === 0) { - return new DecomposeResult([], $expr); - } - debug(`StatementDecomposer: decomposition not implemented for type ${$expr.joinPointType}. Returning '${$expr.code}'as is`); - return new DecomposeResult([], $expr); - } - decomposeCall($call) { - const argResults = $call.args.map(($arg) => this.decomposeExpr($arg)); - const precedingStmts = argResults.flatMap((res) => res.precedingStmts); - const succeedingStmts = argResults.flatMap((res) => res.succeedingStmts); - const newArgs = argResults.map((res) => res.$resultExpr); - const $newCall = this.copyCall($call, newArgs); - //const $newCall = ClavaJoinPoints.call($call.function, ...newArgs); - // Desugaring type, to avoid possible problems of code generation of more complex types - // E.g. for vector.size(), currently is generating code without the qualifier - const desugaredReturnType = $newCall.type.desugarAll; - // If call is inside an exprStmt, and exprStmt is inside a scope, just convert new call to statement - // The scope test is to avoid wrong code in situations such as loop headers - if ($call.parent !== undefined && - $call.parent instanceof ExprStmt && - $call.parent.parent !== undefined && - $call.parent.parent instanceof Scope) { - // Using .exprStmt() to ensure a new statement is created. - // .stmt might not create a new statement, and interfere with detaching the previous stmt - const newStmts = [...precedingStmts, ClavaJoinPoints.exprStmt($newCall)]; - return new DecomposeResult(newStmts, $newCall, []); - } - // Otherwise, create a variable to store the result of the call - // and return the variable as the value expression - const tempVarname = this.newTempVarname(); - const tempVarDecl = ClavaJoinPoints.varDeclNoInit(tempVarname, desugaredReturnType); - const tempVarAssign = ClavaJoinPoints.assign(ClavaJoinPoints.varRef(tempVarDecl), $newCall); - return new DecomposeResult([...precedingStmts, tempVarDecl.stmt, tempVarAssign.stmt], ClavaJoinPoints.varRef(tempVarDecl), succeedingStmts); - } - copyCall($call, newArgs) { - // Instance method - if ($call instanceof MemberCall) { - // Copy node - const $newCall = $call.copy(); - // Update args - // TODO: use a kind of .setArgs that replaces all - for (let i = 0; i < newArgs.length; i++) { - $newCall.setArg(i, newArgs[i]); - } - return $newCall; - } - // Default - return ClavaJoinPoints.call($call.function, ...newArgs); - } - decomposeBinaryOp($binaryOp) { - if ($binaryOp.isAssignment) { - return this.decomposeAssignment($binaryOp); - } - // Apply decompose to both sides - const leftResult = this.decomposeExpr($binaryOp.left); - const rightResult = this.decomposeExpr($binaryOp.right); - // Create operation with result of decomposition - const $newExpr = ClavaJoinPoints.binaryOp($binaryOp.kind, leftResult.$resultExpr, rightResult.$resultExpr, $binaryOp.type); - // Create declaration statement with result to new temporary variable - const tempVarname = this.newTempVarname(); - const tempVarDecl = ClavaJoinPoints.varDeclNoInit(tempVarname, $binaryOp.type); - const tempVarAssign = ClavaJoinPoints.assign(ClavaJoinPoints.varRef(tempVarDecl), $newExpr); - const precedingStmts = [ - ...leftResult.precedingStmts, - ...rightResult.precedingStmts, - tempVarDecl.stmt, - tempVarAssign.stmt, - ]; - const succeedingStmts = [ - ...leftResult.succeedingStmts, - ...rightResult.succeedingStmts, - ]; - return new DecomposeResult(precedingStmts, ClavaJoinPoints.varRef(tempVarDecl), succeedingStmts); - } - decomposeAssignment($assign) { - // Get statements of right hand-side - const rightResult = this.decomposeExpr($assign.right); - const $newAssign = $assign.operator === "=" - ? ClavaJoinPoints.assign($assign.left, rightResult.$resultExpr) - : ClavaJoinPoints.compoundAssign($assign.operator, $assign.left, rightResult.$resultExpr); - const $assignExpr = ClavaJoinPoints.exprStmt($newAssign); - return new DecomposeResult([...rightResult.precedingStmts, $assignExpr], $assign.left, rightResult.succeedingStmts); - } - decomposeTernaryOp($ternaryOp) { - const condResult = this.decomposeExpr($ternaryOp.cond); - const trueResult = this.decomposeExpr($ternaryOp.trueExpr); - const falseResult = this.decomposeExpr($ternaryOp.falseExpr); - const tempVarname = this.newTempVarname(); - const tempVarDecl = ClavaJoinPoints.varDeclNoInit(tempVarname, $ternaryOp.type); - // assign the value of the new temp variable with an if-else statement - // to maintain the semantics of only evaluating the expression that - // falls on the right side of the ternary. - // we do not want side-effects to be executed without regard to the branch - // taken - const $thenBody = ClavaJoinPoints.scope(...condResult.succeedingStmts, ...trueResult.precedingStmts, ClavaJoinPoints.assign(ClavaJoinPoints.varRef(tempVarDecl), trueResult.$resultExpr), ...trueResult.succeedingStmts); - const $elseBody = ClavaJoinPoints.scope(...condResult.succeedingStmts, ...falseResult.precedingStmts, ClavaJoinPoints.assign(ClavaJoinPoints.varRef(tempVarDecl), falseResult.$resultExpr), ...falseResult.succeedingStmts); - const $ifStmt = ClavaJoinPoints.ifStmt(condResult.$resultExpr, $thenBody, $elseBody); - const precedingStmts = [ - tempVarDecl.stmt, - ...condResult.precedingStmts, - $ifStmt, - ]; - return new DecomposeResult(precedingStmts, ClavaJoinPoints.varRef(tempVarDecl)); - } - decomposeUnaryOp($unaryOp) { - const kind = $unaryOp.kind; - // only decompose increment / decrement operations, separating the change - // from the result of the change - if (kind !== "post_dec" && - kind !== "post_inc" && - kind !== "pre_dec" && - kind !== "pre_inc") { - return new DecomposeResult([], $unaryOp, []); - } - switch (kind) { - case "post_dec": - case "post_inc": { - const $innerExpr = $unaryOp.operand.copy(); - const succeedingStmts = [ClavaJoinPoints.exprStmt($unaryOp)]; - return new DecomposeResult([], $innerExpr, succeedingStmts); - } - case "pre_dec": - case "pre_inc": { - const $innerExpr = $unaryOp.operand.copy(); - const precedingStmts = [ClavaJoinPoints.exprStmt($unaryOp)]; - return new DecomposeResult(precedingStmts, $innerExpr, []); - } - } - } -} -//# sourceMappingURL=StatementDecomposer.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/gprofer/Gprofer.js b/ClavaLaraApi/src-lara/clava/clava/gprofer/Gprofer.js deleted file mode 100644 index 4b7350af50..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/gprofer/Gprofer.js +++ /dev/null @@ -1,208 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { FunctionJp } from "../../Joinpoints.js"; -import Clava from "../Clava.js"; -import CMaker from "../cmake/CMaker.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -function GproferGetCxxFunction(signature) { - return Query.search(FunctionJp, { - signature: signature, - hasDefinition: true, - }).first(); -} -function GproferGetCFunction(signature) { - return Query.search(FunctionJp, { - name: signature, - hasDefinition: true, - }).first(); -} -export default class Gprofer { - _runs; - _args; - _app = Clava.getProgram(); - _workingDir = undefined; - _deleteWorkingDir = false; - _checkReturn = true; - _data = {}; - _hotSpots = {}; - _cmaker = this.defaultCmaker(); - _gProfer = JavaTypes.Gprofer; - constructor(runs = 1, args = []) { - this._runs = runs; - this._args = args; - } - getCmaker() { - return this._cmaker; - } - static _EXE_NAME = "gprofer_bin"; - defaultCmaker() { - const cmaker = new CMaker(Gprofer._EXE_NAME, false); - if (Clava.isCxx()) { - cmaker.addCxxFlags("-no-pie", "-pg"); - } - else { - cmaker.addFlags("-no-pie", "-pg"); - } - // sources - for (const $jp of this._app.getDescendants("file")) { - const $file = $jp; - if ($file.isHeader) { - continue; - } - cmaker.getSources().addSource($file.filepath); - } - // includes - for (const obj of Clava.getIncludeFolders()) { - const userInclude = obj; - debug("Adding include: " + userInclude); - cmaker.addIncludeFolder(userInclude); - } - return cmaker; - } - static _buildName($function) { - if (Clava.isCxx()) { - /* signature or qualified name */ - return $function.signature; - } - return $function.name; - } - setArgs(args) { - this._args = args; - return this; - } - setRuns(runs) { - this._runs = runs; - return this; - } - setCheckReturn(checkReturn) { - this._checkReturn = checkReturn; - return this; - } - setWorkingDir(workingDir, deleteWorkingDir) { - this._workingDir = Io.getPath(workingDir); - this._deleteWorkingDir = deleteWorkingDir; - return this; - } - profile() { - if (this._workingDir === undefined) { - this._workingDir = Io.getTempFolder("gprofer_" + Strings.uuid()); - this._deleteWorkingDir = true; - } - // compile the application - const binary = this._cmaker.build(this._workingDir, Io.getPath(this._workingDir, "build")); - // call java gprofer - const data = this._gProfer.profile(binary, this._args, this._runs, this._workingDir, this._deleteWorkingDir, this._checkReturn); - const json = this._gProfer.getJsonData(data); - // fill this._data and this._hotSpots - const obj = JSON.parse(json); - this._hotSpots = obj.hotspots; - this._data = obj.table; - return this; - } - getHotspotNames() { - return this._hotSpots; - } - writeProfile(path = Io.getPath("./gprofer.json")) { - const profile = { - data: this._data, - hotspots: this._hotSpots, - }; - Io.writeJson(path.getAbsolutePath(), profile); - } - readProfile(path = Io.getPath("./gprofer.json")) { - const obj = Io.readJson(path.getAbsolutePath()); - this._data = obj.data; - this._hotSpots = obj.hotspots; - } - /** - * - * May return undefined if the desired function is a system or library function and not available in the source code. - * */ - getHotspot(rank = 0) { - const _rank = rank; - const signature = this._hotSpots[_rank]; - const f = this._getHotspot(signature); - if (f === undefined) { - console.log(`Could not find hotspot with rank ${rank} and signature ${signature}. It may be a system function.\n`); - } - return f; - } - /** - * Internal method that uses the signature to identify a function. - * */ - _getHotspot(signature) { - let f = undefined; - if (Clava.isCxx()) { - debug("finding Cxx function with signature " + signature); - f = GproferGetCxxFunction(signature); - } - else { - debug("finding C function with signature " + signature); - f = GproferGetCFunction(signature); - } - return f; - } - getPercentage($function) { - return this.get("percentage", $function); - } - getCalls($function) { - return this.get("calls", $function); - } - getSelfSeconds($function) { - return this.get("selfSeconds", $function); - } - getSelfMsCall($function) { - return this.get("selfMsCall", $function); - } - getTotalMsCall($function) { - return this.get("totalMsCall", $function); - } - get(type, $function) { - const name = Gprofer._buildName($function); - return this._data[name][type]; - } - print($function) { - const perc = this.getPercentage($function); - const calls = this.getCalls($function); - const self = this.getSelfSeconds($function); - const selfCall = this.getSelfMsCall($function); - const totalCall = this.getTotalMsCall($function); - console.log($function.signature); - if (perc !== undefined) { - console.log(`\tPercentage: ${perc}%`); - } - if (calls !== undefined) { - console.log(`\tCalls: ${calls}`); - } - if (self !== undefined) { - console.log(`\tSelf seconds: ${self}s`); - } - if (selfCall !== undefined) { - console.log(`\tSelf ms/call: ${selfCall}ms`); - } - if (totalCall !== undefined) { - console.log(`\tTotal ms/call: ${totalCall}ms`); - } - } - removeSystemFunctions() { - const toRemove = []; - for (const index in this._hotSpots) { - const sigIndex = Number(index); - const sig = this._hotSpots[sigIndex]; - const $hs = this._getHotspot(sig); - if ($hs === undefined) { - // mark to remove from array - toRemove.push(sigIndex); - // remove from map - delete this._data[sig]; - } - } - // remove from array - for (const sigIndex of toRemove) { - delete this._hotSpots[sigIndex]; - } - } -} -//# sourceMappingURL=Gprofer.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/ControlFlowGraph.js b/ClavaLaraApi/src-lara/clava/clava/graphs/ControlFlowGraph.js deleted file mode 100644 index 95e66e0e91..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/ControlFlowGraph.js +++ /dev/null @@ -1,67 +0,0 @@ -import Graph from "@specs-feup/lara/api/lara/graphs/Graph.js"; -import CfgBuilder from "./cfg/CfgBuilder.js"; -export default class ControlFlowGraph extends Graph { - /** - * Maps stmts to graph nodes - */ - nodes; - /** - * The start node of the CFG - */ - start; - /** - * The end node of the CFG - */ - end; - constructor(graph, nodes, startNode, endNode) { - super(graph); - this.nodes = nodes; - this.start = startNode; - this.end = endNode; - } - /** - * Builds the control flow graph - * - * @param deterministicIds - If true, uses deterministic ids for the graph ids (e.g. id_0, id_1...). Otherwise, uses $jp.astId whenever possible - * @param options - An object containing configuration options for the cfg - * @returns A new instance of the ControlFlowGraph class - */ - static build($jp, deterministicIds = false, options = { - /** - * If true, statements of each instruction list must be split - */ - splitInstList: false, - /** - * If true, the nodes that correspond to goto statements will be excluded from the resulting graph - */ - removeGotoNodes: false, - /** - * If true, the nodes that correspond to label statements will be excluded from the resulting graph - */ - removeLabelNodes: false, - /** - * If true, the temporary scope statements will be kept in the resulting graph - */ - keepTemporaryScopeStmts: false, - }) { - const builderResult = new CfgBuilder($jp, deterministicIds, options).build(); - return new ControlFlowGraph(...builderResult); - } - /** - * Returns the graph node where the given statement belongs. - * - * @param $stmt - A statement join point, or a string with the astId of the join point - */ - getNode($stmt) { - // If string, assume it is astId - const astId = typeof $stmt === "string" ? $stmt : $stmt.astId; - return this.nodes.get(astId); - } - get startNode() { - return this.start; - } - get endNode() { - return this.end; - } -} -//# sourceMappingURL=ControlFlowGraph.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/StaticCallGraph.js b/ClavaLaraApi/src-lara/clava/clava/graphs/StaticCallGraph.js deleted file mode 100644 index d4a168c209..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/StaticCallGraph.js +++ /dev/null @@ -1,46 +0,0 @@ -import DotFormatter from "@specs-feup/lara/api/lara/graphs/DotFormatter.js"; -import Graph from "@specs-feup/lara/api/lara/graphs/Graph.js"; -import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import StaticCallGraphBuilder from "./scg/StaticCallGraphBuilder.js"; -export default class StaticCallGraph extends Graph { - static dotFormatterInstance = undefined; - /** - * Maps functions to graph nodes - */ - functionMap; - constructor(graph, functions) { - super(graph); - this.functionMap = functions; - } - /** - * - * @param $jp - - * @param visitCalls - If true, recursively visits the functions of each call, building a call graph of the available code - * @returns - */ - static build($jp, visitCalls = true) { - const builder = new StaticCallGraphBuilder(); - const graph = builder.build($jp, visitCalls); - return new StaticCallGraph(graph, builder.nodes); - } - get functions() { - return this.functionMap; - } - getNode($function) { - // Normalize function - return this.functionMap[$function.canonical.astId]; - } - static get dotFormatter() { - if (StaticCallGraph.dotFormatterInstance === undefined) { - StaticCallGraph.dotFormatterInstance = new DotFormatter(); - StaticCallGraph.dotFormatterInstance.addNodeAttribute("style=dashed", (node) => Graphs.isLeaf(node) && - !node.data().hasImplementation()); - StaticCallGraph.dotFormatterInstance.addNodeAttribute("style=filled", (node) => Graphs.isLeaf(node) && node.data().hasCalls()); - } - return StaticCallGraph.dotFormatterInstance; - } - toDot() { - return super.toDot(StaticCallGraph.dotFormatter); - } -} -//# sourceMappingURL=StaticCallGraph.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgBuilder.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgBuilder.js deleted file mode 100644 index ebb89ebf6c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgBuilder.js +++ /dev/null @@ -1,702 +0,0 @@ -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { FunctionJp, LabelStmt, Loop, Scope, Statement, } from "../../../Joinpoints.js"; -import ClavaJoinPoints from "../../ClavaJoinPoints.js"; -import CfgEdge from "./CfgEdge.js"; -import CfgEdgeType from "./CfgEdgeType.js"; -import CfgNodeType from "./CfgNodeType.js"; -import CfgUtils from "./CfgUtils.js"; -import NextCfgNode from "./NextCfgNode.js"; -import DataFactory from "./nodedata/DataFactory.js"; -export default class CfgBuilder { - /** - * AST node to process - */ - jp; - /** - * Graph being built - */ - graph; - /** - * Maps stmts to graph nodes - */ - nodes; - /** - * The start node of the graph - */ - startNode; - /** - * The end node of the graph - */ - endNode; - /** - * Maps the astId to the corresponding temporary statement - */ - temporaryStmts; - /** - * If true, uses deterministic ids for the graph ids (e.g. id_0, id_1...). Otherwise, uses $jp.astId whenever possible. - */ - deterministicIds; - /** - * Current id, in case deterministic ids are used - */ - currentId; - /** - * An instance of DataFactory, for creating graph node data - */ - dataFactory; - /** - * Calculates what node is unconditionally executed after a given statement - */ - nextNodes; - /** - * If true, each instruction list should be split - */ - splitInstList; - /** - * If true, the goto nodes should be excluded from the graph - */ - removeGotoNodes; - /** - * If true, the label nodes should be excluded from the graph - */ - removeLabelNodes; - /** - * If true, the temporary scope statements should not be removed from the graph - */ - keepTemporaryScopeStmts; - /** - * Creates a new instance of the CfgBuilder class - * @param $jp - - * @param deterministicIds - If true, uses deterministic ids for the graph ids (e.g. id_0, id_1...). Otherwise, uses $jp.astId whenever possible - * @param options - An object containing configuration options for the cfg - */ - constructor($jp, deterministicIds = false, options = { - /** - * If true, statements of each instruction list must be split - */ - splitInstList: false, - /** - * If true, the nodes that correspond to goto statements will be excluded from the resulting graph - */ - removeGotoNodes: false, - /** - * If true, the nodes that correspond to label statements will be excluded from the resulting graph - */ - removeLabelNodes: false, - /** - * If true, the temporary scope statements will be kept in the resulting graph - */ - keepTemporaryScopeStmts: false, - }) { - this.jp = $jp; - this.splitInstList = options.splitInstList ?? false; - this.removeGotoNodes = options.removeGotoNodes ?? false; - this.removeLabelNodes = options.removeLabelNodes ?? false; - this.keepTemporaryScopeStmts = options.keepTemporaryScopeStmts ?? false; - this.deterministicIds = deterministicIds; - this.currentId = 0; - this.dataFactory = new DataFactory(this.jp); - this.graph = Graphs.newGraph(); - this.nodes = new Map(); - // Create start and end nodes - // Do not add them to #nodes, since they have no associated statements - this.startNode = Graphs.addNode(this.graph, this.dataFactory.newData(CfgNodeType.START, undefined, "start", this.splitInstList)); - this.endNode = Graphs.addNode(this.graph, this.dataFactory.newData(CfgNodeType.END, undefined, "end", this.splitInstList)); - this.temporaryStmts = {}; - this.nextNodes = new NextCfgNode(this.jp, this.nodes, this.endNode); - } - /** - * Returns the next id that will be used to identify a graph node - */ - nextId() { - const nextId = "id_" + this.currentId; - this.currentId++; - return nextId; - } - /** - * Connects two nodes using a directed edge - * @param source - Starting point from which the edge originates - * @param target - Destination point to which the edge points - * @param edgeType - The edge label that connects - */ - addEdge(source, target, edgeType) { - Graphs.addEdge(this.graph, source, target, new CfgEdge(edgeType)); - } - /** - * Builds the control flow graph - * @returns An array that includes the built graph, the nodes, the start and end nodes - */ - build() { - this.addAuxComments(); - this.createNodes(); - //this._fillNodes(); - this.connectNodes(); - this.cleanCfg(); - // TODO: Check graph invariants - // 1. Each node has either one unconditional outgoing edge, - // or two outgoing edges that must be a pair true/false, - // or if there is no outgoing edge must be the end node - return [this.graph, this.nodes, this.startNode, this.endNode]; - } - /** - * Inserts comments that specify the beginning and end of a scope - */ - addAuxComments() { - for (const $currentJp of this.jp.descendants) { - if ($currentJp instanceof Scope) { - const $scopeStart = $currentJp.insertBegin(ClavaJoinPoints.comment("SCOPE_START")); - this.temporaryStmts[$scopeStart.astId] = $scopeStart; - const $scopeEnd = $currentJp.insertEnd(ClavaJoinPoints.comment("SCOPE_END")); - this.temporaryStmts[$scopeEnd.astId] = $scopeEnd; - } - } - } - /** - * Creates all nodes (except start and end), with only the leader statement - */ - createNodes() { - // Test all statements for leadership - // If they are leaders, create node - for (const $stmt of Query.searchFromInclusive(this.jp, Statement)) { - if (CfgUtils.isLeader($stmt)) { - if (this.splitInstList && - CfgUtils.getNodeType($stmt) === CfgNodeType.INST_LIST) { - this.getOrAddNode($stmt, true, CfgNodeType.INST_LIST); - for (const $rightJp of $stmt.siblingsRight) { - const $right = $rightJp; - if (!CfgUtils.isLeader($right)) - this.getOrAddNode($right, true, CfgNodeType.INST_LIST); - else - break; - } - } - else - this.getOrAddNode($stmt, true); - } - } - // Special case: if starting node is a statement and a graph node was not created for it (e.g. creating a graph starting from an arbitrary statement), - // create one with the type INST_LIST - if (this.jp instanceof Statement && - this.nodes.get(this.jp.astId) === undefined) { - this.getOrAddNode(this.jp, true, CfgNodeType.INST_LIST); - } - } - /** - * Connects a node associated with a statement that is an instance of a "if" statement. - * @param node - Node whose type is "IF" - */ - connectIfNode(node) { - const ifStmt = node.data().if; - if (ifStmt === undefined) { - throw new Error("If statement is undefined"); - } - const thenStmt = ifStmt.then; - if (thenStmt === undefined) { - throw new Error("Then statement is undefined"); - } - const thenNode = this.nodes.get(thenStmt.astId); - if (thenNode === undefined) { - throw new Error("Node for then statement is undefined: " + thenStmt.astId); - } - this.addEdge(node, thenNode, CfgEdgeType.TRUE); - const elseStmt = ifStmt.else; - if (elseStmt !== undefined) { - const elseNode = this.nodes.get(elseStmt.astId); - if (elseNode === undefined) { - throw new Error("Node for else statement is undefined: " + elseStmt.astId); - } - this.addEdge(node, elseNode, CfgEdgeType.FALSE); - } - else { - // Usually there should always be a sibling, because of inserted comments - // However, if an arbitary statement is given as the starting point, - // sometimes there might not be nothing after. In this case, connect to the - // end node. - const afterNode = this.nextNodes.nextExecutedNode(ifStmt); - // Add edge - this.addEdge(node, afterNode, CfgEdgeType.FALSE); - } - } - /** - * Connects a node associated with a statement that is an instance of a "loop" statement. - * @param node - Node whose type is "LOOP" - */ - connectLoopNode(node) { - const $loop = node.data().loop; - if ($loop === undefined) { - throw new Error("Loop statement is undefined"); - } - let afterStmt = undefined; - switch ($loop.kind) { - case "for": - afterStmt = $loop.init; - break; - case "while": - afterStmt = $loop.cond; - break; - case "dowhile": - afterStmt = $loop.body; - break; - default: - throw new Error("Case not defined for loops of kind " + $loop.kind); - } - const afterNode = this.nodes.get(afterStmt.astId) ?? this.endNode; - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is part of a loop header and corresponds to the loop condition - * @param node - Node whose type is "COND" - */ - connectCondNode(node) { - // Get kind of loop - const $condStmt = node.data().nodeStmt; - if ($condStmt === undefined) { - throw new Error("Cond statement is undefined"); - } - const $loop = $condStmt.parent; - if ($loop === undefined) { - throw new Error("Loop is undefined"); - } - if (!($loop instanceof Loop)) { - throw new Error("$loop is not an instance of Loop"); - } - // True - first stmt of the loop body - const trueNode = this.nodes.get($loop.body.astId) ?? this.endNode; - this.addEdge(node, trueNode, CfgEdgeType.TRUE); - // False - next stmt of the loop - const falseNode = this.nextNodes.nextExecutedNode($loop); - // Create edge - this.addEdge(node, falseNode, CfgEdgeType.FALSE); - } - /** - * Connects a node associated with a statement that is an instance of a "break" statement. - * @param node - Node whose type is "BREAK" - */ - connectBreakNode(node) { - const $breakStmt = node.data().nodeStmt; - if ($breakStmt === undefined) { - throw new Error("Break statement is undefined"); - } - const $enclosingStmt = $breakStmt.enclosingStmt; - const afterNode = this.nextNodes.nextExecutedNode($enclosingStmt); - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is an instance of a "continue" statement. - * @param node - Node whose type is "CONTINUE" - */ - connectContinueNode(node) { - const $continueStmt = node.data().nodeStmt; - if ($continueStmt === undefined) { - throw new Error("Continue statement is undefined"); - } - const $loop = $continueStmt.getAncestor("loop"); - if ($loop === undefined) { - throw new Error("Loop is undefined"); - } - const $afterStmt = $loop.kind === "for" ? $loop.step : $loop.cond; - const afterNode = this.nodes.get($afterStmt.astId) ?? this.endNode; - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is an instance of a "switch" statement. - * @param node - Node whose type is "SWITCH" - */ - connectSwitchNode(node) { - const $switchStmt = node.data().switch; - if ($switchStmt === undefined) { - throw new Error("Switch statement is undefined"); - } - let firstReachedCase = undefined; - // The first reached case is the first non-default case. - // If the switch only has one case statement, and it is the default case, then this default case will be the first reached case - for (const $case of $switchStmt.cases) { - firstReachedCase = this.nodes.get($case.astId); - if (!$case.isDefault) { - break; - } - } - if (firstReachedCase) { - this.addEdge(node, firstReachedCase, CfgEdgeType.UNCONDITIONAL); - } - } - /** - * Connects a node associated with a statement that is an instance of a "case" statement. - * @param node - Node whose type is "CASE" - */ - connectCaseNode(node) { - const $caseStmt = node.data().case; - if ($caseStmt === undefined) { - throw new Error("Case statement is undefined"); - } - const $switchStmt = $caseStmt.getAncestor("switch"); - if ($switchStmt === undefined) { - throw new Error("Switch statement is undefined"); - } - const numCases = $switchStmt.cases.length; - const hasIntermediateDefault = $switchStmt.hasDefaultCase && !$switchStmt.cases[numCases - 1].isDefault; - // Connect the node to the first instruction to be executed - const firstExecutedInst = this.nextNodes.nextExecutedNode($caseStmt); - if ($caseStmt.isDefault) - this.addEdge(node, firstExecutedInst, CfgEdgeType.UNCONDITIONAL); - else - this.addEdge(node, firstExecutedInst, CfgEdgeType.TRUE); - let falseNode = undefined; - if ($caseStmt.nextCase !== undefined) { - // Not the last case - // If the next case is an intermediate default case, the node should be connected to the CASE node following the default case - if (hasIntermediateDefault && $caseStmt.nextCase.isDefault) - falseNode = this.nodes.get($caseStmt.nextCase.nextCase.astId); - else if (!$caseStmt.isDefault) - // Else, if it is not an intermediate default case, it should be connected to the next case - falseNode = this.nodes.get($caseStmt.nextCase.astId); - } - else if (!$caseStmt.isDefault) { - // Last case but not a default case - // If switch statement has an intermediate default case, connect the current statement to the default case - if (hasIntermediateDefault) - falseNode = this.nodes.get($switchStmt.getDefaultCase.astId); - // Else, connect it to the statement following the switch - else - falseNode = this.nextNodes.nextExecutedNode($switchStmt); - } - if (falseNode !== undefined) - this.addEdge(node, falseNode, CfgEdgeType.FALSE); - } - /** - * Connects a node associated with a statement that is part of a loop header and corresponds to the loop initialization - * @param node - Node whose type is "INIT" - */ - connectInitNode(node) { - const $initStmt = node.data().nodeStmt; - if ($initStmt === undefined) { - throw new Error("Init statement is undefined"); - } - const $loop = $initStmt.parent; - if ($loop === undefined) { - throw new Error("Loop is undefined"); - } - if (!($loop instanceof Loop)) { - throw new Error("$loop is not an instance of Loop"); - } - if ($loop.kind !== "for") { - throw new Error("Not implemented for loops of kind " + $loop.kind); - } - const $condStmt = $loop.cond; - if ($condStmt === undefined) { - throw new Error("Not implemented when for loops do not have a condition statement"); - } - const afterNode = this.nodes.get($condStmt.astId) ?? this.endNode; - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is part of a loop header and corresponds to the loop step - * @param node - Node whose type is "STEP" - */ - connectStepNode(node) { - // Get loop - const $stepStmt = node.data().nodeStmt; - if ($stepStmt === undefined) { - throw new Error("Step statement is undefined"); - } - const $loop = $stepStmt.parent; - if ($loop === undefined) { - throw new Error("Loop is undefined"); - } - if (!($loop instanceof Loop)) { - throw new Error("$loop is not an instance of Loop"); - } - if ($loop.kind !== "for") { - throw new Error("Not implemented for loops of kind " + $loop.kind); - } - const $condStmt = $loop.cond; - if ($condStmt === undefined) { - throw new Error("Not implemented when for loops do not have a condition statement"); - } - const afterNode = this.nodes.get($condStmt.astId) ?? this.endNode; - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * @param node - Node whose type is "INST_LIST" - */ - connectInstListNode(node) { - const $lastStmt = node.data().getLastStmt(); - if ($lastStmt === undefined) { - throw new Error("Last statement is undefined"); - } - const afterNode = this.nextNodes.nextExecutedNode($lastStmt); - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * @param node - Node whose type is "GOTO" - */ - connectGotoNode(node) { - const $gotoStmt = node.data().nodeStmt; - if ($gotoStmt === undefined) { - throw new Error("Goto statement is undefined"); - } - const labelName = $gotoStmt.label.name; - const $labelStmt = Query.searchFromInclusive(this.jp, LabelStmt, { - decl: (decl) => decl.name == labelName, - }).first(); - if ($labelStmt === undefined) { - throw new Error("Label statement is undefined"); - } - const afterNode = this.nodes.get($labelStmt.astId); - if (afterNode === undefined) { - throw new Error("Node for label statement is undefined: " + $labelStmt.astId); - } - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * @param node - Node whose type is "LABEL" - */ - connectLabelNode(node) { - const $labelStmt = node.data().nodeStmt; - if ($labelStmt === undefined) { - throw new Error("Label statement is undefined"); - } - const afterNode = this.nextNodes.nextExecutedNode($labelStmt); - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is an instance of a "return" statement. - * @param node - Node whose type is "RETURN" - */ - connectReturnNode(node) { - this.addEdge(node, this.endNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects a node associated with a statement that is an instance of a "scope" statement. - * @param node - Node whose type is "SCOPE", "THEN" or "ELSE" - */ - connectScopeNode(node) { - const $scope = node.data().scope; - // Scope connects to its own first statement that will be an INST_LIST - const afterNode = this.nodes.get($scope.firstStmt.astId); - if (afterNode === undefined) { - throw new Error("Node for first statement of scope is undefined: " + - $scope.firstStmt.astId); - } - this.addEdge(node, afterNode, CfgEdgeType.UNCONDITIONAL); - } - /** - * Connects the leader statement nodes according to their type - */ - connectNodes() { - // Connect start - let startAstNode = this.jp; - if (startAstNode instanceof FunctionJp) { - startAstNode = startAstNode.body; - } - if (!(startAstNode instanceof Statement)) { - throw new Error("Not defined how to connect the Start node to an AST node of type " + - this.jp.joinPointType); - } - const afterNode = this.nodes.get(startAstNode.astId); - if (afterNode === undefined) { - throw new Error("Node for first statement of scope is undefined: " + startAstNode.astId); - } - // Add edge - this.addEdge(this.startNode, afterNode, CfgEdgeType.UNCONDITIONAL); - for (const astId of this.nodes.keys()) { - const node = this.nodes.get(astId); - if (node === undefined) { - throw new Error("Node is undefined for astId " + astId); - } - const nodeData = node.data(); - const nodeStmt = nodeData.nodeStmt; - if (nodeStmt === undefined) { - throw new Error("Node statement is undefined"); - } - // Only add connections for astIds of leader statements - if (nodeStmt.astId !== astId) { - continue; - } - const nodeType = nodeData.type; - if (nodeType === undefined) { - throw new Error("Node type is undefined: "); - } - switch (nodeType) { - case CfgNodeType.IF: - this.connectIfNode(node); - break; - case CfgNodeType.LOOP: - this.connectLoopNode(node); - break; - case CfgNodeType.COND: - this.connectCondNode(node); - break; - case CfgNodeType.BREAK: - this.connectBreakNode(node); - break; - case CfgNodeType.CONTINUE: - this.connectContinueNode(node); - break; - case CfgNodeType.SWITCH: - this.connectSwitchNode(node); - break; - case CfgNodeType.CASE: - this.connectCaseNode(node); - break; - case CfgNodeType.INIT: - this.connectInitNode(node); - break; - case CfgNodeType.STEP: - this.connectStepNode(node); - break; - case CfgNodeType.INST_LIST: - this.connectInstListNode(node); - break; - case CfgNodeType.GOTO: - this.connectGotoNode(node); - break; - case CfgNodeType.LABEL: - this.connectLabelNode(node); - break; - case CfgNodeType.RETURN: - this.connectReturnNode(node); - break; - case CfgNodeType.SCOPE: - case CfgNodeType.THEN: - case CfgNodeType.ELSE: - this.connectScopeNode(node); - break; - } - } - } - cleanCfg() { - // Remove temporary instructions from the code - if (!this.keepTemporaryScopeStmts) { - for (const stmtId in this.temporaryStmts) { - this.temporaryStmts[stmtId].detach(); - } - } - // Remove temporary instructions from the instList nodes and this.nodes - for (const node of this.nodes.values()) { - const nodeData = node.data(); - // Only inst lists need to be cleaned - if (nodeData.type !== CfgNodeType.INST_LIST) { - const tempStmts = nodeData.stmts.filter(($stmt) => this.temporaryStmts[$stmt.astId] !== undefined); - if (tempStmts.length > 0) { - console.log("Node '" + - nodeData.type.toString() + - "' has temporary stmts: " + - tempStmts.toString()); - } - continue; - } - // Filter stmts that are temporary statements - if (this.keepTemporaryScopeStmts) { - continue; - } - const filteredStmts = []; - for (const $stmt of nodeData.stmts) { - // If not a temporary stmt, add to filtered list - if (this.temporaryStmts[$stmt.astId] === undefined) { - filteredStmts.push($stmt); - } - // Otherwise, remove from this.nodes - else { - this.nodes.delete($stmt.astId); - } - } - if (filteredStmts.length !== nodeData.stmts.length) { - nodeData.stmts = filteredStmts; - } - } - // Remove empty instList CFG nodes - for (const node of this.graph.nodes()) { - const nodeData = node.data(); - // Only nodes that are inst lists - if (nodeData.type !== CfgNodeType.INST_LIST) { - continue; - } - // Only empty nodes - if (nodeData.stmts.length > 0) { - continue; - } - // Remove node, replacing the connections with a new connection of the same type and the incoming edge - // of the node being removed - Graphs.removeNode(this.graph, node, (incoming) => new CfgEdge(incoming.data().type)); - } - // Remove label nodes - if (this.removeLabelNodes) { - for (const node of this.graph.nodes()) { - const nodeData = node.data(); - // Only nodes whose type is "LABEL" - if (nodeData.type !== CfgNodeType.LABEL) - continue; - Graphs.removeNode(this.graph, node, (incoming) => new CfgEdge(incoming.data().type)); - if (nodeData.nodeStmt === undefined) { - throw new Error("Node statement is undefined"); - } - this.nodes.delete(nodeData.nodeStmt.astId); - } - } - // Remove goto nodes - if (this.removeGotoNodes) { - for (const node of this.graph.nodes()) { - const nodeData = node.data(); - // Only nodes whose type is "GOTO" - if (nodeData.type !== CfgNodeType.GOTO) - continue; - Graphs.removeNode(this.graph, node, (incoming) => new CfgEdge(incoming.data().type)); - if (nodeData.nodeStmt === undefined) { - throw new Error("Node statement is undefined"); - } - this.nodes.delete(nodeData.nodeStmt.astId); - } - } - // Remove nodes that have no incoming edge and are not start - for (const node of this.graph.nodes()) { - const nodeData = node.data(); - // Only nodes that are not start - if (nodeData.type === CfgNodeType.START) { - continue; - } - // Ignore nodes with incoming edges - if (node.incomers().length > 0) { - continue; - } - // Remove node - debug("[CfgBuilder] Removing statement that is not executed (e.g. is after a return): " + - nodeData.stmts.toString()); - // Removes nodes. As there are no incoming edges, the edge handler is a dummy as it is not called - Graphs.removeNode(this.graph, node, () => new CfgEdge(CfgEdgeType.UNCONDITIONAL)); - } - } - /** - * Returns the node corresponding to this statement, or creates a new one if one does not exist yet. - */ - getOrAddNode($stmt, create = false, forceNodeType) { - let node = this.nodes.get($stmt.astId); - // If there is not yet a node for this statement, create - if (node === undefined && create) { - const nodeType = forceNodeType ?? CfgUtils.getNodeType($stmt); - if (nodeType === undefined) { - throw new Error("Node type is undefined for statement at line " + $stmt.line); - } - const nodeId = this.deterministicIds ? this.nextId() : undefined; - node = Graphs.addNode(this.graph, this.dataFactory.newData(nodeType, $stmt, nodeId, this.splitInstList)); - // Associate all statements of graph node - for (const $nodeStmt of node.data().stmts) { - // Check if it has not been already added - if (this.nodes.get($nodeStmt.astId) !== undefined) { - throw new Error("Adding mapping twice for statement " + - $nodeStmt.astId + - "@" + - $nodeStmt.location); - } - this.nodes.set($nodeStmt.astId, node); - } - } - else { - throw new Error("No node for statement at line " + $stmt.line); - } - return node; - } -} -//# sourceMappingURL=CfgBuilder.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdge.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdge.js deleted file mode 100644 index 06bd532db0..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdge.js +++ /dev/null @@ -1,35 +0,0 @@ -import EdgeData from "@specs-feup/lara/api/lara/graphs/EdgeData.js"; -import CfgEdgeType from "./CfgEdgeType.js"; -/** - * An edge of the CFG - */ -export default class CfgEdge extends EdgeData { - edgeType; - /** - * Creates a new instance of the CfgEdge class - * @param type - Edge type - */ - constructor(type) { - super(); - this.edgeType = type; - } - /** - * @returns The edge type - */ - get type() { - return this.edgeType; - } - /** - * - * @returns String representation of the edge. If it is a unconditional edge, an empty string is returned - */ - toString() { - // If unconditional jump, do not print a label - if (this.edgeType === CfgEdgeType.UNCONDITIONAL) { - return ""; - } - // Otherwise, return the type name - return this.edgeType.name; - } -} -//# sourceMappingURL=CfgEdge.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdgeType.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdgeType.js deleted file mode 100644 index 4a9fdcb97c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgEdgeType.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Enumeration of CFG edge types. - */ -export default class CfgEdgeType { - static TRUE = new CfgEdgeType("TRUE"); - static FALSE = new CfgEdgeType("FALSE"); - static UNCONDITIONAL = new CfgEdgeType("UNCONDITIONAL"); - instanceName; - /** - * Creates a new instance of the CfgEdgeType class - * @param name - The name of the CFG edge type - */ - constructor(name) { - this.instanceName = name; - } - /** - * @returns The name of the CFG edge type - */ - get name() { - return this.instanceName; - } - /** - * @returns String representation of the CFG edge type, which corresponds to its name - */ - toString() { - return this.name; - } -} -//# sourceMappingURL=CfgEdgeType.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeData.js deleted file mode 100644 index ca9632c398..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeData.js +++ /dev/null @@ -1,68 +0,0 @@ -import NodeData from "@specs-feup/lara/api/lara/graphs/NodeData.js"; -/** - * The data of a CFG node. - */ -export default class CfgNodeData extends NodeData { - /** - * The statement join point of the CFG node - */ - nodeStmt; - nodeType; - nodeName; - /** - * Creates a new instance of the CfgNodeData class - * @param cfgNodeType - Node type - * @param $stmt - Statement that originated this CFG node - * @param id - Identification of the CFG node - */ - constructor(cfgNodeType, $stmt, id = $stmt?.astId) { - // If id defined, give priority to it. Othewise, use stmt astId, if defined - const _id = id !== undefined ? id : $stmt === undefined ? undefined : $stmt.astId; - // Use AST node id as graph node id - super(_id); - this.nodeStmt = $stmt; - this.nodeType = cfgNodeType; - } - /** - * @returns The CFG node type - */ - get type() { - return this.nodeType; - } - /** - * @returns The CFG node name - */ - get name() { - if (this.nodeName === undefined) { - const typeName = this.nodeType.name; - this.nodeName = - typeName.substring(0, 1).toUpperCase() + - typeName.substring(1, typeName.length).toLowerCase(); - } - return this.nodeName; - } - /** - * @returns The statements associated with this CFG node. - */ - get stmts() { - // By default, the list only containts the node statement - return this.nodeStmt !== undefined ? [this.nodeStmt] : []; - } - /** - * - * @returns String representation of the CFG node - */ - toString() { - // By default, content of the node is the name of the type - return this.name; - } - /** - * - * @returns True if this is a branch node, false otherwise. If this is a branch node, contains two edges, true and false. - * If not, contains only one uncoditional edge (expect if it is the end node, which contains no edges). - */ - isBranch() { - return false; - } -} -//# sourceMappingURL=CfgNodeData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeType.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeType.js deleted file mode 100644 index d28184de8f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgNodeType.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Enumeration of CFG node types. - */ -export default class CfgNodeType { - static START = new CfgNodeType("START"); - static END = new CfgNodeType("END"); - static IF = new CfgNodeType("IF"); - static THEN = new CfgNodeType("THEN"); - static ELSE = new CfgNodeType("ELSE"); - static LOOP = new CfgNodeType("LOOP"); - static COND = new CfgNodeType("COND"); - static INIT = new CfgNodeType("INIT"); - static STEP = new CfgNodeType("STEP"); - static SCOPE = new CfgNodeType("SCOPE"); - static INST_LIST = new CfgNodeType("INST_LIST"); - static BREAK = new CfgNodeType("BREAK"); - static CONTINUE = new CfgNodeType("CONTINUE"); - static SWITCH = new CfgNodeType("SWITCH"); - static CASE = new CfgNodeType("CASE"); - static GOTO = new CfgNodeType("GOTO"); - static LABEL = new CfgNodeType("LABEL"); - static RETURN = new CfgNodeType("RETURN"); - nameStr; - /** - * Creates a new instance of the CfgNodeType class - * @param name - The name of the CFG node type - */ - constructor(name) { - this.nameStr = name; - } - /** - * @returns The name of the CFG node type - */ - get name() { - return this.nameStr; - } - /** - * - * @returns String representation of the CFG node type, which corresponds to its name - */ - toString() { - return this.name; - } -} -//# sourceMappingURL=CfgNodeType.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgUtils.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgUtils.js deleted file mode 100644 index 726f43274d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/CfgUtils.js +++ /dev/null @@ -1,122 +0,0 @@ -import { Break, Case, Continue, GotoStmt, If, LabelStmt, Loop, ReturnStmt, Scope, Switch, } from "../../../Joinpoints.js"; -import CfgNodeType from "./CfgNodeType.js"; -export default class CfgUtils { - /** - * @param $stmt - The statement join point - * @returns True if the statement is considered a leader - */ - static isLeader($stmt) { - const graphNodeType = CfgUtils.getNodeType($stmt); - return graphNodeType !== undefined; - } - /** - * Returns the type of graph node based on the type of the leader statement. If this statement is not a leader, returns undefined - * @param $stmt - The statement join point - */ - static getNodeType($stmt) { - if ($stmt instanceof If) { - return CfgNodeType.IF; - } - // Loop stmt - if ($stmt instanceof Loop) { - return CfgNodeType.LOOP; - } - // Break stmt - if ($stmt instanceof Break) { - return CfgNodeType.BREAK; - } - // Continue stmt - if ($stmt instanceof Continue) { - return CfgNodeType.CONTINUE; - } - // Switch stmt - if ($stmt instanceof Switch) { - return CfgNodeType.SWITCH; - } - //Case stmt - if ($stmt instanceof Case) { - return CfgNodeType.CASE; - } - // Goto stmt - if ($stmt instanceof GotoStmt) { - return CfgNodeType.GOTO; - } - // Label stmt - if ($stmt instanceof LabelStmt) { - return CfgNodeType.LABEL; - } - // Return stmt - if ($stmt instanceof ReturnStmt) { - return CfgNodeType.RETURN; - } - // Stmt is part of loop header - if ($stmt.isInsideLoopHeader) { - const $loop = $stmt.parent; - if (!($loop instanceof Loop)) { - throw new Error("Statement is inside loop header but parent is not a loop: " + - $stmt.code); - } - if ($stmt.equals($loop.init)) { - return CfgNodeType.INIT; - } - else if ($stmt.equals($loop.cond)) { - return CfgNodeType.COND; - } - else if ($stmt.equals($loop.step)) { - return CfgNodeType.STEP; - } - else { - throw new Error("Statement is in the header of loop at " + - $loop.location + - " but could not identify what part of the header: " + - $stmt.code); - } - } - // Scope stmt - if ($stmt instanceof Scope) { - const parent = $stmt.parent; - if (parent instanceof If) { - if ($stmt.equals(parent.then)) { - return CfgNodeType.THEN; - } - else if ($stmt.equals(parent.else)) { - return CfgNodeType.ELSE; - } - } - return CfgNodeType.SCOPE; - } - // If is the first statement of a scope and is not any of the other type of statements, - // consider the beginning of an INST_LIST - const $stmtParent = $stmt.parent; - if ($stmtParent instanceof Scope && $stmt.equals($stmtParent.firstStmt)) { - return CfgNodeType.INST_LIST; - } - const left = $stmt.siblingsLeft; - if (left.length > 0) { - const lastLeft = left[left.length - 1]; - const leftNodeType = CfgUtils.getNodeType(lastLeft); - if (leftNodeType !== undefined && - leftNodeType !== CfgNodeType.INST_LIST) { - return CfgNodeType.INST_LIST; - } - } - return undefined; - } - static getTarget(node, edgeType) { - let target = undefined; - for (const edge of node.connectedEdges()) { - // Only targets of this node - if (edge.source() !== node) { - continue; - } - if (edge.data().type === edgeType) { - if (target !== undefined) { - throw new Error(`Found duplicated edge of type '${edgeType.toString()}' in node ${node.data()}`); - } - target = edge.target(); - } - } - return target; - } -} -//# sourceMappingURL=CfgUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/NextCfgNode.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/NextCfgNode.js deleted file mode 100644 index 85513dde3b..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/NextCfgNode.js +++ /dev/null @@ -1,120 +0,0 @@ -import { Case, FunctionJp, If, Loop, Scope, Statement, } from "../../../Joinpoints.js"; -export default class NextCfgNode { - /** - * The AST node to process - */ - entryPoint; - /** - * Maps stmts to graph nodes - */ - nodes; - /** - * The end node of the graph - */ - endNode; - constructor($entryPoint, nodes, endNode) { - this.entryPoint = $entryPoint; - this.nodes = nodes; - this.endNode = endNode; - } - /** - * - * @param $stmt - - * - * @returns the next graph node that executes unconditionally after the given stmt, or end node if no statement is executed - */ - nextExecutedNode($stmt) { - const afterStmt = this.nextExecutedStmt($stmt); - // If after statement is undefined, return end node - if (afterStmt === undefined) { - return this.endNode; - } - // Get node corresponding to the after statement - const afterNode = this.nodes.get(afterStmt.astId); - // If the statement does not have an associated node, this means the next node is out of scope and should be considered the end node - if (afterNode === undefined) { - return this.endNode; - } - return afterNode; - } - /** - * @returns The next stmt that executes unconditionally after the given stmt, of undefined if no statement is executed - */ - nextExecutedStmt($stmt) { - // By definition, there is no statement executed after the entry point - if ($stmt.equals(this.entryPoint)) { - return undefined; - } - // If stmt is a scope, there are several special cases - if ($stmt instanceof Scope) { - return this.nextExecutedStmtAfterScope($stmt); - } - const rightStmts = $stmt.siblingsRight; - // If there are statements to the right, the rightmost non-case statement is the next to be executed - if (rightStmts.length > 0) { - for (const sibling of rightStmts) { - if (!(sibling instanceof Case)) - return sibling; - } - } - // When there are no more statements, return what's next for the parent - const $parent = $stmt.parent; - if ($parent instanceof Statement) { - return this.nextExecutedStmt($parent); - } - // There are no more statements - else if ($parent instanceof FunctionJp) { - return undefined; - } - else { - throw new Error("Case not defined for nodes with parent of type " + - $parent.joinPointType); - } - } - /** - * @returns The the next stmt that executes unconditionally after the given scope, of undefined if no statement is executed - */ - nextExecutedStmtAfterScope($scope) { - // Before returning what's next to the scope of the statement, there are some special cases - // Check if scope is a then/else of an if - const $scopeParent = $scope.parent; - if ($scopeParent instanceof If) { - // Next stmt is what comes next of if - return this.nextExecutedStmt($scopeParent); - } - // Check if scope is the body of a loop - if ($scopeParent instanceof Loop) { - // Next stmt is what comes next of if - switch ($scopeParent.kind) { - case "while": - case "dowhile": - if ($scopeParent.cond === undefined) { - throw new Error("Not implemented when for loops do not have a condition statement"); - } - return $scopeParent.cond; - case "for": - if ($scopeParent.step === undefined) { - throw new Error("Not implemented when for loops do not have a step statement"); - } - return $scopeParent.step; - default: - throw new Error("Case not defined for loops of kind " + $scopeParent.kind); - } - } - // Special cases handled, check scope siblings - const rightStmts = $scope.siblingsRight; - // If there are statements, return next of parent - if (rightStmts.length > 0) { - return rightStmts[0]; - } - // If scope parent is not a statement, there is no next statement - if ($scopeParent instanceof Statement) { - // Return next statement of parent statement - return this.nextExecutedStmt($scopeParent); - } - else { - return undefined; - } - } -} -//# sourceMappingURL=NextCfgNode.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/CaseData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/CaseData.js deleted file mode 100644 index 49665a7147..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/CaseData.js +++ /dev/null @@ -1,23 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class CaseData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.CASE, $stmt, id); - } - get case() { - return this.nodeStmt; - } - toString() { - if (this.case === undefined) { - return super.toString(); - } - if (this.case.isDefault) { - return "default"; - } - return "case " + this.case.values.map((value) => value.code).join(" || "); - } - isBranch() { - return true; - } -} -//# sourceMappingURL=CaseData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/DataFactory.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/DataFactory.js deleted file mode 100644 index 800e33c218..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/DataFactory.js +++ /dev/null @@ -1,74 +0,0 @@ -import { Case, GotoStmt, If, LabelStmt, Loop, ReturnStmt, Scope, Switch, } from "../../../../Joinpoints.js"; -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -import CaseData from "./CaseData.js"; -import GotoData from "./GotoData.js"; -import HeaderData from "./HeaderData.js"; -import IfData from "./IfData.js"; -import InstListNodeData from "./InstListNodeData.js"; -import LabelData from "./LabelData.js"; -import LoopData from "./LoopData.js"; -import ReturnData from "./ReturnData.js"; -import ScopeNodeData from "./ScopeNodeData.js"; -import SwitchData from "./SwitchData.js"; -export default class DataFactory { - entryPoint; - constructor($entryPoint) { - this.entryPoint = $entryPoint; - } - newData(cfgNodeType, $stmt, id, splitInstList) { - switch (cfgNodeType) { - case CfgNodeType.INST_LIST: - return new InstListNodeData($stmt, id, this.entryPoint, splitInstList); - case CfgNodeType.THEN: - case CfgNodeType.ELSE: - case CfgNodeType.SCOPE: - if (!($stmt instanceof Scope)) { - throw new Error("Expected statement to be a Scope"); - } - return new ScopeNodeData($stmt, cfgNodeType, id); - case CfgNodeType.INIT: - case CfgNodeType.COND: - case CfgNodeType.STEP: - return new HeaderData($stmt, cfgNodeType, id); - case CfgNodeType.IF: - if (!($stmt instanceof If)) { - throw new Error("Expected statement to be an If statement"); - } - return new IfData($stmt, id); - case CfgNodeType.LOOP: - if (!($stmt instanceof Loop)) { - throw new Error("Expected statement to be a Loop"); - } - return new LoopData($stmt, id); - case CfgNodeType.SWITCH: - if (!($stmt instanceof Switch)) { - throw new Error("Expected statement to be a Switch"); - } - return new SwitchData($stmt, id); - case CfgNodeType.CASE: - if (!($stmt instanceof Case)) { - throw new Error("Expected statement to be a Case"); - } - return new CaseData($stmt, id); - case CfgNodeType.GOTO: - if (!($stmt instanceof GotoStmt)) { - throw new Error("Expected statement to be a GotoStmt"); - } - return new GotoData($stmt, id); - case CfgNodeType.LABEL: - if (!($stmt instanceof LabelStmt)) { - throw new Error("Expected statement to be a LabelStmt"); - } - return new LabelData($stmt, id); - case CfgNodeType.RETURN: - if (!($stmt instanceof ReturnStmt)) { - throw new Error("Expected statement to be a Return Statement"); - } - return new ReturnData($stmt, id); - default: - return new CfgNodeData(cfgNodeType, $stmt, id); - } - } -} -//# sourceMappingURL=DataFactory.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/GotoData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/GotoData.js deleted file mode 100644 index 2f091d2626..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/GotoData.js +++ /dev/null @@ -1,17 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class GotoData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.GOTO, $stmt, id); - } - get goto() { - return this.nodeStmt; - } - toString() { - if (this.goto === undefined) { - return super.toString(); - } - return this.goto.code; - } -} -//# sourceMappingURL=GotoData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/HeaderData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/HeaderData.js deleted file mode 100644 index 219c700527..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/HeaderData.js +++ /dev/null @@ -1,20 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class HeaderData extends CfgNodeData { - constructor($stmt, nodeType, id) { - super(nodeType, $stmt, id); - } - toString() { - if (this.nodeStmt === undefined) { - return super.toString(); - } - return this.name + ": " + this.nodeStmt.code; - } - isBranch() { - if (this.type === CfgNodeType.COND) { - return true; - } - return false; - } -} -//# sourceMappingURL=HeaderData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/IfData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/IfData.js deleted file mode 100644 index 34fc65d2c5..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/IfData.js +++ /dev/null @@ -1,20 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class IfData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.IF, $stmt, id); - } - get if() { - return this.nodeStmt; - } - toString() { - if (this.if === undefined) { - return super.toString(); - } - return "if(" + this.if.cond.code + ")"; - } - isBranch() { - return true; - } -} -//# sourceMappingURL=IfData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/InstListNodeData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/InstListNodeData.js deleted file mode 100644 index 5f72ec0200..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/InstListNodeData.js +++ /dev/null @@ -1,53 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -import CfgUtils from "../CfgUtils.js"; -export default class InstListNodeData extends CfgNodeData { - stmtArray = []; - constructor($stmt, id, $entryPoint, splitInstList) { - super(CfgNodeType.INST_LIST, $stmt, id); - // Given statement is start of the list - if ($stmt !== undefined) { - this.stmtArray.push($stmt); - if (!splitInstList) { - // Add non-leader statements corresponding to this list, unless this node is the starting point - const rightNodes = !$stmt.equals($entryPoint) - ? $stmt.siblingsRight - : []; - for (const $jp of rightNodes) { - const $right = $jp; - if (!CfgUtils.isLeader($right)) { - this.stmtArray.push($right); - } - else { - break; - } - } - } - } - } - /** - * Returns all the statements of this instruction list. - */ - get stmts() { - return this.stmtArray; - } - set stmts(stmts) { - this.stmtArray = stmts; - // When setting statements, the base statement changes to the first of the new list - this.nodeStmt = this.stmtArray.length > 0 ? this.stmtArray[0] : undefined; - } - getLastStmt() { - if (this.stmtArray.length === 0) { - return undefined; - } - return this.stmtArray[this.stmtArray.length - 1]; - } - toString() { - let code = ""; - for (const $stmt of this.stmtArray) { - code += $stmt.code + "\n"; - } - return code; - } -} -//# sourceMappingURL=InstListNodeData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LabelData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LabelData.js deleted file mode 100644 index 5ec4e67fa5..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LabelData.js +++ /dev/null @@ -1,17 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class LabelData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.LABEL, $stmt, id); - } - get label() { - return this.nodeStmt; - } - toString() { - if (this.label === undefined) { - return super.toString(); - } - return this.label.code; - } -} -//# sourceMappingURL=LabelData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LoopData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LoopData.js deleted file mode 100644 index 015ad19405..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/LoopData.js +++ /dev/null @@ -1,17 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class LoopData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.LOOP, $stmt, id); - } - get loop() { - return this.nodeStmt; - } - toString() { - if (this.loop === undefined) { - return super.toString(); - } - return `Loop: ${this.loop.kind}`; - } -} -//# sourceMappingURL=LoopData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ReturnData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ReturnData.js deleted file mode 100644 index 1965c4b2ca..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ReturnData.js +++ /dev/null @@ -1,15 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class ReturnData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.RETURN, $stmt, id); - } - get returnStmt() { - return this.nodeStmt; - } - toString() { - const returnExpr = this.returnStmt?.returnExpr; - return ("return" + (returnExpr === undefined ? "" : " " + returnExpr.code) + ";"); - } -} -//# sourceMappingURL=ReturnData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ScopeNodeData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ScopeNodeData.js deleted file mode 100644 index 1edd3c043c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/ScopeNodeData.js +++ /dev/null @@ -1,13 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class ScopeNodeData extends CfgNodeData { - scopeStmt; - constructor($scope, nodeType = CfgNodeType.SCOPE, id) { - super(nodeType, $scope, id); - this.scopeStmt = $scope; - } - get scope() { - return this.scopeStmt; - } -} -//# sourceMappingURL=ScopeNodeData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/SwitchData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/SwitchData.js deleted file mode 100644 index 3324dd195f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/cfg/nodedata/SwitchData.js +++ /dev/null @@ -1,20 +0,0 @@ -import CfgNodeData from "../CfgNodeData.js"; -import CfgNodeType from "../CfgNodeType.js"; -export default class SwitchData extends CfgNodeData { - constructor($stmt, id) { - super(CfgNodeType.SWITCH, $stmt, id); - } - get switch() { - return this.nodeStmt; - } - toString() { - if (this.switch === undefined) { - return super.toString(); - } - return "switch(" + this.switch.condition.code + ")"; - } - isBranch() { - return true; - } -} -//# sourceMappingURL=SwitchData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgEdgeData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgEdgeData.js deleted file mode 100644 index 0380012438..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgEdgeData.js +++ /dev/null @@ -1,17 +0,0 @@ -import EdgeData from "@specs-feup/lara/api/lara/graphs/EdgeData.js"; -export default class ScgEdgeData extends EdgeData { - /** - * The calls that contributed to this edge - */ - $calls = []; - get calls() { - return this.$calls; - } - inc($call) { - this.$calls.push($call); - } - toString() { - return this.$calls.length.toString(); - } -} -//# sourceMappingURL=ScgEdgeData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgNodeData.js b/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgNodeData.js deleted file mode 100644 index 1fa1f996ce..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/ScgNodeData.js +++ /dev/null @@ -1,30 +0,0 @@ -import NodeData from "@specs-feup/lara/api/lara/graphs/NodeData.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call } from "../../../Joinpoints.js"; -export default class ScgNodeData extends NodeData { - /** - * The function represented by this node - */ - $function; - constructor($function) { - super(); - // Should use only canonical functions - this.$function = $function.canonical; - } - get function() { - return this.$function; - } - toString() { - return this.$function.signature; - } - /** - * @returns true, if the function represented by this node has an available implementation, false otherwise - */ - hasImplementation() { - return this.$function.isImplementation; - } - hasCalls() { - return Query.searchFrom(this.$function, Call).get().length > 0; - } -} -//# sourceMappingURL=ScgNodeData.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/StaticCallGraphBuilder.js b/ClavaLaraApi/src-lara/clava/clava/graphs/scg/StaticCallGraphBuilder.js deleted file mode 100644 index 8e5cadea0a..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/graphs/scg/StaticCallGraphBuilder.js +++ /dev/null @@ -1,126 +0,0 @@ -import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FunctionJp } from "../../../Joinpoints.js"; -import ScgEdgeData from "./ScgEdgeData.js"; -import ScgNodeData from "./ScgNodeData.js"; -export default class StaticCallGraphBuilder { - /** - * The static call graph - */ - graph = Graphs.newGraph(); - /** - * Maps AST nodes to graph nodes - */ - nodesMap = {}; - /** - * Maps function-\>function relations to edges - */ - edgesMap = {}; - nodeCounter = 0; - get nodes() { - return this.nodesMap; - } - addOrGetNode($function) { - let graphNode = this.nodesMap[$function.astId]; - // If not found, create and add it - if (graphNode === undefined) { - const nodeData = new ScgNodeData($function); - nodeData.id = this.newNodeId(); - graphNode = Graphs.addNode(this.graph, nodeData); - this.nodesMap[$function.astId] = graphNode; - } - return graphNode; - } - newNodeId() { - const id = "node_" + this.nodeCounter; - this.nodeCounter++; - return id; - } - /** - * - * @param $jp - - * @param visitCalls - If true, recursively visits the functions of each call, building a call graph of the available code - * @returns - */ - build($jp, visitCalls = true) { - // If undefined, assume root - if ($jp === undefined) { - $jp = Query.root(); - } - // Get function->call relations - const pairs = this.getFunctionCallPairs($jp, visitCalls); - // Add nodes and edges - for (const pair of pairs) { - const $sourceFunction = pair["function"]; - const $call = pair["call"]; - const $targetFunction = $call.function; // Already canonical function - const sourceNode = this.addOrGetNode($sourceFunction); - const targetNode = this.addOrGetNode($targetFunction); - this.addEdge(sourceNode, targetNode, $call); - } - return this.graph; - } - static getEdgeId(sourceNode, targetNode) { - return (sourceNode.data().function.signature + - "$" + - targetNode.data().function.signature); - } - addEdge(sourceNode, targetNode, $call) { - const edgeId = StaticCallGraphBuilder.getEdgeId(sourceNode, targetNode); - let edge = this.edgesMap[edgeId]; - if (edge === undefined) { - const edgeData = new ScgEdgeData(); - edgeData.id = edgeId; - edge = Graphs.addEdge(this.graph, sourceNode, targetNode, edgeData); - this.edgesMap[edgeId] = edge; - } - // Increment edge value - edge.data().inc($call); - } - getFunctionCallPairs($jp, visitCalls) { - const pairs = []; - const seenFunctions = new Set(); - let jpsToSearch = [$jp]; - while (jpsToSearch.length > 0) { - const seenCalls = []; - // Check if any of the jps to search is a call - for (const $jp of jpsToSearch) { - if ($jp instanceof Call) { - seenCalls.push($jp); - } - } - for (const $jpToSearch of jpsToSearch) { - // Get all function/call pairs for functions that are not yet in the seen functions - const functionCall = Query.searchFromInclusive($jpToSearch, FunctionJp, (self) => !seenFunctions.has(self.signature)) - .search(Call) - .chain(); - for (const pair of functionCall) { - const $function = pair["function"]; - const $call = pair["call"]; - seenFunctions.add($function.signature); - pairs.push({ function: $function, call: $call }); - seenCalls.push($call); - } - } - // Calculate new jps to search - jpsToSearch = []; - if (visitCalls) { - for (const $call of seenCalls) { - const $functionDef = $call.definition; - // Only visit if there is a definition - if ($functionDef === undefined) { - continue; - } - // Check if already visited - if (seenFunctions.has($functionDef.signature)) { - continue; - } - // Add function - jpsToSearch.push($functionDef); - } - } - } - return pairs; - } -} -//# sourceMappingURL=StaticCallGraphBuilder.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/hdf5/Hdf5.js b/ClavaLaraApi/src-lara/clava/clava/hdf5/Hdf5.js deleted file mode 100644 index 79e01ec493..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/hdf5/Hdf5.js +++ /dev/null @@ -1,166 +0,0 @@ -import { ArrayType, EnumType, TemplateSpecializationType, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import Format from "../Format.js"; -var HDF5Types; -(function (HDF5Types) { - HDF5Types["char"] = "C_S1"; - HDF5Types["signed char"] = "NATIVE_SCHAR"; - HDF5Types["unsigned char"] = "NATIVE_UCHAR"; - HDF5Types["short"] = "NATIVE_SHORT"; - HDF5Types["unsigned short"] = "NATIVE_USHORT"; - HDF5Types["int"] = "NATIVE_INT"; - HDF5Types["unsigned int"] = "NATIVE_UINT"; - HDF5Types["long"] = "NATIVE_LONG"; - HDF5Types["unsigned long"] = "NATIVE_ULONG"; - HDF5Types["long long"] = "NATIVE_LLONG"; - HDF5Types["unsigned long long"] = "NATIVE_ULLONG"; - HDF5Types["float"] = "NATIVE_FLOAT"; - HDF5Types["double"] = "NATIVE_DOUBLE"; - HDF5Types["long double"] = "NATIVE_LDOUBLE"; - HDF5Types["int8_t"] = "NATIVE_INT8"; - HDF5Types["uint8_t"] = "NATIVE_UINT8"; - HDF5Types["int16_t"] = "NATIVE_INT16"; - HDF5Types["uint16_t"] = "NATIVE_UINT16"; - HDF5Types["int32_t"] = "NATIVE_INT32"; - HDF5Types["uin32_t"] = "NATIVE_UINT32"; - HDF5Types["int64_t"] = "NATIVE_INT64"; - HDF5Types["uint64_t"] = "NATIVE_UINT64"; -})(HDF5Types || (HDF5Types = {})); -/** - * Utility methods related to the HDF5 library. - * - */ -export default class Hdf5 { - /** - * @returns A String with the HDF5 code that represents the given type. - */ - static convert($type) { - // Desugar type - $type = $type.desugarAll; - // Special case: char[size] - if ($type instanceof ArrayType) { - const $elementType = $type.elementType; - if ($elementType.code === "char") { - return `H5::StrType(H5::PredType::C_S1, ${$type.arraySize})`; - } - console.log(` -> Warning! HDF5 type not defined for C/C++ arrays of type: ${$elementType.toString()}`); - return undefined; - } - // Special case: enum - if ($type instanceof EnumType) { - return Hdf5.convert($type.integerType); - } - // Special case: unique_ptr - if ($type instanceof TemplateSpecializationType && - $type.templateName === "unique_ptr") { - // Generate code for the parameter - return Hdf5.convert($type.firstArgType); - } - // Special case: vector - if ($type instanceof TemplateSpecializationType && - $type.templateName === "vector") { - // Convert template type - return `H5::VarLenType('&${Hdf5.convert($type.firstArgType)}')`; - } - const cType = $type.code; - const HDF5Type = HDF5Types[cType]; - if (HDF5Type === undefined) { - console.log(`TYPE NAME -> ${$type.kind}`); - console.log(`TYPE -> ${$type.ast}`); - console.log(` -> Warning! HDF5 type not defined for C/C++ type: ${cType}`); - return undefined; - } - // Common HDF5Type - return "H5::PredType::" + HDF5Type; - } - /** - * @param $records - An array of $record join points which will be used to generate a library with HDF5 conversors for those records. - * @returns An array with $file join points, representing the files of the newly created library. - */ - static toLibrary($records) { - const namespace = "hdf5type"; - // Folder for the generated files - const filepath = "generated-hdf5"; - // Create files for generated code - const $compTypeC = ClavaJoinPoints.file("CompType.cpp", filepath); - const $compTypeH = ClavaJoinPoints.file("CompType.h", filepath); - let hDeclarationsCode = ""; - // Add include for CompTypes - $compTypeC.addInclude("CompType.h", false); - $compTypeC.addInclude("H5CompType.h", true); - for (const $record of $records) { - const $file = $record.getAncestor("file"); - if ($file === undefined) { - console.log(` -> Warning! Record '${$record.name}' has no file`); - continue; - } - const className = $record.name + "Type"; - const typeName = "itype"; - /* Generate code for .h file */ - // Create declaration - hDeclarationsCode += Hdf5.Hdf5_HDeclaration($file.name, className); - /* Generate code for .cpp file */ - // Add include to the file where record is - $compTypeC.addIncludeJp($record); - // Create code for translating C/C++ type to HDF5 type - const recordCode = Hdf5.convertRecord($record, typeName); - const cxxFunction = Hdf5.Hdf5_CImplementation(namespace, className, Format.addPrefix(recordCode, " ")); - $compTypeC.insertAfter(ClavaJoinPoints.declLiteral(cxxFunction)); - } - /* Generate code for .h file */ - // Add include to HDF5 CPP library - $compTypeH.addInclude("H5Cpp.h", true); - // Create header code inside the target namespace - hDeclarationsCode = - "\nnamespace " + - namespace + - " {\n\n" + - Format.addPrefix(hDeclarationsCode, " ") + - "\n}\n"; - // Insert code inside header file - $compTypeH.insertAfter(ClavaJoinPoints.declLiteral(hDeclarationsCode)); - // Create return array - const $files = [$compTypeH, $compTypeC]; - return $files; - } - static Hdf5_HDeclaration(filename, className) { - return ` -// ${filename} -class ${className} { - public: - static H5::CompType GetCompType(); -}; - -`; - } - static Hdf5_CImplementation(namespace, className, body) { - return ` -H5::CompType ${namespace}::${className}::GetCompType() { -${body} - - return itype; -} - -`; - } - /** - * @returns String representing the HDF5 conversion code for the given record - */ - static convertRecord($record, typeName) { - const recordName = $record.qualifiedName; - let code = `H5::CompType ${typeName}(sizeof(${recordName}));\n`; - for (const $field of $record.fields) { - if ($field.type.constant) - continue; // Ignore constant fields - if (!$field.isPublic) - continue; // Ignore private fields - const fieldName = $field.name; - const HDF5Type = Hdf5.convert($field.type); - if (HDF5Type === undefined) - continue; // Warning message omitted for the example - code += `${typeName}.insertMember("${fieldName}",offsetof(${recordName}, ${fieldName}), ${HDF5Type});\n`; - } - return code; - } -} -//# sourceMappingURL=Hdf5.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/hls/HLSAnalysis.js b/ClavaLaraApi/src-lara/clava/clava/hls/HLSAnalysis.js deleted file mode 100644 index 157ec4ba58..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/hls/HLSAnalysis.js +++ /dev/null @@ -1,106 +0,0 @@ -import { unwrapJoinPoint } from "@specs-feup/lara/api/LaraJoinPoint.js"; -import ClavaJavaTypes from "../ClavaJavaTypes.js"; -export default class HLSAnalysis { - /** - * Applies a set of Vivado HLS directives to a provided function using a set - * of strategies to select and configure those directives. This function applies the - * main optimization flow, which is comprised of the following strategies, by this order: - * - Function Inlining - * - Array Streaming - * - Loop strategies (loop unrolling, pipelining and array partitioning) - * For a description of how each strategy works, as well as for a standalone version of - * each of these strategies, please consult the other methods of this class. - * - * @param func - A JoinPoint of the function to analyze - * @param options - An optional argument to specify the HLS options. The format - * is the following: \{"B": 2, "N": 32, "P": 64\} - * If not specified, the compiler will use the values provided in the example above. - * - */ - static applyGenericStrategies(func, options = {}) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyGenericStrategies(unwrapJoinPoint(func), JSON.stringify(options)); - } - /** - * Applies the function inlining directive to every called function. - * It works by calculating the cost of both the called function and the callee, - * in which cost is defined as the total number of array loads on the total lifetime - * of the function. This is then fed to the formula: - * - * calleeCost \> (callFrequency * calledCost) / B - * - * If this function is true, the function is inlined. Factor B is configurable, and allows - * for this formula to be more restrictive/permissive, based on the user's needs. The - * default value is 2. - * - * - * @param func - A JoinPoint of the function to analyze - * @param B - A positive real number to control the heuristic's aggressiveness - * */ - static applyFunctionInlining(func, B) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyFunctionInlining(unwrapJoinPoint(func), B.toString()); - } - /** - * This strategy analyzes every input/output array of the function, and - * tries to see if they can be implemented as a FIFO. To do this, the strategy - * makes a series of checks to see whether the array can be implemented as such. - * These checks are: - * - Check if the array only has either loads or stores operations - * - Check if the array is always accessed sequentially (limited by the information - * available at compile time) - * - Check whether each array position is accessed only once during the entire function - * lifetime - * If all these checks apply, the array is implemented as a FIFO using a Vivado HLS directive. - * - * @param func - A JoinPoint of the function to analyze - * */ - static applyArrayStreaming(func) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyArrayStreaming(unwrapJoinPoint(func)); - } - /** - * Analyzes every loop nest of a function and applies loop optimizations. These - * optimizations are a combination of loop unrolling and loop pipelining. For the latter - * to be efficient, array partitioning is also applied. This strategy works by always - * unrolling the innermost loop of every nest, with a resource limitation directive to - * prevent excessive resource usage. Then, if the number of iterations of the outermost - * loop is less than 4, that loop is also unrolled, and so on. However, this is an edge case, - * since this rarely happens; the outermost loop is, instead, pipelined. The array partitioning - * is done in two ways: if an array is less than 4096 bytes, it is mapped into registers; otherwise, - * it is partitioned into P partitions using a cyclic strategy. - * - * - * @param func - A JoinPoint of the function to analyze - * @param P - The number of partitions to use. 64 is the default. - * */ - static applyLoopStrategies(func, P) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyLoopStrategies(unwrapJoinPoint(func), P.toString()); - } - /** - * Applies the load/stores strategy to simple loops. A simple loop is defined as - * a function with only one loop with no nests, and in which every array is either only - * loaded from or stored to in each iteration. This method can validate whether the provided - * function is a simple loop or not. If it is one, then it applies three HLS directives in tandem: - * it unrolls the loop by a factor N (called the load/stores factor), it partitions each array by - * that same factor N using a cyclic strategy and finally it pipelines the loop. This strategy is - * better than the other generic strategies for this type of function. Generally, larger values lead - * to a better speedup, although there are exceptions. Therefore, it is recommended for users to - * experiment with different values if results are unsatisfactory (the default value is 32). - * - * - * @param func - A JoinPoint of the function to analyze - * @param N - A positive integer value for the load/stores factor - * */ - static applyLoadStoresStrategy(func, N) { - ClavaJavaTypes.HighLevelSynthesisAPI.applyLoadStoresStrategy(unwrapJoinPoint(func), N.toString()); - } - /** - * Checks whether a function can be instrumented. Only workds for old versions - * of the trace2c tool. - * - * @param func - A JoinPoint of the function to analyze - * @returns Whether the function can be or not instrumented - * */ - static canBeInstrumented(func) { - return ClavaJavaTypes.HighLevelSynthesisAPI.canBeInstrumented(unwrapJoinPoint(func)); - } -} -//# sourceMappingURL=HLSAnalysis.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/hls/MathAnalysis.js b/ClavaLaraApi/src-lara/clava/clava/hls/MathAnalysis.js deleted file mode 100644 index 8b144068f8..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/hls/MathAnalysis.js +++ /dev/null @@ -1,178 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MathHInfo from "./MathHInfo.js"; -export class MathAnalysis { - static fullAnalysis(name, report) { - //Get functions from math.h - let mathFun = MathHInfo.getInfo(); - //If unable to read math.h, use a fallback - if (mathFun.length < 3) { - mathFun = MathHInfo.hardcodedFallback; - } - if (report) { - MathReport(mathFun, true, name); - } - else { - MathReport(mathFun, false, ""); - MathCompare(mathFun); - MathReplace(mathFun); - } - } -} -function MathReport(mathFun, csv = false, name) { - //Counter for occurences of each math.h function - const occurrences = {}; - mathFun.forEach((f) => { - occurrences[f.name] = 0; - }); - //Count occurrences - for (const elem of Query.search(Call).chain()) { - const fun = elem["call"].name; - if (fun in occurrences) { - occurrences[fun] += 1; - } - } - //Report occurrences - if (csv) { - let txt = ""; - if (Io.isFile("MathAnalysis.csv")) { - const lines = Io.readLines("MathAnalysis.csv"); - for (let i = 0; i < lines.length; i++) - txt += lines[i] + "\n"; - } - else { - txt = "source file,"; - for (const f in occurrences) - txt += f + ","; - txt += "\n"; - } - txt += name + ","; - for (const f in occurrences) - txt += occurrences[f] + ","; - txt += "\n"; - console.log(txt); - Io.writeFile("MathAnalysis.csv", txt); - } - else { - console.log("Occurrences of each math.f function (not showing functions with 0 occurrences):"); - for (const f in occurrences) { - if (occurrences[f] > 0) { - console.log(f + ": " + occurrences[f]); - } - } - console.log(""); - } -} -function MathCompare(mathFun) { - //Compare, for each call, the type of arguments and the function signature - console.log("Type of arguments being passed to each call to a math.h function:"); - for (const elem of Query.search(Call).chain()) { - const $call = elem["call"]; - const fun = $call.name; - if (fun in mathFun) { - const args = $call.args; - const types = []; - for (let i = 0; i < args.length; i++) - types.push(args[i].type.builtinKind); - console.log(`-----------\nSig: ${$call.signature}\nArgs: ${types.join(", ")}`); - } - } - console.log(""); -} -/** - * Applies a series of mathemtatical function replacements using the following rules: - * - For every function with a signature requiring args of type "double" but with the - * provided args of type "float", it replaces the function by its "float" equivalent, - * if present on the provided math.h info implementation - * - If a square root is found, it is replaced by a fast inverse square root and a multiplication, - * for both "double" and "float" types, as required. The implementation of the functions is added - * to the source file - * - Replaces calls to the "pow" function using an integer exponent with a series of multiplications - * - * @param mathFun - A javascript object holding information about the signature of all functions - * present on a math.h. Can be obtained using clava.hls.MathHInfo, or otherwise built manually - * (see documentation of clava.hls.MathHInfo for the format) - * */ -function MathReplace(mathFun) { - for (const elem of Query.search(Call).chain()) { - const $call = elem["call"]; - const fun = $call.name; - if (fun in mathFun) { - const args = $call.args; - const types = []; - for (let i = 0; i < args.length; i++) - types.push(args[i].type.builtinKind); - //sqrtf -> rsqrt32 - if (fun == "sqrtf" || (fun == "sqrt" && !types.includes("Double", 0))) { - console.log("Replacing sqrtf for rsqrt32"); - $call.setName("mult_rsqrt32"); - } - //sqrt -> rsqrt64 - if (fun == "sqrt" && types.includes("Double", 0)) { - console.log("Replacing sqrt for sqrt64"); - $call.setName("mult_rsqrt64"); - } - //pow(d, Int) -> d * ... * d - if ((fun == "pow" || fun == "powf") && - types[1] == "Int" && - /[0-9]\d*/.test(args[1].code)) { - console.log("Replacing " + fun + " for explicit multiplication"); - const n = parseInt(args[1].code); - const expr = ClavaJoinPoints.parenthesis(args[0]); - if (n >= 2) { - let node = ClavaJoinPoints.binaryOp("mul", expr.copy(), expr.copy(), types[0]); - for (let i = 3; i <= n; i++) { - node = ClavaJoinPoints.binaryOp("mul", expr.copy(), node, types[0]); - } - $call.replaceWith(node); - } - if (n == 1) { - $call.replaceWith(expr); - } - if (n == 0) { - $call.replaceWith(ClavaJoinPoints.integerLiteral(1)); - } - } - //conversion from using functions with doubles to floats - const isFloat = fun.substring(fun.length - 1) == "f"; - if (!isFloat && !fun.includes("sqrt", 0)) { - const newFun = fun + "f"; - if (newFun in mathFun) { - $call.setName(newFun); - console.log("Replacing " + fun + " for " + newFun); - } - } - } - } -} -function rsqrt() { - return ` - -static inline float mult_rsqrt32(float number) { - uint32_t i; - float x2, y; - x2 = number * 0.5F; - y = number; - i = * (uint32_t *) &y; - i = 0x5f375a86 - (i >> 1); - y = *(float *) &i; - y = y * (1.5F - (x2 * y * y)); - return y * number; -} - -static inline double mult_rsqrt64(double number) { - uint64_t i; - double x2, y; - x2 = number * 0.5; - y = number; - i = * (uint64_t *) &y; - i = 0x5fe6eb50c7b537a9 - (i >> 1); - y = * (double *) &i; - y = y * (1.5 - (x2 * y * y)); - return y * number; -} -`; -} -//# sourceMappingURL=MathAnalysis.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/hls/MathHInfo.js b/ClavaLaraApi/src-lara/clava/clava/hls/MathHInfo.js deleted file mode 100644 index 8cdf4795ac..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/hls/MathHInfo.js +++ /dev/null @@ -1,98 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp } from "../../Joinpoints.js"; -import Clava from "../Clava.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default class MathHInfo { - static getInfo() { - // Save current AST - Clava.pushAst(); - // Clear AST - for (const $file of Query.search(FileJp)) { - $file.detach(); - } - // Prepare source file that will test math.h - const mathTestCode = ` - #include - double foo() {return abs(-1);} - `; - const $testFile = ClavaJoinPoints.file("math_h_test.c"); - $testFile.insertBegin(mathTestCode); - // Compile example code that will allow us to get path to math.h - Query.root().addFile($testFile); - Clava.rebuild(); - // Seach for the abs call and obtain math.h file where it was declared - const $absCall = Query.search(Call, "abs").first(); - const mathIncludeFile = $absCall.declaration.filepath; - // Clear AST - for (const $file of Query.search(FileJp)) { - $file.detach(); - } - // Add math.h to the AST - const $mathFile = ClavaJoinPoints.file("math_copy.h"); - $mathFile.insertBegin(Io.readFile(mathIncludeFile)); - Query.root().addFile($mathFile); - Clava.rebuild(); - const results = []; - for (const $fn of Query.search(FileJp, "math_copy.h").search(FunctionJp)) { - const paramTypes = []; - for (const $param of $fn.params) { - paramTypes.push($param.type.code); - } - const mathInfo = { - name: $fn.name, - returnType: $fn.type.code, - paramTypes: paramTypes, - }; - results.push(mathInfo); - } - // Restore original AST - Clava.popAst(); - return results; - } - static hardcodedFallback = [ - { name: "acos", returnType: "Double", paramTypes: ["Double"] }, - { name: "asin", returnType: "Double", paramTypes: ["Double"] }, - { name: "atan", returnType: "Double", paramTypes: ["Double"] }, - { name: "atan2", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "cos", returnType: "Double", paramTypes: ["Double"] }, - { name: "cosh", returnType: "Double", paramTypes: ["Double"] }, - { name: "sin", returnType: "Double", paramTypes: ["Double"] }, - { name: "sinh", returnType: "Double", paramTypes: ["Double"] }, - { name: "tanh", returnType: "Double", paramTypes: ["Double"] }, - { name: "exp", returnType: "Double", paramTypes: ["Double"] }, - { name: "frexp", returnType: "Double", paramTypes: ["Double", "Int"] }, - { name: "ldexp", returnType: "Double", paramTypes: ["Double", "Int"] }, - { name: "log", returnType: "Double", paramTypes: ["Double"] }, - { name: "log10", returnType: "Double", paramTypes: ["Double"] }, - { name: "modf", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "pow", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "sqrt", returnType: "Double", paramTypes: ["Double"] }, - { name: "ceil", returnType: "Double", paramTypes: ["Double"] }, - { name: "fabs", returnType: "Double", paramTypes: ["Double"] }, - { name: "floor", returnType: "Double", paramTypes: ["Double"] }, - { name: "fmod", returnType: "Double", paramTypes: ["Double", "Double"] }, - { name: "acosf", returnType: "Float", paramTypes: ["Float"] }, - { name: "asinf", returnType: "Float", paramTypes: ["Float"] }, - { name: "atanf", returnType: "Float", paramTypes: ["Float"] }, - { name: "atan2f", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "cosf", returnType: "Float", paramTypes: ["Float"] }, - { name: "coshf", returnType: "Float", paramTypes: ["Float"] }, - { name: "sinf", returnType: "Float", paramTypes: ["Float"] }, - { name: "sinhf", returnType: "Float", paramTypes: ["Float"] }, - { name: "tanhf", returnType: "Float", paramTypes: ["Float"] }, - { name: "expf", returnType: "Float", paramTypes: ["Float"] }, - { name: "frexpf", returnType: "Float", paramTypes: ["Float", "Int"] }, - { name: "ldexpf", returnType: "Float", paramTypes: ["Float", "Int"] }, - { name: "logf", returnType: "Float", paramTypes: ["Float"] }, - { name: "log10f", returnType: "Float", paramTypes: ["Float"] }, - { name: "modff", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "powf", returnType: "Float", paramTypes: ["Float", "Float"] }, - { name: "sqrtf", returnType: "Float", paramTypes: ["Float"] }, - { name: "ceilf", returnType: "Float", paramTypes: ["Float"] }, - { name: "fabsf", returnType: "Float", paramTypes: ["Float"] }, - { name: "floorf", returnType: "Float", paramTypes: ["Float"] }, - { name: "fmodf", returnType: "Float", paramTypes: ["Float", "Float"] }, - ]; -} -//# sourceMappingURL=MathHInfo.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/hls/TraceInstrumentation.js b/ClavaLaraApi/src-lara/clava/clava/hls/TraceInstrumentation.js deleted file mode 100644 index ba9d86f661..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/hls/TraceInstrumentation.js +++ /dev/null @@ -1,573 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { ArrayAccess, BinaryOp, Expression, FunctionJp, Loop, Param, Scope, Statement, UnaryOp, Vardecl, Varref, } from "../../Joinpoints.js"; -import Logger from "../../lara/code/Logger.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -const interfaces = {}; -const locals = {}; -const defCounters = ["const", "temp", "op", "mux", "ne"]; -const CM = '\\"'; -const NL = "\\n"; -let logger; -/** - * Source code assumptions: - * - Arrays have predetermined size - * - No pointers - */ -export default class TraceInstrumentation { - static instrument(funName) { - //Get function root - let root; - const filename = funName + ".dot"; - logger = new Logger(undefined, filename); - for (const elem of Query.search(FunctionJp).chain()) { - if (elem["function"].name == funName) - root = elem["function"]; - } - if (root == undefined) { - console.log("Function " + funName + " not found, terminating..."); - return; - } - //Get scope and interface - let scope; - for (let i = 0; i < root.children.length; i++) { - const child = root.children[i]; - if (child instanceof Scope) { - scope = child; - } - if (child instanceof Param) { - registerInterface(child); - } - } - if (scope == undefined) { - console.log("Function " + funName + " has no scope, terminating..."); - return; - } - const children = scope.children; - //Get global vars as interfaces - for (const elem of Query.search(Vardecl)) { - if (elem.isGlobal) - registerInterface(elem); - } - //Get local vars - for (const elem of Query.search(FunctionJp, { name: funName }).search(Vardecl)) { - registerLocal(elem); - } - //Begin graph and create counters - const firstOp = children[0]; - logger.text("Digraph G {\\n").log(firstOp, true); - createSeparator(firstOp); - createDefaultCounters(firstOp); - for (const entry in locals) { - declareLocalCounter(firstOp, entry); - } - for (const entry in interfaces) { - declareInterfaceCounter(firstOp, entry); - } - //Load all interfaces - for (const inter in interfaces) { - initializeInterface(firstOp, inter); - } - createSeparator(firstOp); - //Go through each statement and generate nodes and edges - explore(children); - //Close graph - logger.text("}").log(children[scope.children.length - 1], true); - } -} -function explore(children) { - for (let i = 0; i < children.length; i++) { - const child = children[i]; - if (child instanceof Statement) { - if (child.children.length == 1) { - handleStatement(child.children[0]); - } - if (child.children.length > 1) { - if (child.children[0] instanceof Vardecl) { - for (let j = 0; j < child.children.length; j++) - handleStatement(child.children[j]); - } - } - } - if (child instanceof Loop) { - explore(child.children[3].children.slice()); - } - } -} -//-------------------- -// Counters -//-------------------- -function createDefaultCounters(node) { - for (let i = 0; i < defCounters.length; i++) - node.insertBefore(ClavaJoinPoints.stmtLiteral("int n_" + defCounters[i] + " = 0;")); -} -function declareInterfaceCounter(node, name) { - const info = interfaces[name]; - const init = info.length == 1 ? " = 0;" : " = {0};"; - node.insertBefore(ClavaJoinPoints.stmtLiteral("int " + getCounterOfVar(name, info) + init)); -} -function declareLocalCounter(node, name) { - const info = locals[name]; - const init = info.length == 1 ? " = 0;" : " = {0};"; - node.insertBefore(ClavaJoinPoints.stmtLiteral("int " + getCounterOfVar(name, info) + init)); -} -function splitMulti(str, tokens) { - const tempChar = tokens[0]; - for (let i = 1; i < tokens.length; i++) { - str = str.split(tokens[i]).join(tempChar); - } - const strParts = str.split(tempChar); - const newStr = []; - for (let i = 0; i < strParts.length; i++) { - if (strParts[i] != "") - newStr.push(strParts[i]); - } - return newStr; -} -function filterCommonKeywords(value, index, arr) { - const common = ["const", "static", "unsigned"]; - return !common.includes(value); -} -function registerInterface(param) { - let tokens = splitMulti(param.code, [" ", "]", "["]); - if (tokens.indexOf("=") != -1) - tokens = tokens.slice(0, tokens.indexOf("=")); - tokens = tokens.filter(filterCommonKeywords); - const interName = tokens[1]; - tokens.splice(1, 1); - if (interfaces[interName] != undefined) - return; - interfaces[interName] = tokens; -} -function registerLocal(local) { - let tokens = splitMulti(local.code, [" ", "]", "["]); - if (tokens.indexOf("=") != -1) - tokens = tokens.slice(0, tokens.indexOf("=")); - tokens = tokens.filter(filterCommonKeywords); - const locName = tokens[1]; - tokens.splice(1, 1); - if (interfaces[locName] != undefined) - return; - if (locals[locName] != undefined) - return; - locals[locName] = tokens; -} -function getCounterOfVar(name, info) { - let str = "n_" + name; - for (let i = 1; i < info.length; i++) - str += "[" + info[i] + "]"; - return str; -} -function isLocal(varName) { - return locals[varName] != undefined; -} -function isInterface(varName) { - return interfaces[varName] != undefined; -} -//-------------------- -// Create nodes -//-------------------- -function refCounter(name) { - name = "n_" + name; - return ClavaJoinPoints.varRef(name, ClavaJoinPoints.builtinType("int")); -} -function refArrayCounter(name, indexes) { - name = "n_" + name; - for (let i = 0; i < indexes.length; i++) - name += "[" + indexes[i] + "]"; - return ClavaJoinPoints.stmtLiteral(name); -} -function refAnyExpr(code) { - return ClavaJoinPoints.stmtLiteral(code); -} -function incrementCounter(node, variable, indexes) { - if (indexes != undefined) { - let access = ""; - for (let i = 0; i < indexes.length; i++) { - access += "[" + indexes[i] + "]"; - } - node.insertBefore(ClavaJoinPoints.stmtLiteral("n_" + variable + access + "++;")); - } - else { - node.insertBefore(ClavaJoinPoints.stmtLiteral("n_" + variable + "++;")); - } -} -function storeVar(node, variable) { - incrementCounter(node, variable); - const att1 = "var"; - let att2 = ""; - let att3 = ""; - if (isLocal(variable)) { - att2 = "loc"; - att3 = locals[variable][0]; - } - if (isInterface(variable)) { - att2 = "inte"; - att3 = interfaces[variable][0]; - } - logger - .text(CM + variable + "_") - .int(refCounter(variable)) - .text(CM + - " [label=" + - CM + - variable + - CM + - ", att1=" + - att1 + - ", att2=" + - att2 + - ", att3=" + - att3 + - "];" + - NL) - .log(node, true); -} -function storeArray(node, variable, indexes) { - incrementCounter(node, variable, indexes); - const att1 = "var"; - let att2 = ""; - let att3 = ""; - if (isLocal(variable)) { - att2 = "loc"; - att3 = locals[variable][0]; - } - if (isInterface(variable)) { - att2 = "inte"; - att3 = interfaces[variable][0]; - } - logger.text(CM + variable); - for (let i = 0; i < indexes.length; i++) { - logger.text("[").int(refAnyExpr(indexes[i])).text("]"); - } - logger - .text("_") - .int(refArrayCounter(variable, indexes)) - .text("_l" + CM); - logger.text(" [label=" + CM + variable); - for (let i = 0; i < indexes.length; i++) { - logger.text("[").int(refAnyExpr(indexes[i])).text("]"); - } - logger - .text(CM + ", att1=" + att1 + ", att2=" + att2 + ", att3=" + att3 + "];" + NL) - .log(node, true); -} -function createOp(node, op) { - incrementCounter(node, "op"); - logger - .text(CM + "op") - .int(refCounter("op")) - .text(CM + " [label=" + CM + op + CM + ", att1=op];" + NL) - .log(node, true); -} -function createMux(node) { - //TODO: include OP attribute? - incrementCounter(node, "mux"); - logger - .text(CM + "mux") - .int(refCounter("mux")) - .text(CM + " [label=" + CM + "mux") - .int(refCounter("mux")) - .text(CM + ", att1=mux];" + NL) - .log(node, true); -} -function createConst(node, num) { - incrementCounter(node, "const"); - logger - .text(CM + "const") - .int(refCounter("const")) - .text(CM + " [label=" + CM + parseInt(num) + CM + ", att1=const];" + NL) - .log(node, true); -} -function createTemp(node, type) { - incrementCounter(node, "temp"); - logger - .text(CM + "temp") - .int(refCounter("temp")) - .text(CM + " [label=" + CM + "temp") - .int(refCounter("temp")) - .text(CM + ", att1=var, att2=loc, att3=" + type + "];" + NL) - .log(node, true); -} -function createSeparator(node) { - const separator = "//---------------------"; - node.insertBefore(ClavaJoinPoints.stmtLiteral(separator)); -} -//-------------------- -// Create edges -//-------------------- -function createEdge(node, source, dest, pos, offset) { - incrementCounter(node, "ne"); - logger.text(CM); - if (source.length == 1) { - if (defCounters.includes(source[0])) { - if (source[0] == "temp" && offset != undefined) - logger.text(source[0]).int(refAnyExpr("n_temp" + offset)); - else - logger.text(source[0]).int(refCounter(source[0])); - } - else - logger.text(source[0]).text("_").int(refCounter(source[0])); - } - else { - logger.text(source[0]); - for (let i = 1; i < source.length; i++) - logger.text("[").int(refAnyExpr(source[i])).text("]"); - logger - .text("_") - .int(refArrayCounter(source[0], source.slice(1))) - .text("_l"); - } - logger.text(CM + " -> " + CM); - if (dest.length == 1) { - if (defCounters.includes(dest[0])) { - if (dest[0] == "temp" && offset != undefined) - logger.text(dest[0]).int(refAnyExpr("n_temp" + offset)); - else - logger.text(dest[0]).int(refCounter(dest[0])); - } - else - logger.text(dest[0]).text("_").int(refCounter(dest[0])); - } - else { - logger.text(dest[0]); - for (let i = 1; i < dest.length; i++) - logger.text("[").int(refAnyExpr(dest[i])).text("]"); - logger - .text("_") - .int(refArrayCounter(dest[0], dest.slice(1))) - .text("_l"); - } - logger - .text(CM + " [label=" + CM) - .int(refCounter("ne")) - .text(CM + ", ord=" + CM) - .int(refCounter("ne")); - if (pos != undefined) - logger.text(CM + ", pos=" + CM + pos); - logger.text(CM + "];" + NL).log(node, true); -} -//-------------------- -// Handle statements -//-------------------- -function handleStatement(node) { - createSeparator(node); - if (node instanceof Vardecl) - handleVardecl(node); - if (node instanceof BinaryOp) - handleAssign(node); - if (node instanceof UnaryOp) - handleUnaryOp(node); - createSeparator(node); -} -function handleVardecl(node) { - //Not contemplating arrays, TODO if necessary - if (node.children.length != 1) - return; - const info = getInfo(node.children[0]); - storeVar(node, node.name); - createEdge(node, info, [node.name]); -} -function handleAssign(node) { - //Build rhs node(s) - let rhsInfo = getInfo(node.right); - //Build lhs node - const lhsInfo = getInfo(node.left); - //If assignment, load extra node and build op - if (node.kind.includes("_")) { - const opKind = mapOperation(node.kind); - createOp(node, opKind); - if (rhsInfo[0] == "temp" && lhsInfo[0] == "temp") - createEdge(node, rhsInfo, ["op"], "r", "-1"); - else - createEdge(node, rhsInfo, ["op"], "r"); - createEdge(node, lhsInfo, ["op"], "l"); - rhsInfo = ["op"]; - } - if (node.left instanceof ArrayAccess) { - storeArray(node, lhsInfo[0], lhsInfo.slice(1)); - } - if (node.left instanceof Varref) { - storeVar(node, lhsInfo[0]); - } - //Create assignment edge - createEdge(node, rhsInfo, lhsInfo); -} -function handleUnaryOp(node) { - if (node.kind.includes("pre") || node.kind.includes("post")) { - createOp(node, mapOperation(node.kind)); - const info = handleVarref(node.children[0]); - createConst(node, "1"); - createEdge(node, ["const"], ["op"], "r"); - createEdge(node, info, ["op"], "l"); - storeVar(node, info[0]); - createEdge(node, ["op"], info); - } - else - return ["const"]; -} -function handleVarref(node) { - return [node.name]; -} -function handleArrayAccess(node) { - const info = [node.arrayVar.name]; - for (let i = 0; i < node.subscript.length; i++) - info.push(node.subscript[i].code); - return info; -} -function handleBinaryOp(node) { - //Build rhs - const rhsInfo = getInfo(node.right); - //Build lhs - const lhsInfo = getInfo(node.left); - //Build op - const opKind = mapOperation(node.kind); - createOp(node, opKind); - if (rhsInfo[0] == "temp" && lhsInfo[0] == "temp") - createEdge(node, rhsInfo, ["op"], "r", "-1"); - else - createEdge(node, rhsInfo, ["op"], "r"); - createEdge(node, lhsInfo, ["op"], "l"); - //Build temp - createTemp(node, "float"); - createEdge(node, ["op"], ["temp"]); - return ["temp"]; -} -function getInfo(node) { - let info = ["null"]; - if (node instanceof Varref) - info = handleVarref(node); - if (node instanceof BinaryOp) - info = handleBinaryOp(node); - if (node instanceof ArrayAccess) - info = handleArrayAccess(node); - if (node instanceof Expression) - info = handleExpression(node); - return info; -} -function handleExpression(node) { - if (node.children.length == 3 && node.children[0] instanceof Expression) { - //Build comparison - const cmpInfo = getInfo(node.children[0].children[0]); - //Build true value - const trueInfo = getInfo(node.children[1]); - //Build false value - const falseInfo = getInfo(node.children[2]); - //Build multiplexer - createMux(node); - createEdge(node, cmpInfo, ["mux"], "sel"); - createEdge(node, trueInfo, ["mux"], "t"); - createEdge(node, falseInfo, ["mux"], "f"); - return ["mux"]; - } - if (node.children.length == 1) - return getInfo(node.children[0]); - if (node.children.length == 0) { - createConst(node, node.code); - return ["const"]; - } - return ["null"]; -} -//-------------------- -// Utils -//-------------------- -function mapOperation(op) { - switch (op) { - case "mul": - return "*"; - case "div": - return "/"; - case "rem": - return "%"; - case "add": - return "+"; - case "sub": - return "-"; - case "shl": - return "<<"; - case "shr": - return ">>"; - case "cmp": - return "cmp"; - case "lt": - return "<"; - case "gt": - return ">"; - case "le": - return "<="; - case "ge": - return ">="; - case "eq": - return "=="; - case "ne": - return "!="; - case "and": - return "&"; - case "xor": - return "^"; - case "or": - return "|"; - case "l_and": - return "&&"; - case "l_or": - return "||"; - case "assign": - return "="; - case "mul_assign": - return "*"; - case "rem_assign": - return "%"; - case "add_assign": - return "+"; - case "sub_assign": - return "-"; - case "shl_assign": - return "<<"; - case "shr_assign": - return ">>"; - case "and_assign": - return "&&"; - case "xor_assign": - return "^"; - case "or_assign": - return "||"; - case "post_int": - return "+"; - case "post_dec": - return "-"; - case "pre_inc": - return "+"; - case "pre_dec": - return "-"; - } - return op; -} -function initializeInterface(node, variable) { - let level = 0; - let stmt = ""; - const info = []; - const indexes = ["_i", "_j", "_k", "_l", "_m", "_n"]; - for (let i = 1; i < interfaces[variable].length; i++) { - stmt += - "for (int " + - indexes[level] + - " = 0; " + - indexes[level] + - " < " + - interfaces[variable][i] + - "; " + - indexes[level] + - "++) {\n"; - info.push(indexes[level]); - level++; - } - node.insertBefore(ClavaJoinPoints.stmtLiteral(stmt)); - if (level != 0) - storeArray(node, variable, info); - else - storeVar(node, variable); - stmt = ""; - for (let i = 0; i < level; i++) - stmt += "}\n"; - node.insertBefore(ClavaJoinPoints.stmtLiteral(stmt)); -} -//# sourceMappingURL=TraceInstrumentation.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalyser.js b/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalyser.js deleted file mode 100644 index 2293c599da..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalyser.js +++ /dev/null @@ -1,190 +0,0 @@ -import ControlFlowGraph from "../graphs/ControlFlowGraph.js"; -import CfgNodeType from "../graphs/cfg/CfgNodeType.js"; -import LivenessUtils from "./LivenessUtils.js"; -export default class LivenessAnalyser { - /** - * A Cytoscape graph representing the CFG - */ - cfg; - /** - * Maps each CFG node ID to the corresponding def set - */ - defs; - /** - * Maps each CFG node ID to the corresponding use set - */ - uses; - /** - * Maps each CFG node ID to the corresponding LiveIn set - */ - liveIn; - /** - * Maps each CFG node ID to the corresponding LiveOut set - */ - liveOut; - /** - * Creates a new instance of the LivenessAnalyser class - * @param cfg - The control flow graph. Can be either a Cytoscape graph or a ControlFlowGraph object. - */ - constructor(cfg) { - this.cfg = this.validateCfg(cfg); - this.defs = new Map(); - this.uses = new Map(); - this.liveIn = new Map(); - this.liveOut = new Map(); - } - /** - * Checks if the given control flow graph is a Cytoscape graph or a ControlFlowGraph object. - * Additionally, verifies if each instruction list node contains only one statement. - * @param cfg - The control flow graph to be validated - */ - validateCfg(cfg) { - if (cfg instanceof ControlFlowGraph) - cfg = cfg.graph; - else if (!LivenessUtils.isCytoscapeGraph(cfg)) - throw new Error("'cfg' must be a Cytoscape graph or a ControlFlowGraph object."); - for (const node of cfg.nodes()) { - const nodeData = node.data(); - if (nodeData.type === CfgNodeType.INST_LIST && nodeData.stmts.length > 1) - throw new Error("Each instruction list node of the control flow graph must contain only one statement."); - } - return cfg; - } - /** - * Computes the def, use, live in and live out sets of each CFG node - * @returns An array that contains the def, use, live in and live out of each CFG node. - */ - analyse() { - this.computeDefs(); - this.computeUses(); - this.computeLiveInOut(); - return [this.defs, this.uses, this.liveIn, this.liveOut]; - } - /** - * - * @param $jp - - * @returns The def set for the given joinpoint - */ - computeDef($jp) { - if ($jp === undefined) { - throw new Error("Joinpoint is undefined"); - } - const declaredVars = LivenessUtils.getVarDeclsWithInit($jp); - const assignedVars = LivenessUtils.getAssignedVars($jp); - return LivenessUtils.unionSets(declaredVars, assignedVars); - } - /** - * - * @param $jp - - * @returns The use set for the given joinpoint - */ - computeUse($jp) { - if ($jp === undefined) { - throw new Error("Joinpoint is undefined"); - } - return LivenessUtils.getVarRefs($jp); - } - /** - * Computes the def set of each CFG node according to its type - */ - computeDefs() { - for (const node of this.cfg.nodes()) { - const nodeData = node.data(); - const $nodeStmt = nodeData.nodeStmt; - const nodeType = nodeData.type; - let def; - switch (nodeType) { - case CfgNodeType.START: - case CfgNodeType.END: - case CfgNodeType.SCOPE: - case CfgNodeType.THEN: - case CfgNodeType.ELSE: - case CfgNodeType.LOOP: - case CfgNodeType.SWITCH: - case CfgNodeType.CASE: - def = new Set(); - break; - case CfgNodeType.IF: - def = this.computeDef($nodeStmt?.cond); - break; - default: - def = this.computeDef($nodeStmt); - } - this.defs.set(node.id(), def); - } - } - /** - * Computes the use set of each CFG node according to its type - */ - computeUses() { - for (const node of this.cfg.nodes()) { - const nodeData = node.data(); - const $nodeStmt = nodeData.nodeStmt; - const nodeType = nodeData.type; - let use; - switch (nodeType) { - case CfgNodeType.START: - case CfgNodeType.END: - case CfgNodeType.SCOPE: - case CfgNodeType.THEN: - case CfgNodeType.ELSE: - case CfgNodeType.LOOP: - use = new Set(); - break; - case CfgNodeType.IF: - use = this.computeUse($nodeStmt?.cond); - break; - case CfgNodeType.SWITCH: - use = this.computeUse($nodeStmt?.condition); - break; - case CfgNodeType.CASE: { - const $switchCondition = ($nodeStmt?.getAncestor("switch")).condition; - use = $nodeStmt?.isDefault - ? new Set() - : this.computeUse($switchCondition); - break; - } - default: - use = this.computeUse($nodeStmt); - } - this.uses.set(node.id(), use); - } - } - /** - * Computes the LiveIn and LiveOut set of each CFG node - */ - computeLiveInOut() { - for (const node of this.cfg.nodes()) { - this.liveIn.set(node.id(), new Set()); - this.liveOut.set(node.id(), new Set()); - } - let liveChanged; - do { - liveChanged = false; - for (const node of this.cfg.nodes()) { - const def = this.defs.get(node.id()); - const use = this.uses.get(node.id()); - // Save current liveIn and liveOut - const oldLiveIn = this.liveIn.get(node.id()); - const oldLiveOut = this.liveOut.get(node.id()); - // Compute and save new liveIn - const diff = LivenessUtils.differenceSets(oldLiveOut, def); - const newLiveIn = LivenessUtils.unionSets(use, diff); - this.liveIn.set(node.id(), newLiveIn); - // Compute and save new liveOut - let newLiveOut = new Set(); - for (const child of LivenessUtils.getChildren(node)) { - const childId = child.id(); - const childLiveIn = this.liveIn.get(childId); - newLiveOut = LivenessUtils.unionSets(newLiveOut, childLiveIn); - } - this.liveOut.set(node.id(), newLiveOut); - // Update liveChanged - if (!LivenessUtils.isSameSet(oldLiveIn, newLiveIn) || - !LivenessUtils.isSameSet(oldLiveOut, newLiveOut)) - liveChanged = true; - } - } while (liveChanged); - } -} -//# sourceMappingURL=LivenessAnalyser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalysis.js b/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalysis.js deleted file mode 100644 index e428648ebd..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessAnalysis.js +++ /dev/null @@ -1,66 +0,0 @@ -import LivenessAnalyser from "./LivenessAnalyser.js"; -export default class LivenessAnalysis { - /** - * Maps each CFG node ID to the corresponding def set - */ - defsMap; - /** - * Maps each CFG node ID to the corresponding use set - */ - usesMap; - /** - * Maps each CFG node ID to the corresponding LiveIn set - */ - liveInMap; - /** - * Maps each CFG node ID to the corresponding LiveOut set - */ - liveOutMap; - /** - * Creates a new instance of the LivenessAnalysis class - * @param defs - A map with CFG node IDs as keys and their corresponding def set as value - * @param uses - A map with CFG node IDs as keys and their corresponding use set as value - * @param liveIn - A map with CFG node IDs as keys and their corresponding live in set as value - * @param liveOut - A map with CFG node IDs as keys and their corresponding live out set as value - */ - constructor(defs, uses, liveIn, liveOut) { - this.defsMap = defs; - this.usesMap = uses; - this.liveInMap = liveIn; - this.liveOutMap = liveOut; - } - /** - * - * @param cfg - The control flow graph. Can be either a Cytoscape graph or a ControlFlowGraph object and each instruction list node must contain only one statement - * @returns A new instance of the LivenessAnalysis class - */ - static analyse(cfg) { - const analyser = new LivenessAnalyser(cfg).analyse(); - return new LivenessAnalysis(...analyser); - } - /** - * @returns A map with CFG node IDs as keys and their corresponding def set as value - */ - get defs() { - return this.defsMap; - } - /** - * @returns A map with CFG node IDs as keys and their corresponding use set as value - */ - get uses() { - return this.usesMap; - } - /** - * @returns A map with CFG node IDs as keys and their corresponding liveIn set as value - */ - get liveIn() { - return this.liveInMap; - } - /** - * @returns A map with CFG node IDs as keys and their corresponding liveOut set as value - */ - get liveOut() { - return this.liveOutMap; - } -} -//# sourceMappingURL=LivenessAnalysis.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessUtils.js b/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessUtils.js deleted file mode 100644 index 597e64d494..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/liveness/LivenessUtils.js +++ /dev/null @@ -1,144 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BinaryOp, Vardecl, Varref, } from "../../Joinpoints.js"; -export default class LivenessUtils { - /** - * Checks if the given graph is a Cytoscape graph - * @deprecated Typescript type checking should be used instead - */ - static isCytoscapeGraph(graph) { - return (typeof graph === "object" && - "nodes" in graph && - "edges" in graph && - typeof graph.add === "function" && - typeof graph.layout === "function"); - } - /** - * Computes the union of two sets - * @param set1 - - * @param set2 - - * @returns A set containing the union of elements from both input sets - */ - static unionSets(set1, set2) { - if (set1 === undefined && set2 === undefined) { - return new Set(); - } - else if (set1 === undefined) { - if (set2 === undefined) { - return new Set(); - } - else { - return set2; - } - } - else if (set2 === undefined) { - return set1; - } - return new Set([...set1, ...set2]); - } - /** - * Computes the set difference between two sets - * @param set1 - - * @param set2 - - * @returns A set containing all the elements present in set1 but not in set2 - */ - static differenceSets(set1, set2) { - if (set1 === undefined) { - return new Set(); - } - if (set2 === undefined) { - return set1; - } - return new Set([...set1].filter((x) => !set2.has(x))); - } - /** - * Checks if two sets contain the same elements - */ - static isSameSet(set1, set2) { - if (set1 === undefined) { - return false; - } - if (set2 === undefined) { - return false; - } - if (set1.size !== set2.size) { - return false; - } - return [...set1].every((e) => set2.has(e), set2); - } - /** - * Returns the children of a node - * @param node - - * @returns An array containing the children of the given node - */ - static getChildren(node) { - const edges = node.connectedEdges(); - const outgoingEdges = edges.filter((edge) => edge.source() == node); - return outgoingEdges.map((edge) => edge.target()); - } - /** - * Checks if the provided joinpoint refers to an assigned variable. - * @param $varref - The varref join point - * @deprecated This method assumes that the giver Varref has a BinaryOp parent. Use carefully. - */ - static isAssignedVar($varref) { - const $parent = $varref.parent; - if ($parent === undefined) { - return false; - } - if (!($parent instanceof BinaryOp)) { - return false; - } - return ($parent !== undefined && - $parent.isAssignment && - $parent.left.astId === $varref.astId); - } - /** - * Checks if the given joinpoint is a local variable or parameter - * @param $varref - The varref join point - */ - static isLocalOrParam($varref) { - const $varDecl = $varref.vardecl; - return $varDecl !== undefined && !$varDecl.isGlobal; - } - /** - * - * @param $jp - The statement join point - * @returns A set of variable names declared with initialization in the given joinpoint - */ - static getVarDeclsWithInit($jp) { - const $varDecls = Query.searchFromInclusive($jp, Vardecl, { - hasInit: true, - }); - const varNames = [...$varDecls].map(($decl) => $decl.name); - return new Set(varNames); - } - /** - * - * @param $jp - The statement join point - * @returns A set containing the names of the local variables or parameters on the left-hand side (LHS) of each assignment present in the given joinpoint - */ - static getAssignedVars($jp) { - const $assignments = Query.searchFromInclusive($jp, BinaryOp, { - isAssignment: true, - left: (left) => left instanceof Varref, - }); - const assignedVars = [...$assignments] - .filter(($assign) => LivenessUtils.isLocalOrParam($assign.left)) - .map(($assign) => $assign.left.name); - return new Set(assignedVars); - } - /** - * - * @param $jp - The statement join point - * @returns A set containing the names of local variables or parameters referenced by varref joinpoints, excluding those present on the LHS of assignments. - */ - static getVarRefs($jp) { - const $varRefs = Query.searchFromInclusive($jp, Varref); - const varNames = [...$varRefs] - .filter(($ref) => !LivenessUtils.isAssignedVar($ref) && - LivenessUtils.isLocalOrParam($ref)) - .map(($ref) => $ref.name); - return new Set(varNames); - } -} -//# sourceMappingURL=LivenessUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiAnalysis.js b/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiAnalysis.js deleted file mode 100644 index 0df749c012..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiAnalysis.js +++ /dev/null @@ -1,288 +0,0 @@ -import { JSONtoFile } from "@specs-feup/lara/api/core/output.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call } from "../../Joinpoints.js"; -import MemoiTarget from "./MemoiTarget.js"; -import MemoiUtils from "./MemoiUtils.js"; -/** - * Enum with the results of the predicate test. - */ -export var PRED; -(function (PRED) { - PRED[PRED["VALID"] = 1] = "VALID"; - PRED[PRED["INVALID"] = -1] = "INVALID"; - PRED[PRED["WAITING"] = 0] = "WAITING"; -})(PRED || (PRED = {})); -export default class MemoiAnalysis { - /** - * Returns array of MemoiTarget. - */ - static findTargets(pred) { - return MemoiAnalysis.findTargetsReport(pred).targets; - } - /** - * Returns MemoiTargetReport. - */ - static findTargetsReport(pred = defaultMemoiPred) { - const targets = []; - const report = new FailReport(); - const processed = {}; - for (const $call of Query.search(Call)) { - // find function or skip - const $func = $call.function; - if ($func === undefined) { - continue; - } - const sig = MemoiUtils.normalizeSig($func.signature); - // if we've processed this one before (valid or not), skip - if (isProcessed(sig, processed)) { - continue; - } - // test if valid - const valid = pred($call, processed, report); - if (valid === PRED.VALID) { - targets.push(MemoiTarget.fromFunction($func)); - } - } - return new MemoiTargetReport(targets, report); - } -} -function isProcessed(sig, processed) { - return processed[sig] === PRED.VALID || processed[sig] === PRED.INVALID; -} -function isWaiting(sig, processed) { - return processed[sig] === PRED.WAITING; -} -/** - * This is the default predicate. - */ -function defaultMemoiPred($call, processed, report) { - const test = defaultMemoiPredRecursive($call, processed, report); - if (test === PRED.WAITING) { - const sig = $call.signature; - processed[sig] = PRED.VALID; - return PRED.VALID; - } - return test; -} -/** - * Checks if the target function is valid. - * - * The constraints are: - * 1) has between 1 and 3 parameters - * 2) type of inputs and outputs is one of \{int, float, double\} - * 3) It doesn't access global state; - * 4) It doesn't call non-valid functions. - */ -function defaultMemoiPredRecursive($call, processed, report) { - const sig = MemoiUtils.normalizeSig($call.signature); - // 0) check if this function was processed before - if (isProcessed(sig, processed)) { - return processed[sig]; - } - // mark this as being processed - processed[sig] = PRED.WAITING; - const $func = $call.function; - const $functionType = $func.functionType; - const $returnType = $functionType.returnType; - const paramTypes = $functionType.paramTypes; - // 1) has between 1 and 3 parameters - if (paramTypes.length < 1 || paramTypes.length > 3) { - debug(sig + " - wrong number of parameters: " + paramTypes.length); - report.incNumParams($func.signature, paramTypes.length); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - // 2) type of return and params is one of {int, float, double} - if (!testType($returnType, ["int", "float", "double"])) { - debug(sig + " - return type is not supported: " + $returnType.code); - report.incTypeReturn($func.signature, $returnType.code); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - for (const $type of paramTypes) { - if (!testType($type, ["int", "float", "double"])) { - debug(sig + " - param type is not supported: " + $type.code); - report.incTypeParams($func.signature, $type.code); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - } - // Try to get the definition - const $def = $call.definition; - if ($def === undefined) { - if (!MemoiUtils.isWhiteListed(sig)) { - debug(sig + " - definition not found, not whitelisted"); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - else { - processed[sig] = PRED.VALID; - return PRED.VALID; - } - } - // 3) It doesn't access global state (unless constants) - const varRefs = $def.getDescendants("varref"); - for (const $ref of varRefs) { - const $varDecl = $ref.vardecl; - if ($varDecl.isGlobal && (!$ref.type.constant || $ref.type.isPointer)) { - debug(sig + " - accesses non-const global storage variable " + $ref.code); - report.incGlobalAccess($func.signature); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - } - // 4) It doesn't call non-valid functions - let isChildWaiting = false; - const $calls = $def.getDescendants("call"); - for (const $childCall of $calls) { - const childSig = $childCall.signature; - if (isWaiting(childSig, processed)) { - isChildWaiting = true; - continue; - } - const test = defaultMemoiPredRecursive($childCall, processed, report); - if (test === PRED.INVALID) { - debug(sig + " - calls invalid function " + childSig); - report.incInvalidCalls(); - processed[sig] = PRED.INVALID; - return PRED.INVALID; - } - else if (test === PRED.WAITING) { - isChildWaiting = true; - } - } - if (isChildWaiting) { - processed[sig] = undefined; - return PRED.WAITING; - } - // Everything checked OK - processed[sig] = PRED.VALID; - return PRED.VALID; -} -/** - * Tests if the type is one of the provided types. - */ -function testType($type, typesToTest) { - const code = $type.code; - return typesToTest.includes(code); -} -/** - * Class to hold info about target finding (targets and reports). - */ -export class MemoiTargetReport { - targets; - failReport; - constructor(targets, failReport) { - this.targets = targets; - this.failReport = failReport; - } - isTarget($func) { - const sig = MemoiUtils.normalizeSig($func.signature); - for (const t of this.targets) { - if (t.sig === sig) { - return true; - } - } - return false; - } - toJson(jsonPath) { - JSONtoFile(jsonPath, this); - } - printFailReport() { - console.log("Reasons to fail:"); - if (this.failReport.numParams > 0) { - console.log(`\tWrong number of params: ${this.failReport.numParams}`); - console.log("\t\t{" + - Object.keys(this.failReport.unsupportedNumParams) - .map((key) => `${key}: ${this.failReport.unsupportedNumParams[key]}`) - .join(", ") + - "}"); - } - if (this.failReport.typeParams > 0) - console.log(`\tWrong type of params: ${this.failReport.typeParams}`); - if (this.failReport.typeReturn > 0) - console.log(`\tWrong type of return: ${this.failReport.typeReturn}`); - if (this.failReport.typeParams > 0 || this.failReport.typeReturn > 0) { - console.log("\t\t{" + - Object.keys(this.failReport.unsupportedTypes) - .map((key) => `${key}: ${this.failReport.unsupportedTypes[key]}`) - .join(", ") + - "}"); - } - if (this.failReport.globalAccess > 0) - console.log(`\tGlobal accesses: ${this.failReport.globalAccess}`); - if (this.failReport.invalidCalls > 0) - console.log(`\tCalls to invalid functions: ${this.failReport.invalidCalls}`); - } -} -/** - * Class to hold info about failed targets. - */ -export class FailReport { - _failMap = {}; - _numParams = 0; - _unsupportedNumParams = {}; - _typeParams = 0; - _typeReturn = 0; - _unsupportedTypes = {}; - _globalAccess = 0; - _invalidCalls = 0; - get numParams() { - return this._numParams; - } - get typeParams() { - return this._typeParams; - } - get typeReturn() { - return this._typeReturn; - } - get globalAccess() { - return this._globalAccess; - } - get invalidCalls() { - return this._invalidCalls; - } - get unsupportedNumParams() { - return this._unsupportedNumParams; - } - get unsupportedTypes() { - return this._unsupportedTypes; - } - incNumParams(sig, num) { - this._failMap[sig] = "Wrong number of params"; - this._numParams++; - this._addUnsupportedNumParams(String(num)); - } - _addUnsupportedNumParams(num) { - this._unsupportedNumParams[num] - ? this._unsupportedNumParams[num]++ - : (this._unsupportedNumParams[num] = 1); - } - incTypeParams(sig, type) { - this._failMap[sig] = "Wrong type of params"; - this._typeParams++; - this._addUnsupportedTypes(type); - } - incTypeReturn(sig, type) { - this._failMap[sig] = "Wrong type of return"; - this._typeReturn++; - this._addUnsupportedTypes(type); - } - _addUnsupportedTypes(type) { - this._unsupportedTypes[type] - ? this._unsupportedTypes[type]++ - : (this._unsupportedTypes[type] = 1); - } - incGlobalAccess(sig) { - this._failMap[sig] = "Global accesses"; - this._globalAccess++; - } - incInvalidCalls(sig) { - if (sig) { - this._failMap[sig] = "Calls to invalid functions"; - } - this._invalidCalls++; - } -} -//# sourceMappingURL=MemoiAnalysis.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiGen.js b/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiGen.js deleted file mode 100644 index 3ade6cfa59..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiGen.js +++ /dev/null @@ -1,402 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { arrayFromArgs } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import { TimerUnit } from "@specs-feup/lara/api/lara/util/TimeUnits.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp } from "../../Joinpoints.js"; -import Timer from "../../lara/code/Timer.js"; -import ClavaJavaTypes from "../ClavaJavaTypes.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiUtils from "./MemoiUtils.js"; -class MemoiGen { - _target; - _isEmpty = true; - _isOnline = true; - _isUpdateAlways = false; - _approxBits = 0; - _isProf = false; - _profReportFiles = []; - _tableSize = 65536; - _isDebug = false; - _applyPolicy = MemoiGen.ApplyPolicy.NOT_EMPTY; - _isZeroSim = false; - _isResetFunc = false; - constructor(target) { - this._target = target; - } - /** - * Sets whether to generate a reset function. - * */ - setResetFunc(isResetFunc = true) { - this._isResetFunc = isResetFunc; - } - /** - * Sets whether to generate code for a 0% sim. - * */ - setZeroSim(isZeroSim = true) { - this._isZeroSim = isZeroSim; - } - /** - * Sets whether to generate an empty table in the final application. - * */ - setEmpty(isEmpty = true) { - this._isEmpty = isEmpty; - } - /** - * Sets whether to generate update code in the final application. - * */ - setOnline(isOnline = true) { - this._isOnline = isOnline; - } - /** - * Sets whether to always update the table on a miss, even if not vacant. - * */ - setUpdateAlways(isUpdateAlways = true) { - this._isUpdateAlways = isUpdateAlways; - } - /** - * Sets the approximation bits in the final application. - * Defaults to 0. - * */ - setApproxBits(bits = 0) { - this._approxBits = bits; - } - /** - * Sets the table size in the final application. - * Defaults to 65536. - * */ - setTableSize(size = 65536) { - const allowedSizes = [ - 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, - ]; - if (!allowedSizes.includes(size)) { - throw new Error("MemoiGen.setTableSize: The possible table sizes are 2^b, with b in [8, 16]."); - } - this._tableSize = size; - } - /** - * Sets whether to generate debug code in the final application. - * */ - setDebug(isDebug = true) { - this._isDebug = isDebug; - } - /** - * Sets the apply policy. - * Defaults to MemoiApplyPolicy.NOT_EMPTY. - */ - setApplyPolicy(policy = MemoiGen.ApplyPolicy.NOT_EMPTY) { - this._applyPolicy = policy; - } - /** - * Checks files with the given names for reports matching the current target. - * @param names - the paths of the report files - */ - setProfFromFileNames(...names) { - this._isProf = true; - this._isEmpty = false; - const namesArray = arrayFromArgs(names); - for (const name of namesArray) { - if (!Io.isFile(name)) { - throw new Error(`MemoiGen.setProfFromFileNames: ${name} is not a file`); - } - this._profReportFiles.push(name); - } - } - /** - * Checks dir for reports matching the current target. - * @param dir - The path to the directory of the report files - */ - setProfFromDir(dir) { - this._isProf = true; - this._isEmpty = false; - this._profReportFiles = Io.getFiles(dir, "*.json", false).map((f) => f.getAbsolutePath()); - } - /** - * Generates a table for all calls of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generate() { - return this._generateAll(); - } - /** - * Generates a table for each call of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generateEach() { - this.checkParams("generateEach"); - if (this._isProf) { - return this.generateFromReport(); - } - else { - return this._generateEach(undefined); - } - } - /** - * Generates a table for all calls of the target function. - * - * If a profiling reports are provided, the reports are used to - * determine whether to generate for all target or for each single - * target. - */ - generateAll() { - this.checkParams("generateAll"); - if (this._isProf) { - return this.generateFromReport(); - } - else { - return this._generateAll(undefined); - } - } - generateFromReport() { - const s = new Set(); - const reportsMap = ClavaJavaTypes.MemoiReportsMap.fromNames(this._profReportFiles); // maybe this needs list - const siteMap = reportsMap.get(this._target.sig); - if (siteMap === null || siteMap === undefined) { - throw ("Could not find report for target " + - this._target.sig + - " in files [" + - this._profReportFiles.join(", ") + - "]"); - } - for (const site in siteMap) { - // merge all reports for this - const reportPathList = siteMap.get(site); - const report = ClavaJavaTypes.MemoiReport.mergeReportsFromNames(reportPathList); - if (site === "global") { - const sTmp = this._generateAll(report); - for (const sT of sTmp.values()) { - s.add(sT); - } - } - else { - const sTmp = this._generateEach(report); - for (const sT of sTmp.values()) { - s.add(sT); - } - } - } - return s; - } - _generateEach(report) { - const s = new Set(); - const cSig = MemoiUtils.cSig(this._target.sig); - const filter = { - signature: (s) => this._target.sig === MemoiUtils.normalizeSig(s), - location: (l) => report !== undefined ? report.callSites[0] === l : true, // if there is a report, we also filter by site - }; - for (const $call of Query.search(Call, filter)) { - const wrapperName = IdGenerator.next("mw_" + cSig); - s.add(wrapperName); - $call.wrap(wrapperName); - this.generateGeneric(wrapperName, report); - } - return s; - } - _generateAll(report) { - const s = new Set(); - const cSig = MemoiUtils.cSig(this._target.sig); - const wrapperName = "mw_" + cSig; - s.add(wrapperName); - for (const $call of Query.search(Call, { - signature: (s) => this._target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - this.generateGeneric(wrapperName, report); - return s; - } - generatePerfectInst() { - const cSig = MemoiUtils.cSig(this._target.sig); - const wrapperName = "mw_" + cSig; - const globalName = "memoi_target_timer"; - const printName = "print_perfect_inst"; - // wrap every call to the target - for (const $call of Query.search(Call, { - signature: (s) => this._target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - // change the wrapper by timing around the original call - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain()) { - const $file = chain["file"]; - const $function = chain["function"]; - const $call = chain["call"]; - const t = new Timer(TimerUnit.SECONDS); - $file.addGlobal(globalName, ClavaJoinPoints.builtinType("double"), "0.0"); - const tVar = t.time($call); - $function.insertReturn(`memoi_target_timer += ${tVar};`); - } - // if print_perfect_inst function is found, some other target has dealt with the main code and we're done - for (const chain of Query.search(FileJp, { hasMain: true }) - .search(FunctionJp, { name: printName }) - .chain()) { - return; - } - // change the main function to print the time to a file - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain()) { - const $file = chain["file"]; - const $main = chain["function"]; - $file.addGlobal(globalName, ClavaJoinPoints.builtinType("double"), "0.0"); - $file.addInclude("stdio.h", true); - $file.addInclude("sys/stat.h", true); - $file.addInclude("sys/types.h", true); - $file.addInclude("errno.h", true); - $file.addInclude("string.h", true); - $file.addInclude("libgen.h", true); - $main.insertReturn(printName + "(argv[0]);"); - $main.insertBefore("void " + printName + "(char*);"); - const $function = $file.addFunction(printName); - $function.setParamsFromStrings(["char* name"]); - $function.insertReturn(` - - - errno = 0; - char* prog_name = basename(name); - char* file_name = malloc(strlen(prog_name) + strlen("${globalName}.txt") + 1 + 1); - sprintf(file_name, "%s.%s", prog_name, "${globalName}.txt"); - - FILE * ${globalName}_file = fopen (file_name,"a"); - if(${globalName}_file == NULL) { - perror("Could not create file for memoi perfect instrumentation"); - } else { - fprintf(${globalName}_file, "%f\n", ${globalName}); - fclose(${globalName}_file); - } - `); - } - } - generateGeneric(wrapperName, report) { - for (const chain of Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain()) { - const $file = chain["file"]; - const $function = chain["function"]; - const $call = chain["call"]; - let dmt = undefined; - if (report !== undefined) { - // build the DMT and test the apply policy - dmt = ClavaJavaTypes.MemoiCodeGen.generateDmt(this._tableSize, report, this._applyPolicy); - if (!dmt.testPolicy()) { - console.log(this._target.sig + - "[" + - report.callSites[0] + - "]" + - " fails the apply policy " + - this._applyPolicy + - ". Not applying memoization."); - return; - } - } - let updatesName = undefined; - if (this._isDebug) { - const totalName = wrapperName + "_total_calls"; - const missesName = wrapperName + "_total_misses"; - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - $call.insert("before", `${totalName}++;`); - $call.insert("after", `${missesName}++;`); - if (this._isOnline) { - updatesName = wrapperName + "_total_updates"; - $file.addGlobal(updatesName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - } - this.addMainDebug(totalName, missesName, updatesName, wrapperName); - } - // generate the table (and reset) code and add it before the wrapper - const tableCode = ClavaJavaTypes.MemoiCodeGen.generateTableCode(dmt.getTable(), this._tableSize, this._target.numInputs, this._target.numOutputs, this._isOnline, this._isResetFunc, this._isZeroSim ? true : this._isEmpty, // whether this is an empty table - wrapperName); - $function.insert("before", tableCode); - // generate the logic code and add it before the original call - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - const logicCode = ClavaJavaTypes.MemoiCodeGen.generateLogicCode(this._tableSize, paramNames, this._approxBits, this._target.numInputs, this._target.numOutputs, this._target.inputTypes, this._target.outputTypes, wrapperName); - $call.insert("before", logicCode); - if (this._isOnline) { - const updateCode = ClavaJavaTypes.MemoiCodeGen.generateUpdateCode(this._tableSize, paramNames, this._isUpdateAlways, this._target.numInputs, this._target.numOutputs, updatesName, this._isZeroSim, wrapperName); - $call.insert("after", updateCode); - } - $file.addInclude("stdint.h", true); - } - } - addMainDebug(totalName, missesName, updatesName, wrapperName) { - const chain = Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain(); - const firstAndOnly = chain[0]; - if (firstAndOnly === undefined) { - console.log("Could not find a main function. It may be impossible to print debug stats if this is a library code."); - return; - } - const $file = firstAndOnly["file"]; - const $function = firstAndOnly["function"]; - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - if (this._isOnline) { - $file.addGlobal(updatesName, ClavaJoinPoints.builtinType("unsigned int"), "0"); - } - $file.addInclude("stdio.h", true); - $file.addInclude("sys/stat.h", true); - $file.addInclude("sys/types.h", true); - $file.addInclude("errno.h", true); - let updatesStringCode = ""; - let updatesValuesCode = ""; - if (this._isOnline) { - updatesStringCode = ', \\"updates\\": %u'; - updatesValuesCode = ", " + updatesName; - } - const json = ` - { - errno = 0; - int dir_result = mkdir("memoi-exec-report", 0755); - if(dir_result != 0 && errno != EEXIST){ - perror("Could not create directory for memoi execution reports"); - } - else{ - errno = 0; - FILE * _memoi_rep_file = fopen ("memoi-exec-report/${wrapperName}.json","w"); - if(_memoi_rep_file == NULL) { - perror("Could not create file for memoi execution report"); - } else { - fprintf(_memoi_rep_file, "{"name": "${wrapperName}", "total": %u, "hits": %u, "misses": %u${updatesStringCode}}\n", ${totalName}, ${totalName} - ${missesName}, ${missesName}${updatesValuesCode}); - fclose(_memoi_rep_file); - } - } - } - `; - $function.insertReturn(json); - } - checkParams(source) { - if (!((this._isEmpty && this._isOnline) || !this._isEmpty)) { - throw new Error(`MemoiGen.${source}: Can't have empty and offline table.`); - } - if (!(this._isEmpty ? !this._isProf : this._isProf)) { - throw new Error("MemoiGen.${source}: Empty table and profile are mutually exclusive table."); - } - } -} -(function (MemoiGen) { - let ApplyPolicy; - (function (ApplyPolicy) { - ApplyPolicy["ALWAYS"] = "ALWAYS"; - ApplyPolicy["NOT_EMPTY"] = "NOT_EMPTY"; - ApplyPolicy["OVER_25_PCT"] = "OVER_25_PCT"; - ApplyPolicy["OVER_50_PCT"] = "OVER_50_PCT"; - ApplyPolicy["OVER_75_PCT"] = "OVER_75_PCT"; - ApplyPolicy["OVER_90_PCT"] = "OVER_90_PCT"; - })(ApplyPolicy = MemoiGen.ApplyPolicy || (MemoiGen.ApplyPolicy = {})); -})(MemoiGen || (MemoiGen = {})); -export default MemoiGen; -//# sourceMappingURL=MemoiGen.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiProf.js b/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiProf.js deleted file mode 100644 index a634bd0d0f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiProf.js +++ /dev/null @@ -1,254 +0,0 @@ -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp, Scope } from "../../Joinpoints.js"; -import Clava from "../Clava.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiUtils from "./MemoiUtils.js"; -/** - * Library to instrument applications with the memoiprof profiling library. - * - * @param targetSig - The signature of the target funtion - * @param id - Unique ID representing this function - * @param reportDir - Path to the directory where the report will be saved (does not need trailing /) - */ -export default class MemoiProf { - target; - id; - reportDir; - /** - * Options for memoiprof. - */ - memoiprofOptions = new MemoiprofOptions(); - constructor(target, id, reportDir) { - this.target = target; - this.id = id.replace(" ", "_"); - this.reportDir = reportDir; - // Deal with dependecy to memoiprof - PrintOnce.message("Woven code has dependency to project memoiprof, which can be found at https://github.com/cc187/memoiprof"); - Clava.getProgram().addProjectFromGit("https://github.com/cc187/memoiprof.git", ["mp"]); - } - setSampling(samplingKind, samplingRate) { - this.memoiprofOptions.setSampling(samplingKind, samplingRate); - } - setPeriodicReporting(periodicReportKind, periodicReportRate) { - this.memoiprofOptions.setPeriodicReporting(periodicReportKind, periodicReportRate); - } - setCulling(cullingKind, cullingRatio) { - this.memoiprofOptions.setCulling(cullingKind, cullingRatio); - } - setApprox(approxKind, approxBits) { - this.memoiprofOptions.setApprox(approxKind, approxBits); - } - /** - * Profiles all calls of the target function. This includes making a single - * wrapper for all calls and adding the memoization profiling code inside this - * wrapper. - * */ - profAll() { - const cSig = MemoiUtils.cSig(this.target.sig); - const wrapperName = "mw_" + cSig; - const monitorName = "mp_" + cSig; - const monitorType = ClavaJoinPoints.typeLiteral("MemoiProf*"); - // make the wrapper - for (const $call of Query.search(Call, { - signature: (s) => this.target.sig === MemoiUtils.normalizeSig(s), - })) { - $call.wrap(wrapperName); - } - // instrument the wrapper - this.memoiInstrumentWrapper(wrapperName, monitorName, monitorType); - // setup - this.memoiSetup(monitorName, monitorType, this.id, ["global"]); - } - /** - * Profiles each call to the target function separately. This includes - * making a wrapper for each call and adding the memoization profiling code - * inside the wrapper. - * */ - profEach() { - const cSig = MemoiUtils.cSig(this.target.sig); - const wrapperNameBase = "mw_" + cSig; - const monitorNameBase = "mp_" + cSig; - const monitorType = ClavaJoinPoints.typeLiteral("MemoiProf*"); - for (const $call of Query.search(Call, { - signature: (s) => this.target.sig === MemoiUtils.normalizeSig(s), - })) { - // make the wrapper - const wrapperName = IdGenerator.next(wrapperNameBase); - $call.wrap(wrapperName); - // instrument the wrapper - const monitorName = IdGenerator.next(monitorNameBase); - this.memoiInstrumentWrapper(wrapperName, monitorName, monitorType); - const callSiteInfo = $call.location; - // setup - const id = IdGenerator.next(this.id + "_"); - this.memoiSetup(monitorName, monitorType, id, [callSiteInfo]); - } - } - memoiInstrumentWrapper(wrapperName, monitorName, monitorType) { - const numInputs = this.target.numInputs; - const numOutputs = this.target.numOutputs; - const query = Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain(); - for (const row of query) { - let code = "mp_inc(" + monitorName; - const $params = row["function"].params; - for (let i = 0; i < numInputs; i++) { - code += ", &" + $params[i].name; - } - if (numOutputs == 1) { - code += ", &result"; - } - else { - for (let o = numInputs; o < $params.length; o++) { - code += ", " + $params[o].name; - } - } - code += ");"; - const $call = row["call"]; - $call.insert("after", code); - $call.insert("after", "#pragma omp critical"); // needed for correct semantics under OpenMP - const $file = row["file"]; - $file.addGlobal(monitorName, monitorType, "NULL"); - $file.addInclude("MemoiProfiler.h", false); - $file.addInclude("stdlib.h", true); - } - } - memoiSetup(monitorName, monitorType, id, callSiteInfo) { - const inputsCode = this.target.inputTypes - .map(function (e) { - return "mp_" + e; - }) - .join(",") - .toUpperCase(); - const outputsCode = this.target.outputTypes - .map(function (e) { - return "mp_" + e; - }) - .join(",") - .toUpperCase(); - const query = Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .children(Scope) - .chain()[0]; - if (query !== undefined) { - throw new Error("MemoiProf: Could not find main function needed for setup"); - } - const memoiReportPath = "path_" + monitorName; - const $body = query["scope"]; - // memoiprof options - if (this.memoiprofOptions.samplingKind !== SamplingKind.OFF) { - const samplingKind = "MP_SAMPLING_" + this.memoiprofOptions.samplingKind.toUpperCase(); - $body.insertBegin(`mp_set_sampling(${monitorName}, ${samplingKind}, ${this.memoiprofOptions.samplingRate});`); - } - if (this.memoiprofOptions.periodicReportKind) { - $body.insertBegin(`mp_set_periodic_reporting(${monitorName}, MP_PERIODIC_ON, ${this.memoiprofOptions.periodicReportRate});`); - } - if (this.memoiprofOptions.cullingKind) { - $body.insertBegin(`mp_set_culling(${monitorName}, MP_CULLING_ON, ${this.memoiprofOptions.cullingRatio});`); - } - if (this.memoiprofOptions.approxKind) { - $body.insertBegin(`mp_set_approx(${monitorName}, MP_APPROX_ON, ${this.memoiprofOptions.approxBits});`); - } - this.memoiAddCallSiteInfo($body, callSiteInfo, monitorName); - $body.insertBegin(`free(${memoiReportPath});`); // can free here, since mp_init duped it - $body.insertBegin(`${monitorName} = mp_init("${this.target.sig}", "${id}", ${memoiReportPath}, ${this.target.inputTypes.length}, ${this.target.outputTypes.length}, ${inputsCode}, ${outputsCode});`); - $body.insertBegin(`char* ${memoiReportPath} = mp_make_report_path("${this.reportDir}", "${monitorName}");`); - /* add functions to print and clean up at every return on main */ - const $function = query["function"]; - $function.insertReturn(`mp_to_json(${monitorName});`); - $function.insertReturn(`${monitorName} = mp_destroy(${monitorName});`); - const $file = query["file"]; - $file.addGlobal(monitorName, monitorType, "NULL"); - $file.addInclude("MemoiProfiler.h", false); - $file.addInclude("stdlib.h", true); - } - memoiAddCallSiteInfo($mainBody, callSiteInfo = ["global"], monitorName) { - const length = callSiteInfo.length; - $mainBody.insertBegin("mp_set_call_sites(" + - monitorName + - ", " + - length + - ", " + - callSiteInfo.map((i) => `"${i}"`).join(", ") + - ");"); - } -} -export var SamplingKind; -(function (SamplingKind) { - SamplingKind["RANDOM"] = "random"; - SamplingKind["FIXED"] = "fixed"; - SamplingKind["OFF"] = "off"; -})(SamplingKind || (SamplingKind = {})); -/** - * Class used to store memoiprof options. - * */ -export class MemoiprofOptions { - _samplingKind = SamplingKind.OFF; - _samplingRate = 0; - _periodicReportKind = false; - _periodicReportRate = 0; - _cullingKind = false; - _cullingRatio = 0.0; - _approxKind = false; - _approxBits = 0; - get samplingKind() { - return this._samplingKind; - } - get samplingRate() { - return this._samplingRate; - } - get periodicReportKind() { - return this._periodicReportKind; - } - get periodicReportRate() { - return this._periodicReportRate; - } - get cullingKind() { - return this._cullingKind; - } - get cullingRatio() { - return this._cullingRatio; - } - get approxKind() { - return this._approxKind; - } - get approxBits() { - return this._approxBits; - } - /** - * Supported samplingKind values are: 'random', 'fixed', 'off'. - * For 1/x sampling, samplingRate should be x. - * */ - setSampling(samplingKind, samplingRate) { - this._samplingKind = samplingKind; - this._samplingRate = samplingRate; - } - /** - * Supported periodicReportKind values are: true, false. - * periodicReportRate is the number of calls between writes of periodic reports. - * */ - setPeriodicReporting(periodicReportKind, periodicReportRate) { - this._periodicReportKind = periodicReportKind; - this._periodicReportRate = periodicReportRate; - } - /** - * Supported cullingKind values are: true, false. - * cullingRatio is the threshold (% of calls) for printing to the JSON. - * */ - setCulling(cullingKind, cullingRatio) { - this._cullingKind = cullingKind; - this._cullingRatio = cullingRatio; - } - /** - * Supported approxKind values are: true, false. - * */ - setApprox(approxKind, approxBits) { - this._approxKind = approxKind; - this._approxBits = approxBits; - } -} -//# sourceMappingURL=MemoiProf.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiTarget.js b/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiTarget.js deleted file mode 100644 index 754990451d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiTarget.js +++ /dev/null @@ -1,112 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FunctionJp } from "../../Joinpoints.js"; -import MemoiUtils from "./MemoiUtils.js"; -export default class MemoiTarget { - sig; - $func; - isUser; - numInputs; - numOutputs; - inputTypes; - outputTypes; - numCallSites; - constructor(sig, $func, isUser, numInputs = $func.params.length, numOuputs = 1, inputTypes, outputTypes, numCallSites) { - this.sig = MemoiUtils.normalizeSig(sig); - this.$func = $func; - this.isUser = isUser; - this.numInputs = numInputs; - this.numOutputs = numOuputs; - if (inputTypes === undefined || outputTypes === undefined) { - [this.inputTypes, this.outputTypes] = this.findDataTypes(); - } - else { - this.inputTypes = inputTypes; - this.outputTypes = outputTypes; - } - this.numCallSites = numCallSites ?? this.findNumCallSites(); - this.checkDataTypes(); - } - static fromFunction($func) { - const sig = MemoiUtils.normalizeSig($func.signature); - const isUser = !MemoiUtils.isWhiteListed(sig); - const numInputs = $func.params.length; - const numOutputs = 1; - // input types, output types, and num of call sites are found in the constructor - return new MemoiTarget(sig, $func, isUser, numInputs, numOutputs, undefined, undefined); - } - static fromCall($call) { - const $func = $call.function; - if ($func === undefined) { - throw `Could not find function of call '${$call.code}'`; - } - return MemoiTarget.fromFunction($func); - } - static fromSig(sig) { - sig = MemoiUtils.normalizeSig(sig); - const $func = Query.search(FunctionJp, { - signature: (signature) => sig === MemoiUtils.normalizeSig(signature), - }).first(); - if ($func === undefined) { - const $call = Query.search(Call, { - signature: (signature) => sig === MemoiUtils.normalizeSig(signature), - }).first(); - if ($call === undefined) { - throw `Could not find function of sig '${sig}'`; - } - return MemoiTarget.fromCall($call); - } - return MemoiTarget.fromFunction($func); - } - findNumCallSites() { - return Query.search(Call, { - signature: (signature) => this.sig === MemoiUtils.normalizeSig(signature), - }).get().length; - } - findDataTypes() { - const inputTypes = []; - const outputTypes = []; - const $functionType = this.$func.functionType; - if (this.numOutputs == 1) { - outputTypes.push($functionType.returnType.code); - $functionType.paramTypes.forEach(function (e) { - inputTypes.push(e.code); - }); - } - else { - const typeCodes = $functionType.paramTypes.map(function (e) { - return e.code; - }); - typeCodes.forEach((e, i) => { - if (i < this.numInputs) { - inputTypes.push(e); - } - else { - outputTypes.push(e); - } - }); - } - return [inputTypes, outputTypes]; - } - checkDataTypes() { - const normalTypes = ["double", "float", "int"]; - const pointerTypes = ["double *", "float *", "int *"]; - const inputsInvalid = this.inputTypes.some(function (e) { - return !normalTypes.includes(e); - }); - if (inputsInvalid) { - throw `The inputs of the target function '${this.sig}' are not supported.`; - } - const outputTestArray = this.numOutputs == 1 ? normalTypes : pointerTypes; - const outputsInvalid = this.outputTypes.some(function (e) { - return !outputTestArray.includes(e); - }); - if (outputsInvalid) { - throw `The outputs of the target function '${this.sig}' are not supported.`; - } - // if the output are valid, drop the pointer from the type - this.outputTypes = this.outputTypes.map(function (e) { - return e.replace(/\*/, "").trim(); - }); - } -} -//# sourceMappingURL=MemoiTarget.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiUtils.js b/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiUtils.js deleted file mode 100644 index 89f09b4efa..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/MemoiUtils.js +++ /dev/null @@ -1,143 +0,0 @@ -/** - * The C data types the memoization instrumentation library can handle. - */ -export var MemoiDataType; -(function (MemoiDataType) { - MemoiDataType["INT"] = "INT"; - MemoiDataType["DOUBLE"] = "DOUBLE"; - MemoiDataType["FLOAT"] = "FLOAT"; -})(MemoiDataType || (MemoiDataType = {})); -export default class MemoiUtils { - static mathFunctionSigs = new Set([ - /* double, 1 parameter */ - "acos(double)", - "acosh(double)", - "asin(double)", - "asinh(double)", - "atan(double)", - "atanh(double)", - "cbrt(double)", - "ceil(double)", - "cos(double)", - "cosh(double)", - "erf(double)", - "erfc(double)", - "exp(double)", - "exp2(double)", - "expm1(double)", - "fabs(double)", - "floor(double)", - "j0(double)", - "j1(double)", - "lgamma(double)", - "log(double)", - "log10(double)", - "log1p(double)", - "log2(double)", - "logb(double)", - "nearbyint(double)", - "rint(double)", - "round(double)", - "sin(double)", - "sinh(double)", - "sqrt(double)", - "tan(double)", - "tanh(double)", - "tgamma(double)", - "trunc(double)", - /* float, 1 parameter */ - "acosf(float)", - "acoshf(float)", - "asinf(float)", - "asinhf(float)", - "atanf(float)", - "atanhf(float)", - "cbrtf(float)", - "ceilf(float)", - "cosf(float)", - "coshf(float)", - "erfcf(float)", - "erff(float)", - "exp2f(float)", - "expf(float)", - "expm1f(float)", - "fabsf(float)", - "floorf(float)", - "lgammaf(float)", - "log10f(float)", - "log1pf(float)", - "log2f(float)", - "logbf(float)", - "logf(float)", - "nearbyintf(float)", - "rintf(float)", - "roundf(float)", - "sinf(float)", - "sinhf(float)", - "sqrtf(float)", - "tanf(float)", - "tanhf(float)", - "tgammaf(float)", - "truncf(float)", - /* double,2 parameters */ - "atan2(double,double)", - "copysign(double,double)", - "fdim(double,double)", - "fmax(double,double)", - "fmin(double,double)", - "fmod(double,double)", - "hypot(double,double)", - "nextafter(double,double)", - "pow(double,double)", - "remainder(double,double)", - "scalb(double,double)", - /* float, 2 parameters */ - "atan2f(float,float)", - "copysignf(float,float)", - "fdimf(float,float)", - "fmaxf(float,float)", - "fminf(float,float)", - "fmodf(float,float)", - "hypotf(float,float)", - "nextafterf(float,float)", - "powf(float,float)", - "remainderf(float,float)", - ]); - /** - * Tests whether the function with the given signature is whitelisted. - * */ - static isWhiteListed(sig) { - if (MemoiUtils.isMathFunction(sig)) { - return true; - } - return false; - } - /** - * Tests whether the function with the given signature is a math.h function. - * */ - static isMathFunction(sig) { - return MemoiUtils.mathFunctionSigs.has(sig); - } - static cSig(sig) { - return sig - .replace(/\(/g, "_") - .replace(/\*/g, "_p") - .replace(/ /g, "_") - .replace(/,/g, "_") - .replace(/\)/g, "_"); - } - static normalizeSig(sig) { - return sig.replace(/ /g, ""); - } - /** - * @deprecated Use javascript's array.includes method instead - * - */ - static arrayContains(a, e) { - return a.includes(e); - } - static average(values, count = values.length) { - return values.reduce((a, b) => a + b, 0) / count; - } -} -//# sourceMappingURL=MemoiUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/memoi/_MemoiGenHelper.js b/ClavaLaraApi/src-lara/clava/clava/memoi/_MemoiGenHelper.js deleted file mode 100644 index 1d05ca8e9c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/memoi/_MemoiGenHelper.js +++ /dev/null @@ -1,332 +0,0 @@ -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Call, FileJp, FunctionJp, Statement } from "../../Joinpoints.js"; -import ClavaJavaTypes from "../ClavaJavaTypes.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MemoiUtils from "./MemoiUtils.js"; -/** - * BE VERY CAREFULL WHEN USING FUNCTIONS FROM THIS FILE. - * WHEN REFACTORING THIS FILE I NOTICED THAT SOME JAVA FUNCTIONS BEING CALLED - * DO NOT APPEAR TO EXIST OR ARE INCORRECTLY CALLED. - * ALSO, THERE ARE NO TESTS COVERING THIS CODE. - */ -/** - * Generates the table and supporting code for this report. - * - * Inserts elements in the table based on the predicate insertPred. - * */ -export function _generate(insertPred, countComparator, report, isMemoiDebug, isMemoiOnline, isMemoiEmpty, isMemoiUpdateAlways, memoiApproxBits, tableSize, signature, callSite) { - let wt; - if (callSite === "global") { - wt = _Memoi_WrapGlobalTarget(signature); - } - else { - wt = _Memoi_WrapSingleTarget(signature, callSite); - } - _Memoi_InsertTableCode(insertPred, countComparator, report, wt.wrapperName, isMemoiDebug, isMemoiOnline, isMemoiEmpty, isMemoiUpdateAlways, memoiApproxBits, tableSize); -} -export function _Memoi_WrapGlobalTarget(signature) { - const wrapperName = `mw_${MemoiUtils.normalizeSig(signature)}`; - for (const chain of Query.search(Statement) - .search(Call, { - signature: (sig) => sig.replace(/ /g, "") == signature, - }) - .chain()) { - const $call = chain["call"]; - $call.wrap(wrapperName); - debug("wrapped"); - } - return { wrapperName }; -} -export function _Memoi_WrapSingleTarget(signature, location) { - for (const chain of Query.search(Statement) - .search(Call, { - signature: (sig) => sig.replace(/ /g, "") == signature, - }) - .chain()) { - const $call = chain["call"]; - const wrapperName = IdGenerator.next(`mw_${MemoiUtils.normalizeSig(signature)}`); - $call.wrap(wrapperName); - debug("wrapped"); - return { wrapperName }; - } - throw `Did not find call to ${signature} at ${location}`; -} -export function _Memoi_InsertTableCode(insertPred, countComparator, report, wrapperName, isMemoiDebug, isMemoiOnline, isMemoiEmpty, isMemoiUpdateAlways, memoiApproxBits, tableSize) { - Query.search(FileJp) - .search(FunctionJp, { name: wrapperName }) - .search(Call) - .chain() - .forEach((chain) => { - const $file = chain["file"]; - const $function = chain["function"]; - const $call = chain["call"]; - if (isMemoiDebug) { - const totalName = wrapperName + "_total_calls"; - const missesName = wrapperName + "_total_misses"; - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("int"), "0"); - $call.insertBefore(`${totalName}++;`); - $call.insertAfter(`${missesName}++;`); - _Memoi_AddMainDebug(totalName, missesName, wrapperName); - } - const tableCode = _makeTableCode(insertPred, countComparator, report, $function, tableSize, isMemoiEmpty, isMemoiOnline, memoiApproxBits); - $call.insertBefore(tableCode); - if (isMemoiOnline) { - const updateCode = _makeUpdateCode(report, $function, tableSize, isMemoiUpdateAlways); - $call.insertAfter(updateCode); - } - $file.addInclude("stdint.h", true); - }); -} -export function _Memoi_AddMainDebug(totalName, missesName, wrapperName) { - Query.search(FileJp) - .search(FunctionJp, { name: "main" }) - .chain() - .forEach((chain) => { - const $file = chain["file"]; - const $function = chain["function"]; - $file.addGlobal(totalName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addGlobal(missesName, ClavaJoinPoints.builtinType("int"), "0"); - $file.addInclude("stdio.h", true); - $function.insertReturn(` - printf("${wrapperName}\t%d / %d (%.2f%%)\n", - ${totalName} - ${missesName}, - ${totalName}, - (${totalName} - ${missesName}) * 100.0 / ${totalName}); - `); - }); -} -export function _baseLog(num, base) { - return Math.log(num) / Math.log(base); -} -export function _makeTableCode(insertPred, countComparator, report, $function, tableSize, isMemoiEmpty, isMemoiOnline, memoiApproxBits) { - const indexBits = _baseLog(tableSize, 2); - debug("table size: " + tableSize); - debug("index bits: " + indexBits); - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - const code = ClavaJavaTypes.MemoiCodeGen.generateDmtCode(report, tableSize, paramNames, isMemoiEmpty, isMemoiOnline, memoiApproxBits); - return code; -} -export function _makeUpdateCode(report, $function, tableSize, isMemoiUpdateAlways) { - const paramNames = []; - for (const $param of $function.params) { - paramNames.push($param.name); - } - const code = ClavaJavaTypes.MemoiCodeGen.generateUpdateCode(report, tableSize, paramNames, isMemoiUpdateAlways); - return code; -} -export const sizeMap = { - float: 32, - int: 32, - double: 64, -}; -export function _printTable(table, tableSize) { - for (let i = 0; i < tableSize; i++) { - if (table[i] !== undefined) { - let code = ""; - const fullKey = table[i].fullKey; - const keys = fullKey.split("#"); - for (let k = 0; k < keys.length; k++) { - code += "0x" + keys[k] + ", "; - } - code += "0x" + table[i].output; - console.log(code); - } - } -} -export function _printTableReport(collisions, totalElements, maxCollision, report, tableSize, table) { - let tableCalls = 0; - let tableElements = 0; - for (let i = 0; i < tableSize; i++) { - if (table[i] != undefined) { - tableCalls += mean(table[i].counter, report.reportCount); - tableElements++; - } - } - const totalCalls = mean(report.calls, report.reportCount); - const collisionPercentage = (collisions / totalElements) * 100; - const elementsCoverage = (tableElements / totalElements) * 100; - const callCoverage = (tableCalls / totalCalls) * 100; - console.log("collisions: " + collisions + " (" + collisionPercentage.toFixed(2) + "%)"); - console.log("largest collision: " + maxCollision); - console.log("element coverage: " + - tableElements + - "/" + - totalElements + - " (" + - elementsCoverage.toFixed(2) + - ")%"); - console.log("call coverage: " + - tableCalls + - "/" + - totalCalls + - " (" + - callCoverage.toFixed(2) + - ")%"); -} -export function _hashFunctionHalf(bits64) { - const len = bits64.length; - let hashString = ""; - for (let i = 0; i < len / 2; i++) { - const number = parseInt(bits64.charAt(i), 16) ^ parseInt(bits64.charAt(i + len / 2), 16); - hashString += number.toString(16); - } - return hashString; -} -export function _hashFunctionOld(bits64, indexBits) { - switch (indexBits) { - case 8: { - const bits32 = _hashFunctionHalf(bits64); - const bits16 = _hashFunctionHalf(bits32); - const bits8 = _hashFunctionHalf(bits16); - return String(parseInt(bits8, 16)); - } - case 16: { - const bits32 = _hashFunctionHalf(bits64); - const bits16 = _hashFunctionHalf(bits32); - return String(parseInt(bits16, 16)); - } - default: - return bits64; - break; - } -} -export function _hashFunction(bits64, indexBits) { - const varBits = 64; - let lastPower = varBits; - const iters = _baseLog(varBits / indexBits, 2); - const intIters = parseInt(String(iters), 10); - let hash = bits64; - for (let i = 0; i < intIters; i++) { - hash = _hashFunctionHalf(hash); - lastPower = lastPower / 2; - } - // if not integer, we need to mask bits at the end - if (iters !== intIters) { - // mask starts with 16 bits - let mask = parseInt("0xffff", 16); - const shift = 16 - indexBits; - mask = mask >> shift; - hash = String(parseInt(hash, 16) & mask); - return hash; - } - hash = String(parseInt(hash, 16)); - return hash; -} -/** - * Converts counts from a map to an array. - * */ -export function _convertCounts(newReport) { - const a = []; - for (const countP in newReport.counts) { - const count = newReport.counts[countP]; - a.push(count); - } - newReport.counts = a; -} -// function -export function totalTopN(report, n, reportCount) { - let result = 0; - const averageCounts = []; - for (const count of report.counts) { - averageCounts.push(mean(count.counter, reportCount)); - } - sortDescending(averageCounts); - for (let i = 0; i < Math.min(n, averageCounts.length); i++) { - result += averageCounts[i]; - } - return result; -} -// function -export function elementsForRatio(report, total, ratio, reportCount) { - let sum = 0; - const averageCounts = []; - for (const count of report.counts) { - averageCounts.push(mean(count.counter, reportCount)); - } - sortDescending(averageCounts); - for (let elements = 0; elements < averageCounts.length; elements++) { - sum += averageCounts[elements]; - if (sum / total > ratio) { - return elements + 1; - } - } - return report.elements; // ? -} -// function -export function getQuartVal(counts, idx) { - const floor = Math.floor(idx); - let val; - if (idx == floor) { - val = (counts[idx] + counts[idx - 1]) / 2; - } - else { - val = counts[floor]; - } - return val; -} -// function -export function bwp(report, reportCount) { - const averageCounts = []; - for (const count of report.counts) { - averageCounts.push(average(count.counter, reportCount)); - } - sortDescending(averageCounts); - const length = averageCounts.length; - const min = averageCounts[length - 1]; - const q1 = getQuartVal(averageCounts, (1 / 4) * length); - const q2 = getQuartVal(averageCounts, (2 / 4) * length); - const q3 = getQuartVal(averageCounts, (3 / 4) * length); - const max = averageCounts[0]; - const iqr = q3 - q1; - return { - min, - q1, - q2, - q3, - max, - iqr, - }; -} -// function -export function printBwp(report, reportCount) { - const b = bwp(report, reportCount); - console.log(`{ ${b.min}, ${b.q1}, ${b.q2}, ${b.q3}, ${b.max} } iqr: ${b.iqr}`); -} -/** - * @deprecated This function does not calculate a mean, but an average. - */ -export function mean(values, count) { - return average(values, count); -} -export function average(values, count) { - let sum = 0; - for (const value of values) { - sum += value; - } - if (count === undefined) { - return sum / values.length; - } - else { - return sum / count; - } -} -export function sortDescending(array) { - return array.sort(function (a, b) { - if (a < b) - return 1; - else if (a > b) - return -1; - else - return 0; - }); -} -export function sortAscending(array) { - return sortDescending(array).reverse(); -} -//# sourceMappingURL=_MemoiGenHelper.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiAccessPattern.js b/ClavaLaraApi/src-lara/clava/clava/mpi/MpiAccessPattern.js deleted file mode 100644 index 0a16b099cd..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiAccessPattern.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Represents an MPI access pattern. - * - */ -export default class MpiAccessPattern { -} -//# sourceMappingURL=MpiAccessPattern.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiScatterGatherLoop.js b/ClavaLaraApi/src-lara/clava/clava/mpi/MpiScatterGatherLoop.js deleted file mode 100644 index 35fe21471a..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiScatterGatherLoop.js +++ /dev/null @@ -1,207 +0,0 @@ -import ClavaCode from "../ClavaCode.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import MpiUtils from "./MpiUtils.js"; -import MpiAccessPatterns from "./patterns/MpiAccessPatterns.js"; -/** - * Applies an MPI scatter-gather strategy to loops. - */ -export default class MpiScatterGatherLoop { - $loop; - inputJps = []; - inputAccesses = []; - outputJps = []; - outputAccesses = []; - constructor($loop) { - this.$loop = $loop; - // Check if loop can be parallelize - if (this.$loop.iterationsExpr === undefined) { - throw "Could not determine expression with number of iterations of the loop. Check if the loop is in the Canonical Loop Form, according to the OpenMP standard."; - } - } - addInput(varName, accessPattern) { - this.addVariable(varName, accessPattern, this.inputJps, this.inputAccesses); - } - addOutput(varName, accessPattern) { - this.addVariable(varName, accessPattern, this.outputJps, this.outputAccesses); - } - /** - * Adapts code to use the MPI strategy. - */ - execute() { - const $mainFunction = ClavaCode.getFunctionDefinition("main", true); - const $mainFile = $mainFunction.getAncestor("file"); - if ($mainFile == undefined) { - throw "Could not find file of main function"; - } - // Add include - $mainFile.addInclude("mpi.h"); - $mainFile.addInclude("iostream", true); - // Add global variables - const $intType = ClavaJoinPoints.builtinType("int"); - $mainFile.addGlobal(MpiUtils.VAR_NUM_TASKS, $intType, "0"); - $mainFile.addGlobal(MpiUtils.VAR_NUM_WORKERS, $intType, "0"); - const $rankDecl = $mainFile.addGlobal(MpiUtils.VAR_RANK, $intType, "0"); - // Create decl - const mpiWorkerFunction = ClavaJoinPoints.declLiteral(this.buildMpiWorker()); - // Add MPI Worker - $rankDecl.insertAfter(mpiWorkerFunction); - // Replace loop with MPI Master routine - this.replaceLoop(); - // Add MPI initialization - this.addMpiInit($mainFunction); - } - /** PRIVATE SECTION **/ - static FUNCTION_MPI_WORKER = "mpi_worker"; - static VAR_WORKER_NUM_ELEMS = "mpi_loop_num_elems"; - static VAR_MASTER_TOTAL_ITER = "clava_mpi_total_iter"; - replaceLoop() { - let masterSend = ""; - for (let i = 0; i < this.inputJps.length; i++) { - const $inputJp = this.inputJps[i]; - const accessPattern = this.inputAccesses[i]; - masterSend += accessPattern.sendMaster($inputJp, MpiScatterGatherLoop.VAR_MASTER_TOTAL_ITER); - masterSend += "\n"; - } - let masterReceive = ""; - for (let i = 0; i < this.outputJps.length; i++) { - const $inputJp = this.outputJps[i]; - const accessPattern = this.outputAccesses[i]; - masterReceive += accessPattern.receiveMaster($inputJp, MpiScatterGatherLoop.VAR_MASTER_TOTAL_ITER); - masterReceive += "\n"; - } - this.$loop.replaceWith(MpiScatterGatherLoop.MpiMaster(MpiUtils.VAR_NUM_WORKERS, this.$loop.iterationsExpr.code, masterSend, masterReceive, MpiUtils._VAR_MPI_STATUS)); - } - buildMpiWorker() { - const workerLoopCode = this.getWorkerLoopCode(); - let workerReceive = ""; - for (let i = 0; i < this.inputJps.length; i++) { - const $inputJp = this.inputJps[i]; - const accessPattern = this.inputAccesses[i]; - workerReceive += accessPattern.receiveWorker($inputJp, MpiScatterGatherLoop.VAR_WORKER_NUM_ELEMS); - workerReceive += "\n"; - } - let outputDecl = ""; - for (let i = 0; i < this.outputJps.length; i++) { - const $outputJp = this.outputJps[i]; - const accessPattern = this.outputAccesses[i]; - outputDecl += accessPattern.outputDeclWorker($outputJp, MpiScatterGatherLoop.VAR_WORKER_NUM_ELEMS); - outputDecl += "\n"; - } - let workerSend = ""; - for (let i = 0; i < this.outputJps.length; i++) { - const $outputJp = this.outputJps[i]; - const accessPattern = this.outputAccesses[i]; - workerSend += accessPattern.sendWorker($outputJp, MpiScatterGatherLoop.VAR_WORKER_NUM_ELEMS); - workerSend += "\n"; - } - return MpiScatterGatherLoop.MpiWorker(MpiScatterGatherLoop.FUNCTION_MPI_WORKER, MpiUtils._VAR_MPI_STATUS, MpiScatterGatherLoop.VAR_WORKER_NUM_ELEMS, workerReceive, outputDecl, workerLoopCode, workerSend); - } - getWorkerLoopCode() { - // Copy loop - const $workerLoop = this.$loop.copy(); - // Adjust start and end of loop - $workerLoop.initValue = "0"; - $workerLoop.endValue = MpiScatterGatherLoop.VAR_WORKER_NUM_ELEMS; - // TODO: Adapt loop body, if needed - return $workerLoop.code; - } - addMpiInit($mainFunction) { - // Add params to main, if no params - if ($mainFunction.params.length === 0) { - $mainFunction.setParamsFromStrings(["int argc", "char** argv"]); - } - const numMainParams = $mainFunction.params.length; - if (numMainParams !== 2) { - throw `Expected main() function to have 2 paramters, has '${numMainParams}'`; - } - const argc = $mainFunction.params[0].name; - const argv = $mainFunction.params[1].name; - $mainFunction.body.insertBegin(MpiScatterGatherLoop.MpiInit(argc, argv, MpiUtils.VAR_RANK, MpiUtils.VAR_NUM_TASKS, MpiUtils.VAR_NUM_WORKERS, MpiScatterGatherLoop.FUNCTION_MPI_WORKER)); - } - addVariable(varName, accessPattern = MpiAccessPatterns.SCALAR_PATTERN, namesArray, accessesArray) { - // Check if loop contains a reference to the variable - let firstVarref = undefined; - for (const $v of this.$loop.getDescendants("varref")) { - const $varref = $v; - if ($varref.name === varName) { - firstVarref = $varref; - break; - } - } - if (firstVarref === undefined) { - throw `Could not find a reference to the variable '${varName}' in the loop located at ${this.$loop.location}`; - } - namesArray.push(firstVarref); - accessesArray.push(accessPattern); - } - /** CODEDEFS **/ - // TODO: std::cerr should not be hardcoded, lara.code.Logger should be used instead - static MpiInit(argc, argv, rank, numTasks, numWorkers, mpiWorker) { - return ` - MPI_Init(&${argc}, &${argv}); - MPI_Comm_rank(MPI_COMM_WORLD, &${rank}); - MPI_Comm_size(MPI_COMM_WORLD, &${numTasks}); - ${numWorkers} = ${numTasks} - 1; - - if(${numWorkers} == 0) { - std::cerr << "This program does not support working with a single process." << std::endl; - return 1; - } - - if(${rank} > 0) { - ${mpiWorker}(); - MPI_Finalize(); - return 0; - } -`; - } - static MpiWorker(functionName, status, numElems, receiveData, outputDecl, loop, sendData) { - return ` -void ${functionName}() { - MPI_Status ${status}; - - // Number of loop iterations - int ${numElems}; - - MPI_Recv(&${numElems}, 1, MPI_INT, 0, 1, MPI_COMM_WORLD, &${status}); - - ${receiveData} - - ${outputDecl} - - ${loop} - - ${sendData} -} -`; - } - static MpiMaster(numWorkers, numIterations, masterSend, masterReceive, status) { - return ` - // Master routine - - // split iterations of the loop - int clava_mpi_total_iter = ${numIterations}; - int clava_mpi_loop_limit = clava_mpi_total_iter; - // A better distribution calculation could be used - int clava_mpi_num_iter = clava_mpi_total_iter / ${numWorkers}; - int clava_mpi_num_iter_last = clava_mpi_num_iter + clava_mpi_total_iter % ${numWorkers}; - // int clava_mpi_num_iter_last = clava_mpi_num_iter + (clava_mpi_loop_limit - (clava_mpi_num_iter * ${numWorkers})); - - // send number of iterations - for(int i=0; i<${numWorkers}-1; i++) { - MPI_Send(&clava_mpi_num_iter, 1, MPI_INT, i+1, 1, MPI_COMM_WORLD); - } - MPI_Send(&clava_mpi_num_iter_last, 1, MPI_INT, ${numWorkers}, 1, MPI_COMM_WORLD); - - - ${masterSend} - - MPI_Status ${status}; - - ${masterReceive} - - MPI_Finalize(); -`; - } -} -//# sourceMappingURL=MpiScatterGatherLoop.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiUtils.js b/ClavaLaraApi/src-lara/clava/clava/mpi/MpiUtils.js deleted file mode 100644 index 026aac66ea..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/MpiUtils.js +++ /dev/null @@ -1,19 +0,0 @@ -import { BuiltinType } from "../../Joinpoints.js"; -/** - * Utility methods related to MPI. - * - */ -export default class MpiUtils { - static VAR_NUM_TASKS = "mpi_num_tasks"; - static VAR_NUM_WORKERS = "mpi_num_workers"; - static VAR_RANK = "mpi_rank"; - static _VAR_MPI_STATUS = "mpi_status"; - static getMpiType($type) { - // Reference: https://msdn.microsoft.com/en-us/library/windows/desktop/dn473290(v=vs.85).aspx - if ($type instanceof BuiltinType) { - return "MPI_" + $type.code.toUpperCase().replace(" ", "_"); - } - throw "Not implemented for type '" + $type.astName + "'"; - } -} -//# sourceMappingURL=MpiUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/IterationVariablePattern.js b/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/IterationVariablePattern.js deleted file mode 100644 index 8bbd2fb487..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/IterationVariablePattern.js +++ /dev/null @@ -1,98 +0,0 @@ -import MpiAccessPattern from "../MpiAccessPattern.js"; -import MpiUtils from "../MpiUtils.js"; -import ClavaJoinPoints from "../../ClavaJoinPoints.js"; -import { ArrayType, PointerType } from "../../../Joinpoints.js"; -/** - * Array that is accessed using only the iteration variable directly, without modifications. - */ -export default class IterationVariablePattern extends MpiAccessPattern { - sendMaster($varJp, totalIterations) { - const varName = $varJp.name; - const numIterations = IterationVariablePattern.NumIterations(totalIterations, MpiUtils.VAR_NUM_WORKERS); - const numIterationsLast = IterationVariablePattern.NumIterationsLast(numIterations, totalIterations, MpiUtils.VAR_NUM_WORKERS); - const $adjustedType = IterationVariablePattern.adjustType($varJp.type, totalIterations); - // Type must be an array - if (!($adjustedType instanceof ArrayType)) { - throw `Expected type to be an array, is '${$adjustedType.astName}'`; - } - const mpiType = MpiUtils.getMpiType($adjustedType.elementType); - return IterationVariablePattern.SendMaster(varName, MpiUtils.VAR_NUM_WORKERS, numIterations, numIterationsLast, mpiType); - } - receiveMaster($varJp, totalIterations) { - const varName = $varJp.name; - const numIterations = IterationVariablePattern.NumIterations(totalIterations, MpiUtils.VAR_NUM_WORKERS); - const numIterationsLast = IterationVariablePattern.NumIterationsLast(numIterations, totalIterations, MpiUtils.VAR_NUM_WORKERS); - const $adjustedType = IterationVariablePattern.adjustType($varJp.type, totalIterations); - // Type must be an array - if (!($adjustedType instanceof ArrayType)) { - throw "Expected type to be an array, is '" + $adjustedType.astName + "'"; - } - const mpiType = MpiUtils.getMpiType($adjustedType.elementType); - return IterationVariablePattern.ReceiveMaster(varName, MpiUtils.VAR_NUM_WORKERS, numIterations, numIterationsLast, mpiType, MpiUtils._VAR_MPI_STATUS); - } - sendWorker($varJp, totalIterations) { - const $adjustedType = IterationVariablePattern.adjustType($varJp.type, totalIterations); - // Type must be an array - if (!($adjustedType instanceof ArrayType)) { - throw "Expected type to be an array, is '" + $adjustedType.astName + "'"; - } - const mpiType = MpiUtils.getMpiType($adjustedType.elementType); - return `MPI_Send(&${$varJp.name}, ${totalIterations}, ${mpiType}, 0, 1, MPI_COMM_WORLD);\n`; - } - receiveWorker($varJp, totalIterations) { - // Adjust type, if needed - const $adjustedType = IterationVariablePattern.adjustType($varJp.type, totalIterations); - // Type must be an array - if (!($adjustedType instanceof ArrayType)) { - throw "Expected type to be an array, is '" + $adjustedType.astName + "'"; - } - // Declare type - const $varDecl = ClavaJoinPoints.varDeclNoInit($varJp.name, $adjustedType); - const mpiType = MpiUtils.getMpiType($adjustedType.elementType); - return `${$varDecl.code};\nMPI_Recv(&${$varJp.name}, ${totalIterations}, ${mpiType}, 0, 1, MPI_COMM_WORLD, &${MpiUtils._VAR_MPI_STATUS});\n`; - } - outputDeclWorker($varJp, totalIterations) { - // Adjust type, if needed - const $adjustedType = IterationVariablePattern.adjustType($varJp.type, totalIterations); - // Declare type - const $varDecl = ClavaJoinPoints.varDeclNoInit($varJp.name, $adjustedType); - return $varDecl.code + ";\n"; - } - static adjustType($type, totalIterations) { - if ($type instanceof ArrayType) { - // TODO: Support for multidimensional arrays - const $sizeExpr = ClavaJoinPoints.exprLiteral(totalIterations, "int"); - return ClavaJoinPoints.variableArrayType($type.normalize.elementType, $sizeExpr); - } - // Pointer types that have this kind of access pattern are considered arrays - if ($type instanceof PointerType) { - // TODO: Support for multidimensional arrays - const $sizeExpr = ClavaJoinPoints.exprLiteral(totalIterations, "int"); - return ClavaJoinPoints.variableArrayType($type.pointee, $sizeExpr); - } - return $type; - } - static NumIterations(totalIterations, numWorkers) { - return `(${totalIterations} / ${numWorkers})`; - } - static NumIterationsLast(numIterations, totalIterations, numWorkers) { - return `(${numIterations} + ${totalIterations} % ${numWorkers})`; - } - static SendMaster(varName, numWorkers, numIterations, numIterationsLast, mpiType) { - return `// send input ${varName} - elements: iteration_space -for(int i=0; i<${numWorkers}-1; i++) { - MPI_Send(&${varName}[i*${numIterations}], ${numIterations}, ${mpiType}, i + 1,1, MPI_COMM_WORLD); -} -MPI_Send(&${varName}[(${numWorkers}-1)*${numIterations}], ${numIterationsLast}, ${mpiType}, ${numWorkers},1, MPI_COMM_WORLD); -`; - } - static ReceiveMaster(varName, numWorkers, numIterations, numIterationsLast, mpiType, status) { - return `// receive output ${varName} - elements: iteration_space -for(int i=0; i<${numWorkers}-1; i++) { - MPI_Recv(&${varName}[i*${numIterations}], ${numIterations}, ${mpiType}, i + 1, 1, MPI_COMM_WORLD, &${status}); -} -MPI_Recv(&${varName}[(${numWorkers}-1)*${numIterations}], ${numIterationsLast}, ${mpiType}, ${numWorkers}, 1, MPI_COMM_WORLD, &${status}); -`; - } -} -//# sourceMappingURL=IterationVariablePattern.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/MpiAccessPatterns.js b/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/MpiAccessPatterns.js deleted file mode 100644 index abbc327230..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/MpiAccessPatterns.js +++ /dev/null @@ -1,17 +0,0 @@ -import ScalarPattern from "./ScalarPattern.js"; -import IterationVariablePattern from "./IterationVariablePattern.js"; -/** - * Available MPI access patterns. - * - */ -export default class MpiAccessPatterns { - /** - * Access to a scalar variable. - */ - static SCALAR_PATTERN = new ScalarPattern(); - /** - * Array that is accessed using only the iteration variable directly, without modifications. - */ - static ITERATION_VARIABLE = new IterationVariablePattern(); -} -//# sourceMappingURL=MpiAccessPatterns.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/ScalarPattern.js b/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/ScalarPattern.js deleted file mode 100644 index 825a9a60a0..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/mpi/patterns/ScalarPattern.js +++ /dev/null @@ -1,22 +0,0 @@ -import MpiAccessPattern from '../MpiAccessPattern.js'; -/** - * Access to a scalar variable. - */ -export default class ScalarPattern extends MpiAccessPattern { - sendMaster($varJp, totalIterations) { - throw "Not yet implemented"; - } - receiveMaster($varJp, totalIterations) { - throw "Not yet implemented"; - } - sendWorker($varJp, totalIterations) { - throw "Not yet implemented"; - } - receiveWorker($varJp, totalIterations) { - throw "Not yet implemented"; - } - outputDeclWorker($varJp, totalIterations) { - throw "Not yet implemented"; - } -} -//# sourceMappingURL=ScalarPattern.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacer.js b/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacer.js deleted file mode 100644 index 73189d865b..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacer.js +++ /dev/null @@ -1,353 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import { BuiltinType, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default class KernelReplacer { - call; - function; - stmt; - file; - bufferSizes = new Map(); - inBuffers; - outBuffers = new Map(); - inOutBuffers = new Map(); - kernelCode; - kernelName; - deviceType; - errorHandling; - localSize; - iter; - constructor($call, kernelName, kernelCodePath, bufferSizes, localSize, numIters) { - // TODO: verify all parameters - // join points - this.call = $call; - this.function = $call.definition; - this.stmt = $call.getAncestor("statement"); - this.file = $call.getAncestor("file"); - // buffer information - for (const key of Object.keys(bufferSizes)) { - this.bufferSizes.set(key, bufferSizes[key]); - } - this.inBuffers = this.makeInBuffers(); - // kernel name and source - const kernelFile = Io.getPath(this.file.path, kernelCodePath); - if (!Io.isFile(kernelFile)) { - throw ("[KernelReplacer] Cannot read OpenCL file in location " + - kernelFile.toString() + - " (" + - kernelCodePath + - ")"); - } - this.kernelCode = Io.readFile(kernelFile); - this.kernelName = kernelName; - // device type - this.deviceType = DeviceType.CL_DEVICE_TYPE_ALL; // TODO: make a setter for this - // error handling - this.errorHandling = ErrorHandling.EXIT; // TODO: make setter for this - // local size and number of iterations (global size) - if (localSize instanceof Array) { - this.localSize = localSize; - } - else { - this.localSize = [localSize]; - } - if (numIters instanceof Array) { - this.iter = numIters; - } - else { - this.iter = [numIters]; - } - if (this.localSize.length !== this.iter.length) { - throw new Error("KernelReplacer(): localSize and numIters must have the same number of dimensions"); - } - } - /* ------------------------- PUBLIC METHODS ------------------------- */ - setOutput(paramName) { - const inBuf = this.inBuffers.get(paramName); - if (inBuf == undefined) { - throw new Error(`No input buffer found for parameter '${paramName}'`); - } - this.outBuffers.set(paramName, inBuf); - this.outBuffers.get(paramName)._kind = BufferKind.OUTPUT; - this.inBuffers.delete(paramName); - } - replaceCall() { - const $parentFile = this.file; - $parentFile.addInclude("CL/cl.hpp", true); - $parentFile.insertBegin("#define __CL_ENABLE_EXCEPTIONS"); - const type = ClavaJoinPoints.typeLiteral("const char *"); - const sourceStringName = this.kernelName + "_source_code"; - $parentFile.addGlobal(sourceStringName, type, this.makeKernelCode()); - const code = this.makeCode(sourceStringName); - const $codeStmt = ClavaJoinPoints.stmtLiteral(code); - this.stmt.replaceWith($codeStmt); - } - /* ------------------------- PRIVATE METHODS ------------------------ */ - makeKernelCode() { - return '"' + Strings.escapeJson(this.kernelCode) + '"'; - } - makeCode(sourceStringName) { - let code = "// start of OpenCL code\n"; - code += "cl::Program program;\n"; - code += "std::vector devices;\n"; - code += "try {\n"; - code += KernelReplacer.SetupCode(this.deviceType, this.makeErrorHandlingCode()); - code += this.makeBuffersCode(); - code += KernelReplacer.KernelCreation(sourceStringName, this.kernelName); - code += this.makeArgBindCode(); - code += KernelReplacer.SizesDecl(this.localSize.join(", "), this.makeGlobalSizeCode()); - code += KernelReplacer.EnqueueKernel(); - code += this.makeOutputBuffersCode(); - code += KernelReplacer.ExceptionCode(); - code += "\n// end of OpenCL code\n\n"; - return code; - } - makeGlobalSizeCode() { - const codes = []; - let code = "cl::NDRange globalSize("; - for (let i = 0; i < this.localSize.length; i++) { - const local = this.localSize[i]; - const global = this.iter[i]; - codes.push("(int)(ceil(" + global + "/(float)" + local + ")*" + local + ")"); - } - code += codes.join(", "); - code += ");"; - return code; - } - makeOutputBuffersCode() { - let code = "\n// Read back buffers\n"; - this.inOutBuffers.forEach((inOutBuf) => { - code += KernelReplacer.BufferCopyOut(inOutBuf._bufferName, inOutBuf._size, inOutBuf._argName); - }); - this.outBuffers.forEach((outBuf) => { - code += KernelReplacer.BufferCopyOut(outBuf._bufferName, outBuf._size, outBuf._argName); - }); - return code; - } - makeArgBindCode() { - let code = ""; - for (let index = 0; index < this.call.args.length; index++) { - const $arg = this.call.args[index]; - const paramName = this.function.params[index].name; - const inTry = this.inBuffers.get(paramName); - if (inTry !== undefined) { - code += KernelReplacer.ArgBind(String(index), inTry._bufferName); - } - else { - const inOutTry = this.inOutBuffers.get(paramName); - if (inOutTry !== undefined) { - code += KernelReplacer.ArgBind(String(index), inOutTry._bufferName); - } - else { - const outTry = this.outBuffers.get(paramName); - if (outTry !== undefined) { - code += KernelReplacer.ArgBind(String(index), outTry._bufferName); - } - else { - code += KernelReplacer.ArgBind(String(index), $arg.code); - } - } - } - } - return "\n// Bind kernel arguments to kernel\n" + code; - } - makeBuffersCode() { - let code = "\n// Create device memory buffers\n"; - this.inBuffers.forEach((inBuf) => { - code += KernelReplacer.BufferDecl(inBuf._bufferName, inBuf._kind, inBuf._size); - }); - this.outBuffers.forEach((outBuf) => { - code += KernelReplacer.BufferDecl(outBuf._bufferName, outBuf._kind, outBuf._size); - }); - this.inOutBuffers.forEach((inOutBuf) => { - code += KernelReplacer.BufferDecl(inOutBuf._bufferName, inOutBuf._kind, inOutBuf._size); - }); - code += "\n// Bind memory buffers\n"; - this.inBuffers.forEach((inBuf) => { - code += KernelReplacer.BufferCopyIn(inBuf._bufferName, inBuf._size, inBuf._argName); - }); - this.inOutBuffers.forEach((inOutBuf) => { - code += KernelReplacer.BufferCopyIn(inOutBuf._bufferName, inOutBuf._size, inOutBuf._argName); - }); - return code; - } - makeErrorHandlingCode() { - switch (this.errorHandling) { - case ErrorHandling.EXIT: - return "exit(EXIT_FAILURE);"; - default: - return "exit(EXIT_FAILURE);"; - } - } - makeInBuffers() { - const buffers = new Map(); - // iterate over function parameters - const params = this.function.params; - for (let i = 0; i < params.length; i++) { - const $param = params[i]; - // pick arrays/pointers - if ($param.type.isArray || $param.type.isPointer) { - const bufferSize = this.getBufferSize($param.name); - const $baseType = this.getBaseType($param.type); - const argName = this.call.args[i].code; - const info = new Buffer(BufferKind.INPUT, $param.name, $baseType, i, bufferSize, argName, $param.name + "_buffer"); - buffers.set($param.name, info); - } - } - return buffers; - } - getBufferSize(paramName) { - const bufferSize = this.bufferSizes.get(paramName); - if (bufferSize == undefined) { - throw new Error(`Ǹo buffer size found for parameter '${paramName}'`); - } - return bufferSize; - } - getBaseType($type) { - let $newType = $type; - while (!($newType instanceof BuiltinType)) { - $newType = $newType.unwrap; - } - return $newType; - } - /* ---------------------------- CODEDEFS ---------------------------- */ - static SetupCode(deviceType, errorHandling) { - return `// Query platforms -std::vector platforms; -cl::Platform::get(&platforms); -if (platforms.size() == 0) { - std::cout << "Platform size 0\n"; - ${errorHandling} -} - -// Get list of devices on default platform and create context -cl_context_properties properties[] = - { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), - 0}; -cl::Context context(${deviceType}, properties); -devices = context.getInfo(); - -// Create command queue for first device -cl::CommandQueue queue(context, devices[0], 0); - -`; - } - static ExceptionCode() { - return `} catch (cl::Error err) { - std::cerr << "ERROR: "<(dev); - if (status != CL_BUILD_ERROR) - continue; - - // Get the build log - std::string name = dev.getInfo(); - std::string buildlog = program.getBuildInfo(dev); - std::cerr << "Build log for " << name << ":" << std::endl << buildlog << std::endl; - } - } else { - throw err; - } -} -`; - } - static BufferCopyOut(bufferName, bufferSize, argName) { - return `queue.enqueueReadBuffer(${bufferName}, CL_TRUE, 0, ${bufferSize}, ${argName}); - -`; - } - static EnqueueKernel() { - return `// Enqueue kernel -cl::Event event; -queue.enqueueNDRangeKernel( - kernel, - cl::NullRange, - globalSize, - localSize, - NULL, - &event); - -// Block until kernel completion -event.wait(); - -`; - } - static SizesDecl(localsize, globalsizeCode) { - return `// Number of work items in each local work group -cl::NDRange localSize(${localsize}); -// Number of total work items - localSize must be devisor -${globalsizeCode} - -`; - } - static ArgBind(index, arg) { - return `kernel.setArg(${index}, ${arg}); - -`; - } - static KernelCreation(sourceString, kernelName) { - return `//Build kernel from source string -cl::Program::Sources source(1, - std::make_pair(${sourceString},strlen(${sourceString}))); -program = cl::Program(context, source); -program.build(devices); - -// Create kernel object -cl::Kernel kernel(program, "${kernelName}"); - -`; - } - static BufferDecl(bufferName, bufferKind, bufferSize) { - return `cl::Buffer ${bufferName} = cl::Buffer(context, ${bufferKind}, ${bufferSize}); - -`; - } - static BufferCopyIn(bufferName, bufferSize, argName) { - return `queue.enqueueWriteBuffer(${bufferName}, CL_TRUE, 0, ${bufferSize}, ${argName}); - -`; - } -} -/* ------------------------- PRIVATE CLASSES ------------------------ */ -class Buffer { - _kind; - _paramName; - _baseType; - _index; - _size; - _argName; - _bufferName; - constructor(kind, paramName, baseType, index, size, argName, bufferName) { - this._kind = kind; - this._paramName = paramName; - this._baseType = baseType; - this._index = index; - this._size = size; - this._argName = argName; - this._bufferName = bufferName; - } -} -/* ------------------------------ ENUMS ----------------------------- */ -var BufferKind; -(function (BufferKind) { - BufferKind["INPUT"] = "CL_MEM_READ_ONLY"; - BufferKind["OUTPUT"] = "CL_MEM_WRITE_ONLY"; - BufferKind["INPUT_OUTPUT"] = "CL_MEM_READ_WRITE"; -})(BufferKind || (BufferKind = {})); -var DeviceType; -(function (DeviceType) { - DeviceType["CL_DEVICE_TYPE_ALL"] = "CL_DEVICE_TYPE_ALL"; - DeviceType["CL_DEVICE_TYPE_CPU"] = "CL_DEVICE_TYPE_CPU"; - DeviceType["CL_DEVICE_TYPE_GPU"] = "CL_DEVICE_TYPE_GPU"; - DeviceType["CL_DEVICE_TYPE_ACCELERATOR"] = "CL_DEVICE_TYPE_ACCELERATOR"; - DeviceType["CL_DEVICE_TYPE_DEFAULT"] = "CL_DEVICE_TYPE_DEFAULT"; -})(DeviceType || (DeviceType = {})); -var ErrorHandling; -(function (ErrorHandling) { - ErrorHandling[ErrorHandling["EXIT"] = 0] = "EXIT"; - ErrorHandling[ErrorHandling["RETURN"] = 1] = "RETURN"; - ErrorHandling[ErrorHandling["USER"] = 2] = "USER"; -})(ErrorHandling || (ErrorHandling = {})); -//# sourceMappingURL=KernelReplacer.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacerAuto.js b/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacerAuto.js deleted file mode 100644 index df426374d8..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opencl/KernelReplacerAuto.js +++ /dev/null @@ -1,30 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { Pragma } from "../../Joinpoints.js"; -import KernelReplacer from "./KernelReplacer.js"; -// This aspect can be included in a library, imported and -// called by a user, since it needs no configuration/parameterization -export default function KernelReplacerAuto() { - // look for pragma - for (const $pragma of Query.search(Pragma, "clava")) { - const $file = $pragma.target.getAncestor("file"); - if (!$pragma.content.startsWith("opencl_call")) { - continue; - } - const configFilename = Strings.extractValue("opencl_call", $pragma.content)?.trim(); - const configFile = Io.getAbsolutePath($file.path, configFilename); - if (!Io.isFile(configFile)) { - console.log(`Expected to find the config file '${configFilename}' in the folder '${$file.path}'`); - continue; - } - const config = Io.readJson(configFile); - const $call = $pragma.target.getDescendants("call")[0]; - const kernel = new KernelReplacer($call, config.kernelName, config.kernelFile, config.bufferSizes, config.localSize, config.iterNumbers); - for (const outBuf of config.outputBuffers) { - kernel.setOutput(outBuf); - } - kernel.replaceCall(); - } -} -//# sourceMappingURL=KernelReplacerAuto.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCall.js b/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCall.js deleted file mode 100644 index 1128bbd169..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCall.js +++ /dev/null @@ -1,87 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Platforms from "@specs-feup/lara/api/lara/Platforms.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import OpenCLCallVariables from "./OpenCLCallVariables.js"; -export default class OpenCLCall { - $kernel = undefined; - deviceId = 1; - setKernel($function) { - if (!$function.getAncestor("file").isOpenCL) { - throw new Error("OpenCLCall.setKernel: expected a function in an OpenCL file"); - } - this.$kernel = $function; - } - setDeviceId(deviceId) { - this.deviceId = deviceId; - } - replaceCall($call) { - this.replaceCallPreconditions(); - // Add include - this.addOpenCLInclude($call); - // Generate id - const id = IdGenerator.next("opencl_call_"); - const variables = new OpenCLCallVariables(id); - this.loadKernelFile($call, variables); - this.clInit($call, variables); - } - replaceCallPreconditions() { - if (this.$kernel == undefined) { - throw new Error("OpenCLCall._replaceCallPreconditions: Expected kernel to be set"); - } - } - addOpenCLInclude($call) { - const $file = $call.getAncestor("file"); - // If MacOS, add include - if (Platforms.isMac()) { - $file.addInclude("OpenCL/opencl.h", true); - return; - } - // Otherwise, - $file.addInclude("CL/cl.h", true); - } - loadKernelFile($call, variables) { - // Get necessary data - const $kernelFile = $call.getAncestor("file"); - const kernelPath = $kernelFile.relativeFilepath; - const kernelFileBytes = Io.getPath($kernelFile.filepath).length; - // Insert before the call - $call.insertBefore(`// Load the kernel source code into the array -FILE *${variables.getKernelFile()} = fopen("${kernelPath}", "r"); -if (!${variables.getKernelFile()}) { - fprintf(stdout, "Failed to load kernel.\n"); - exit(1); -} -char *${variables.getKernelString()} = (char*)malloc(${kernelFileBytes}); -size_t ${variables.getKernelStringSize()} = fread(${variables.getKernelString()}, 1, ${kernelFileBytes}, ${variables.getKernelFile()}); -fclose(${variables.getKernelFile()});`); - } - /** - * This only needs to be done once per function - */ - clInit($call, variables) { - // TODO: Set of functions where this has been called - // Insert before the call - $call.insertBefore(`cl_int ${variables.getErrorCode()}; -cl_uint ${variables.getNumPlatforms()}; -cl_platform_id ${variables.getPlatformId()}; - -// Check the number of platforms -${variables.getErrorCode()} = clGetPlatformIDs(0, NULL, &${variables.getNumPlatforms()}); -if(${variables.getErrorCode()} != CL_SUCCESS) { - fprintf(stderr, "[OpenCL] Error getting number of platforms\n"); - exit(1); -} else if(${variables.getNumPlatforms()} == 0) { - fprintf(stderr, "[OpenCL] No platforms found.\n"); - exit(1); -} else { - printf("[OpenCL] Number of platforms is %d\n",${variables.getNumPlatforms()}); -} - -${variables.getErrorCode()} = clGetPlatformIDs(${this.deviceId}, &${variables.getPlatformId()}, NULL); -if(${variables.getErrorCode()} != CL_SUCCESS) { - fprintf(stderr, "[OpenCL] Error getting platform ID for device ${this.deviceId}.\n"); - exit(1); -}`); - } -} -//# sourceMappingURL=OpenCLCall.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCallVariables.js b/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCallVariables.js deleted file mode 100644 index 843c5ef31e..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opencl/OpenCLCallVariables.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Contains information about the variables created when inserting an OpenCL call. - */ -export default class OpenCLCallVariables { - id; - constructor(id) { - this.id = id; - } - getKernelFile() { - return this.id + "_kernel_file"; - } - getKernelString() { - return this.id + "_kernel_string"; - } - getKernelStringSize() { - return this.id + "_kernel_string_size"; - } - getErrorCode() { - return "opencl_error_code"; - } - getNumPlatforms() { - return "opencl_num_platforms"; - } - getPlatformId() { - return "opencl_platform_id"; - } -} -//# sourceMappingURL=OpenCLCallVariables.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opt/Inlining.js b/ClavaLaraApi/src-lara/clava/clava/opt/Inlining.js deleted file mode 100644 index e96e8eee34..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opt/Inlining.js +++ /dev/null @@ -1,27 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { FunctionJp } from "../../Joinpoints.js"; -import Inliner from "../code/Inliner.js"; -import NormalizeToSubset from "./NormalizeToSubset.js"; -import PrepareForInlining from "./PrepareForInlining.js"; -/** - * - * @param options - Object with options. See default value for supported options - */ -export default function Inlining(options = { - normalizeToSubset: { simplifyLoops: { forToWhile: true } }, - inliner: {}, -}) { - // TODO: Maybe passing a NormalizeToSubset instance is preferrable, but that means making NormalizeToSubset a class instead of a function - NormalizeToSubset(Query.root(), options.normalizeToSubset); - const inliner = new Inliner(options.inliner); - for (const $function of Query.search(FunctionJp, { - name: (name) => name !== "main", - isImplementation: true, // Only inline if function has a body - })) { - PrepareForInlining($function); - } - for (const $function of Query.search(FunctionJp, "main")) { - inliner.inlineFunctionTree($function); - } -} -//# sourceMappingURL=Inlining.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opt/NormalizeToSubset.js b/ClavaLaraApi/src-lara/clava/clava/opt/NormalizeToSubset.js deleted file mode 100644 index 9782683eed..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opt/NormalizeToSubset.js +++ /dev/null @@ -1,35 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BinaryOp } from "../../Joinpoints.js"; -import SimplifyAssignment from "../code/SimplifyAssignment.js"; -import StatementDecomposer from "../code/StatementDecomposer.js"; -import DecomposeDeclStmt from "../pass/DecomposeDeclStmt.js"; -import DecomposeVarDeclarations from "../pass/DecomposeVarDeclarations.js"; -import LocalStaticToGlobal from "../pass/LocalStaticToGlobal.js"; -import SimplifyLoops from "../pass/SimplifyLoops.js"; -import SimplifyReturnStmts from "../pass/SimplifyReturnStmts.js"; -import SimplifySelectionStmts from "../pass/SimplifySelectionStmts.js"; -/** - * - * @param $startJp - - * @param options - Object with options. See default value for supported options. - */ -export default function NormalizeToSubset($startJp, options = { simplifyLoops: { forToWhile: true } }) { - const _options = options; - const declStmt = new DecomposeDeclStmt(); - const varDecls = new DecomposeVarDeclarations(); - const statementDecomposer = new StatementDecomposer(); - const simplifyLoops = new SimplifyLoops(statementDecomposer, _options["simplifyLoops"]); - const simplifyIfs = new SimplifySelectionStmts(statementDecomposer); - const simplifyReturns = new SimplifyReturnStmts(statementDecomposer); - const localStaticToGlobal = new LocalStaticToGlobal(); - simplifyLoops.apply($startJp); - simplifyIfs.apply($startJp); - simplifyReturns.apply($startJp); - declStmt.apply($startJp); - varDecls.apply($startJp); - localStaticToGlobal.apply($startJp); - for (const $assign of Query.searchFrom($startJp, BinaryOp, (jp) => jp.isAssignment && jp.operator !== "=")) { - SimplifyAssignment($assign); - } -} -//# sourceMappingURL=NormalizeToSubset.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/opt/PrepareForInlining.js b/ClavaLaraApi/src-lara/clava/clava/opt/PrepareForInlining.js deleted file mode 100644 index 8f3d2870c4..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/opt/PrepareForInlining.js +++ /dev/null @@ -1,7 +0,0 @@ -import RemoveShadowing from "../code/RemoveShadowing.js"; -import SingleReturnFunction from "../pass/SingleReturnFunction.js"; -export default function PrepareForInlining($function) { - new SingleReturnFunction().apply($function); - RemoveShadowing($function); -} -//# sourceMappingURL=PrepareForInlining.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/parser/BatchParser.js b/ClavaLaraApi/src-lara/clava/clava/parser/BatchParser.js deleted file mode 100644 index f57d7caa2a..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/parser/BatchParser.js +++ /dev/null @@ -1,140 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import Check from "@specs-feup/lara/api/lara/Check.js"; -import System from "@specs-feup/lara/api/lara/System.js"; -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import Clava from "../Clava.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import { FileJp } from "../../Joinpoints.js"; -/** - * Parses C/C++ files. - */ -export default class BatchParser { - basePath; - /** - * The source files found on the given path - */ - sourceFiles; - /** - * Maps header file names to the corresponding File objects - */ - headerFilesMap = new Map(); - static _IMPLEMENTATION_PATTERNS = ["*.c", "*.cpp"]; - static _HEADER_PATTERNS = ["*.h", "*.hpp"]; - constructor(srcPath) { - this.basePath = srcPath; - this.sourceFiles = Io.getFiles(srcPath, BatchParser._IMPLEMENTATION_PATTERNS, true); - const headerFiles = Io.getFiles(srcPath, BatchParser._HEADER_PATTERNS, true); - for (const headerFile of headerFiles) { - this.headerFilesMap.set(headerFile.getName(), headerFile); - } - } - getSourceFiles() { - return this.sourceFiles; - } - parse(sourceFile) { - debug("Parsing " + sourceFile.toString() + "..."); - const parsingStart = System.nanos(); - const $literalFile = Clava.getProgram().addFileFromPath(sourceFile); - // Rebuild tree - const $parsedFile = this.rebuildFile($literalFile); - const parsingTime = System.toc(parsingStart); - debug("Parsing took " + parsingTime); - return $parsedFile; - } - /** - * Tries to rebuild the current tree, using several methods to fix any problem it finds - */ - rebuildFile($literalFile) { - let parsing = true; - while (parsing) { - const $parsedFile = $literalFile.rebuildTry(); - // Check if it is a file - if ($parsedFile instanceof FileJp) { - return $parsedFile; - } - // It is an exception - parsing = this.solveRebuildFile($parsedFile, $literalFile); - } - return undefined; - } - solveRebuildFile($exception, $literalFile) { - // Get error message - const message = $exception.message; - // Check if correct type - if ($exception.exceptionType !== "ClavaParserException") { - throw $exception.exception; - } - const lines = Strings.asLines(message); - // Check first line - if (lines === undefined || lines.length === 0) { - throw new Error("Could not parse error message: " + message); - } - Check.strings(lines[0], "There are errors in the source code:"); - // Parse first error - return this.parseError(lines.subList(1, lines.length), $literalFile); - } - parseError(lines, $literalFile) { - const errorLine = lines[0]; - const filename = $literalFile.name; - // Find name of file in line - const nameIndex = errorLine.indexOf(filename); - if (nameIndex === -1) { - throw "Could not find filename '" + filename + "' in " + errorLine; - } - // Remove filename - let parsedLine = errorLine - .substring(nameIndex + filename.length, errorLine.length) - .trim(); - // Remove location - const locationSep = parsedLine.indexOf(" "); - if (locationSep !== -1) { - parsedLine = parsedLine - .substring(locationSep + 1, parsedLine.length) - .trim(); - } - // Check if fatal error - if (parsedLine.startsWith("fatal error:")) { - const fatalError = "fatal error:"; - parsedLine = parsedLine - .substring(fatalError.length, parsedLine.length) - .trim(); - return this.parseFatalError(parsedLine); - } - console.log("Line 0: " + lines[0]); - console.log("Parsed line: " + parsedLine); - return false; - } - parseFatalError(error) { - if (error.endsWith("' file not found")) { - const fileNotFound = "' file not found"; - const endIndex = error.length - fileNotFound.length; - let parsedError = error.substring(0, endIndex).trim(); - if (!parsedError.startsWith("'")) { - throw "Expected file not found string to start with ':" + parsedError; - } - parsedError = parsedError.substring(1, parsedError.length).trim(); - // Normalize - parsedError.replace("\\\\", "/"); - let filename = parsedError; - let path = undefined; - // Extract path - const slashIndex = parsedError.lastIndexOf("/"); - if (slashIndex !== -1) { - filename = parsedError.substring(slashIndex + 1); - path = parsedError.substring(0, slashIndex); - } - console.log("File: " + filename); - console.log("Path: " + path); - let pathname = filename; - if (path !== undefined) { - pathname = path + "/" + filename; - } - debug("Adding file " + pathname); - const newFile = ClavaJoinPoints.file(filename, path); - Clava.getProgram().addFile(newFile); - return true; - } - } -} -//# sourceMappingURL=BatchParser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeDeclStmt.js b/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeDeclStmt.js deleted file mode 100644 index 6a084a1243..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeDeclStmt.js +++ /dev/null @@ -1,46 +0,0 @@ -import SimplePass from "@specs-feup/lara/api/lara/pass/SimplePass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import { DeclStmt } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Decomposes composite declaration statements into separate statements for each variable. - * - * This means that a declaration like: - * - * ```c - * int a, b = 10, c; - * ``` - * - * Will be decomposed to: - * - * ```c - * int a; - * int b = 10; - * int c; - * ``` - */ -export default class DecomposeDeclStmt extends SimplePass { - _name = "DecomposeDeclStmt"; - matchJoinpoint($jp) { - if (!($jp instanceof DeclStmt)) { - return false; - } - if ($jp.numChildren <= 1) { - return false; - } - return true; - } - transformJoinpoint($jp) { - let $firstDeclStmt = undefined; - for (const $decl of $jp.decls) { - const $singleDeclStmt = ClavaJoinPoints.declStmt($decl); - if (!$firstDeclStmt) { - $firstDeclStmt = $singleDeclStmt; - } - $jp.insertBefore($singleDeclStmt); - } - $jp.detach(); - return new PassResult(this, $firstDeclStmt); - } -} -//# sourceMappingURL=DecomposeDeclStmt.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeVarDeclarations.js b/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeVarDeclarations.js deleted file mode 100644 index b31bc77102..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/DecomposeVarDeclarations.js +++ /dev/null @@ -1,40 +0,0 @@ -import SimplePass from "@specs-feup/lara/api/lara/pass/SimplePass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import { ArrayType, UndefinedType, Vardecl, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Decomposes the vardecl nodes that are reachable from the given join point. - * - * E.g. transforms int i = 0; into int i; i = 0; - * - * Does not support decomposition for variables that are arrays, in those cases the code stays unchanged. - */ -export default class DecomposeVarDeclarations extends SimplePass { - _name = "DecomposeVarDeclarations"; - matchJoinpoint($jp) { - return ($jp instanceof Vardecl && // Must be a variable declaration - $jp.hasInit && // Must have initialization - $jp.initStyle === "cinit" && // Only C-style initializations - !$jp.isGlobal && // Ignore global variables - !$jp.isInsideHeader && // Ignore if inside any header (e.g. if, switch, loop...) - !($jp.type instanceof ArrayType) && // Ignore if array - !this.isLiteralAuto($jp) // Specific case of vardecl in literal code that uses auto (e.g. as inserted by Timer) - ); - } - isLiteralAuto($jp) { - return $jp.type.isAuto && $jp.init.type instanceof UndefinedType; - } - transformJoinpoint($vardecl) { - // store init expression for later - const $init = $vardecl.init; - // remove init from ast and make type explicit, if necessary - $vardecl.removeInit(); - if ($vardecl.type.isAuto) { - $vardecl.type = $init.type; - } - const $newInitStmt = ClavaJoinPoints.exprStmt(ClavaJoinPoints.assign(ClavaJoinPoints.varRef($vardecl), $init)); - $vardecl.insertAfter($newInitStmt); - return new PassResult(this, $vardecl); - } -} -//# sourceMappingURL=DecomposeVarDeclarations.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/LocalStaticToGlobal.js b/ClavaLaraApi/src-lara/clava/clava/pass/LocalStaticToGlobal.js deleted file mode 100644 index 66f777efa2..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/LocalStaticToGlobal.js +++ /dev/null @@ -1,66 +0,0 @@ -import PassTransformationError from "@specs-feup/lara/api/lara/pass/PassTransformationError.js"; -import SimplePass from "@specs-feup/lara/api/lara/pass/SimplePass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import { DeclStmt, StorageClass, Vardecl, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -/** - * Transforms local static variables into global variables. - * - * This means that code like this: - * - * ```c - * int foo() { - * static int x = 10; - * return x; - * } - * ``` - * - * Will be transformed into: - * - * ```c - * int foo_static_x = 10; - * - * int foo() { - * return foo_static_x; - * } - * ``` - */ -export default class LocalStaticToGlobal extends SimplePass { - _name = "LocalStaticToGlobal"; - matchJoinpoint($jp) { - // Only vardecls - if (!($jp instanceof Vardecl)) { - return false; - } - // With static storage - if ($jp.storageClass !== StorageClass.STATIC) { - return false; - } - // Inside functions - not sure if this is needed - if ($jp.getAncestor("function") === undefined) { - return false; - } - return true; - } - transformJoinpoint($jp) { - const $function = $jp.getAncestor("function"); - if (!$function) { - throw new PassTransformationError(this, $jp, "Expected ancestor of type function, found 'undefined'"); - } - const newName = $function.name + "_static_" + $jp.name; - $jp.name = newName; - $jp.storageClass = StorageClass.NONE; - const $declStmt = $jp.parent; - if (!($declStmt instanceof DeclStmt)) { - throw new PassTransformationError(this, $jp, "Expected declStmt, found '" + $declStmt.joinPointType + "'"); - } - $jp.detach(); - $function.insertBefore($jp); - // Remove declStmt if empty - if ($declStmt.decls.length === 0) { - $declStmt.detach(); - } - return new PassResult(this, ClavaJoinPoints.emptyStmt()); - } -} -//# sourceMappingURL=LocalStaticToGlobal.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyLoops.js b/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyLoops.js deleted file mode 100644 index dca872b41b..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyLoops.js +++ /dev/null @@ -1,75 +0,0 @@ -import Pass from "@specs-feup/lara/api/lara/pass/Pass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import { DeclStmt, Loop } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import DoToWhileStmt from "../code/DoToWhileStmt.js"; -import ForToWhileStmt from "../code/ForToWhileStmt.js"; -export default class SimplifyLoops extends Pass { - _name = "SimplifyLoops"; - statementDecomposer; - options; - label_suffix = 0; - /** - * - * @param statementDecomposer - - * @param options - Object with options. Supported options: 'forToWhile' (default: true), transforms for loops into while loops - */ - constructor(statementDecomposer, options = { forToWhile: true }) { - super(); - this.statementDecomposer = statementDecomposer; - this.options = options; - } - _apply_impl($jp) { - let appliedPass = false; - for (const $loop of this._findLoops($jp)) { - appliedPass = true; - if (this.options.forToWhile) { - const $whileLoop = this.makeWhileLoop($loop); - this.transform($whileLoop); - } - } - return new PassResult(this, $jp, { - appliedPass: appliedPass, - insertedLiteralCode: true, - }); - } - *_findLoops($jp) { - for (const child of $jp.children) { - yield* this._findLoops(child); - } - if ($jp instanceof Loop && - ($jp.kind === "for" || $jp.kind === "dowhile" || $jp.kind === "while")) { - yield $jp; - } - } - makeWhileLoop($loop) { - if ($loop.kind === "for") { - const $forToWhileScope = ForToWhileStmt($loop, this.label_suffix++); - return $forToWhileScope.children[1]; - } - else if ($loop.kind === "dowhile") { - return DoToWhileStmt($loop, this.label_suffix++); - } - else { - return $loop; - } - } - transform($whileLoop) { - const $loopCond = $whileLoop.cond; - const decomposeResult = this.statementDecomposer.decomposeExpr($loopCond.expr); - for (const stmt of decomposeResult.precedingStmts) { - $whileLoop.insertBefore(stmt); - } - for (const stmt of decomposeResult.succeedingStmts) { - $whileLoop.insertAfter(stmt); - } - for (const stmt of decomposeResult.succeedingStmts.slice().reverse()) { - $whileLoop.body.insertBegin(stmt); - } - for (const stmt of decomposeResult.precedingStmts.filter(($stmt) => !($stmt instanceof DeclStmt))) { - $whileLoop.body.insertEnd(stmt); - } - $whileLoop.cond.replaceWith(ClavaJoinPoints.exprStmt(decomposeResult.$resultExpr)); - } -} -//# sourceMappingURL=SimplifyLoops.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyReturnStmts.js b/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyReturnStmts.js deleted file mode 100644 index d72d8202eb..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifyReturnStmts.js +++ /dev/null @@ -1,45 +0,0 @@ -import Pass from "@specs-feup/lara/api/lara/pass/Pass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { ReturnStmt } from "../../Joinpoints.js"; -// TODO: Refactor to use the SimplePass pattern -export default class SimplifyReturnStmts extends Pass { - _name = "SimplifyReturnStmts"; - statementDecomposer; - constructor(statementDecomposer) { - super(); - this.statementDecomposer = statementDecomposer; - } - _apply_impl($jp) { - let appliedPass = false; - for (const $returnStmt of Query.searchFromInclusive($jp, ReturnStmt)) { - const transformed = this.transform($returnStmt); - // If any change, mark as applied - if (transformed) { - appliedPass = true; - } - } - return new PassResult(this, $jp, { - appliedPass: appliedPass, - insertedLiteralCode: false, - }); - } - /** - * - * @param $returnStmt - - * @returns true if there were changes, false otherwise - */ - transform($returnStmt) { - const decomposeResult = this.statementDecomposer.decompose($returnStmt); - if (decomposeResult.length === 0) { - return false; - } - // Returns a list of stmts, replace with current return - for (const stmt of decomposeResult) { - $returnStmt.insertBefore(stmt); - } - $returnStmt.detach(); - return true; - } -} -//# sourceMappingURL=SimplifyReturnStmts.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifySelectionStmts.js b/ClavaLaraApi/src-lara/clava/clava/pass/SimplifySelectionStmts.js deleted file mode 100644 index 73c4064da0..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/SimplifySelectionStmts.js +++ /dev/null @@ -1,37 +0,0 @@ -import Pass from "@specs-feup/lara/api/lara/pass/Pass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { If } from "../../Joinpoints.js"; -// TODO: Refactor to use the SimplePass pattern -export default class SimplifySelectionStmts extends Pass { - _name = "SimplifySelectionStmts"; - statementDecomposer; - constructor(statementDecomposer) { - super(); - this.statementDecomposer = statementDecomposer; - } - _apply_impl($jp) { - let appliedPass = false; - for (const $if of Query.searchFromInclusive($jp, If)) { - appliedPass = true; - this.transform($if); - } - return new PassResult(this, $jp, { - appliedPass: appliedPass, - insertedLiteralCode: false, - }); - } - transform($ifStmt) { - const $ifCond = $ifStmt.cond; - const decomposeResult = this.statementDecomposer.decomposeExpr($ifCond); - for (const stmt of decomposeResult.precedingStmts) { - $ifStmt.insertBefore(stmt); - } - for (const stmt of decomposeResult.succeedingStmts.slice().reverse()) { - $ifStmt.then.insertBegin(stmt); - $ifStmt.else.insertBegin(stmt); - } - $ifStmt.cond.replaceWith(decomposeResult.$resultExpr); - } -} -//# sourceMappingURL=SimplifySelectionStmts.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/SingleReturnFunction.js b/ClavaLaraApi/src-lara/clava/clava/pass/SingleReturnFunction.js deleted file mode 100644 index 1d25f4fa63..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/SingleReturnFunction.js +++ /dev/null @@ -1,62 +0,0 @@ -import Pass from "@specs-feup/lara/api/lara/pass/Pass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BuiltinType, FunctionJp, ReturnStmt, } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import DecomposeVarDeclarations from "./DecomposeVarDeclarations.js"; -export default class SingleReturnFunction extends Pass { - _name = "SingleReturnFunctions"; - useLocalLabel; - constructor(useLocalLabel = false) { - super(); - this.useLocalLabel = useLocalLabel; - } - _apply_impl($jp) { - if (!($jp instanceof FunctionJp) || !$jp.isImplementation) { - return this.new_result($jp, false); - } - const $body = $jp.body; - const $returnStmts = Query.searchFrom($body, ReturnStmt).get(); - if ($returnStmts.length === 0 || - ($returnStmts.length === 1 && $body.lastChild instanceof ReturnStmt)) { - return this.new_result($jp, false); - } - // C++ spec has some restrictions about jumping over initialized values that - // would be invalidated by the generated code, so we need to decompose variable - // declarations first - new DecomposeVarDeclarations().apply($body); - const $label = ClavaJoinPoints.labelDecl("__return_label"); - $body.insertEnd(ClavaJoinPoints.labelStmt($label)); - const returnType = $jp.returnType; - const returnIsVoid = returnType instanceof BuiltinType && returnType.builtinKind === "Void"; - let $local = undefined; - if (returnIsVoid) { - $body.insertEnd(ClavaJoinPoints.returnStmt()); - } - else { - $local = $body.addLocal("__return_value", returnType); - $body.insertEnd(ClavaJoinPoints.returnStmt(ClavaJoinPoints.varRef($local))); - } - for (const $returnStmt of $returnStmts) { - if (!returnIsVoid) { - $returnStmt.insertBefore( - // null safety: $local is initialized whenever return is not void - ClavaJoinPoints.assign(ClavaJoinPoints.varRef($local), $returnStmt.returnExpr)); - } - $returnStmt.insertBefore(ClavaJoinPoints.gotoStmt($label)); - $returnStmt.detach(); - } - // Local label declaration must appear at the beginning of the block - if (this.useLocalLabel) { - $body.insertBegin($label); - } - return this.new_result($jp, true); - } - new_result($jp, appliedPass) { - return new PassResult(this, $jp, { - appliedPass: appliedPass, - insertedLiteralCode: false, - }); - } -} -//# sourceMappingURL=SingleReturnFunction.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/pass/TransformSwitchToIf.js b/ClavaLaraApi/src-lara/clava/clava/pass/TransformSwitchToIf.js deleted file mode 100644 index b5447b642d..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/pass/TransformSwitchToIf.js +++ /dev/null @@ -1,212 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import SimplePass from "@specs-feup/lara/api/lara/pass/SimplePass.js"; -import PassResult from "@specs-feup/lara/api/lara/pass/results/PassResult.js"; -import { Break, GotoStmt, Switch, } from "../../Joinpoints.js"; -/** - * Transforms a switch statement into an if statement. - * - * This means that code like this: - * - * ```c - * int num = 1, a; - * - * switch (num) { - * case 1: - * a = 10; - * default: - * a = 30; - * break; - * case 2: - * a = 20; - * break; - * case 3 ... 7: - * a = 30; - * } - * ``` - * - * Will be transformed into: - * - * ```c - * int num = 1, a; - * - * if (num == 1) - * goto case_1; - * else if (num == 2) - * goto case_2; - * else if (num >= 3 && num <= 7) - * goto case_3_7; - * else - * goto case_default; - * - * case_1: - * a = 10; - * case_default: - * a = 80; - * goto switch_exit; - * case_2: - * a = 20; - * goto switch_exit; - * case_3_7: - * a = 30; - * - * switch_exit: - * ; - * ``` - */ -export default class TransformSwitchToIf extends SimplePass { - /** - * Name of the pass - */ - _name = "TransformSwitchToIf"; - /** - * Maps each case statement id to the corresponding label statement - */ - caseLabels = new Map(); - /** - * A list with the corresponding if statement for each case in the switch statement. For the default case, the list keeps its goto statement - */ - caseIfStmts = []; - /** - * If true, uses deterministic ids for the labels (e.g. switch_exit_0, sw1_case_3...). Otherwise, uses $jp.astId whenever possible. - */ - deterministicIds; - /** - * Current switch id, in case deterministic ids are used - */ - currentId; - /** - * @param deterministicIds - If true, uses deterministic ids for the labels (e.g. switch_exit_0, sw1_case_3, ...). Otherwise, uses $jp.astId whenever possible. - */ - constructor(deterministicIds = false) { - super(); - this.deterministicIds = deterministicIds; - this.currentId = 0; - } - matchJoinpoint($jp) { - return $jp instanceof Switch; - } - /** - * Transformation to be applied to matching joinpoints - * @override - * @param $jp - Join point to transform - */ - transformJoinpoint($jp) { - this.currentId++; - const exitName = "switch_exit_" + (this.deterministicIds ? this.currentId : $jp.astId); - const $switchExitLabel = ClavaJoinPoints.labelDecl(exitName); - const $switchExitLabelStmt = ClavaJoinPoints.labelStmt($switchExitLabel); - const $switchExitGoTo = ClavaJoinPoints.gotoStmt($switchExitLabel); - // Insert the switch exit label and an empty statement if needed - $jp.insertAfter($switchExitLabelStmt); - if ($switchExitLabelStmt.isLast) - $switchExitLabelStmt.insertAfter(ClavaJoinPoints.emptyStmt()); - this.computeIfAndLabels($jp); - if ($jp.hasDefaultCase) - this.moveDefaultToEnd(); - else - this.caseIfStmts.push($switchExitGoTo); - $jp.insertBefore(this.caseIfStmts[0]); - this.linkIfStmts(); - this.replaceBreakWithGoto($jp, $switchExitGoTo); - this.addLabelsAndInstructions($jp); - $jp.detach(); - return new PassResult(this, this.caseIfStmts[0]); - } - /** - * Generates the label based on the switch ID and the values of the provided case statement. - * If no switch ID is provided, a generic label based on the case statement's AST ID is returned. - * @param $caseStmt - The case statement - * @returns The generated label name for the provided case statement - */ - computeLabelName($caseStmt) { - if (!this.deterministicIds) - return "case_" + $caseStmt.astId; - let labelName = "sw" + this.currentId; - if ($caseStmt.isDefault) - labelName += "_default"; - else if ($caseStmt.values.length == 1) - labelName += `_case_${$caseStmt.values[0].code}`; - else - labelName += `_case_${$caseStmt.values[0].code}_to_${$caseStmt.values[1].code}`; - return labelName; - } - /** - * Creates if and label statements for each case in the provided switch statement and adds them to the private fields "caseIfStmts" and "caseLabels". - * @param $jp - The switch statement - */ - computeIfAndLabels($jp) { - const $switchCondition = $jp.condition; - this.caseLabels = new Map(); - this.caseIfStmts.length = 0; - for (const $case of $jp.cases) { - const labelName = this.computeLabelName($case); - const $labelDecl = ClavaJoinPoints.labelDecl(labelName); - const $goto = ClavaJoinPoints.gotoStmt($labelDecl); - const $labelStmt = ClavaJoinPoints.labelStmt($labelDecl); - this.caseLabels.set($case.astId, $labelStmt); - if ($case.isDefault) { - this.caseIfStmts.push($goto); - continue; - } - let $ifCondition; - if ($case.values.length == 1) - $ifCondition = ClavaJoinPoints.binaryOp("==", $switchCondition, $case.values[0], "boolean"); - else { - const $binOpGE = ClavaJoinPoints.binaryOp(">=", $switchCondition, $case.values[0], "boolean"); - const $binOpLE = ClavaJoinPoints.binaryOp("<=", $switchCondition, $case.values[1], "boolean"); - $ifCondition = ClavaJoinPoints.binaryOp("&&", $binOpGE, $binOpLE, "boolean"); - } - const $ifStmt = ClavaJoinPoints.ifStmt($ifCondition, $goto); - this.caseIfStmts.push($ifStmt); - } - } - /** - * Reorders the private field "caseIfStmts" by moving the goto statement of the intermediate default case to the end. - */ - moveDefaultToEnd() { - const index = this.caseIfStmts.findIndex(($condition) => $condition instanceof GotoStmt); - if (index !== -1) - this.caseIfStmts.push(this.caseIfStmts.splice(index, 1)[0]); - } - /** - * Links the statements stored in the private field "caseIfStmts" by setting the body of their else as the next statement in the list - */ - linkIfStmts() { - for (let i = 0; i < this.caseIfStmts.length - 1; i++) { - const $ifStmt = this.caseIfStmts[i]; - if ($ifStmt instanceof GotoStmt) { - throw new Error("Unexpected goto statement in the middle of the switch"); - } - const $nextIfStmt = this.caseIfStmts[i + 1]; - $ifStmt.setElse($nextIfStmt); // The condition "i < this.caseIfStmts.length - 1" guarantees that $ifStmt will always be of type If but it is very poor code. - } - } - /** - * Replaces the break statements that refer to the exit of the provided switch statement with goto statements. - * @param $jp - The switch statement - * @param $switchExitGoTo - The goto statement that corresponds to the switch exit. This statement will be used to replace the break statements - */ - replaceBreakWithGoto($jp, $switchExitGoTo) { - const $breakStmts = Query.searchFromInclusive($jp, Break, { - enclosingStmt: (enclosingStmt) => enclosingStmt.astId === $jp.astId, - }); - for (const $break of $breakStmts) - $break.replaceWith($switchExitGoTo); - } - /** - * Inserts the label and instructions of each case in the provided switch statement - * @param $jp - the switch statement - */ - addLabelsAndInstructions($jp) { - for (const $case of $jp.cases) { - const $caseLabel = this.caseLabels.get($case.astId); - if ($caseLabel != undefined) { - $jp.insertBefore($caseLabel); - } - for (const $inst of $case.instructions) - $jp.insertBefore($inst); - } - } -} -//# sourceMappingURL=TransformSwitchToIf.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/stats/OpsBlock.js b/ClavaLaraApi/src-lara/clava/clava/stats/OpsBlock.js deleted file mode 100644 index 6ae009b63f..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/stats/OpsBlock.js +++ /dev/null @@ -1,14 +0,0 @@ -import OpsCost from "./OpsCost.js"; -export default class OpsBlock { - id; - cost = new OpsCost(); - nestedOpsBlocks = []; - repetitions = "1"; - constructor(id) { - this.id = id; - } - add(opsId) { - this.cost.increment(opsId); - } -} -//# sourceMappingURL=OpsBlock.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/stats/OpsCost.js b/ClavaLaraApi/src-lara/clava/clava/stats/OpsCost.js deleted file mode 100644 index af8f715756..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/stats/OpsCost.js +++ /dev/null @@ -1,13 +0,0 @@ -export default class OpsCost { - ops = new Map(); - toString() { - const entries = Array.from(this.ops.entries()); - const strings = entries.map(([key, value]) => `${key}=${value}`); - return "{" + strings.join(", ") + "}"; - } - increment(opsId) { - const currentValue = this.ops.get(opsId) ?? 0; - this.ops.set(opsId, currentValue + 1); - } -} -//# sourceMappingURL=OpsCost.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/stats/OpsCounter.js b/ClavaLaraApi/src-lara/clava/clava/stats/OpsCounter.js deleted file mode 100644 index 816a468921..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/stats/OpsCounter.js +++ /dev/null @@ -1,167 +0,0 @@ -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -import GlobalVariable from "../code/GlobalVariable.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Logger from "../../lara/code/Logger.js"; -import { BuiltinType, Call, FunctionJp, Op, } from "../../Joinpoints.js"; -/** - * Instruments an application so that it counts total operations in a region of code. - * - * @param filterFunction - Function that receives an $op. If returns false, $op will not be counted. - */ -export default class OpsCounter { - // Whitelist of ops - static validOps = new Set([ - "mul", - "div", - "rem", - "add", - "sub", - "shl", - "shr", - "cmp", - "and", - "xor", - "or", - "l_and", - "l_or", - "mul_assign", - "div_assign", - "rem_assign", - "add_assign", - "sub_assign", - "shl_assign", - "shr_assign", - "and_assign", - "xor_assign", - "or_assign", - "post_inc", - "post_dec", - "pre_inc", - "pre_dec", - ]); - counters = new Map(); - $counterType = ClavaJoinPoints.builtinType("long long"); - instrumentedFunctions = new Set(); - filterFunction; - constructor(filterFunction = ($op) => !$op.isInsideLoopHeader) { - this.filterFunction = filterFunction; - } - instrument($region) { - const $function = $region instanceof FunctionJp - ? $region - : $region.getAncestor("function"); - if ($function === undefined) { - PrintOnce.message(`OpsCounter.instrument: Could not find function corresponding to the region ${$region.location}`); - return; - } - // Check if it is already instrumented - if (this.instrumentedFunctions.has($function.jpId)) { - return; - } - this.instrumentedFunctions.add($function.jpId); - console.log(`OpsCounter.instrument: Instrumenting function ${$function.jpId}`); - // Apply to all ops found in the region - for (const $op of Query.searchFrom($region, Op)) { - this.countOp($op); - } - // Call function recursively when function calls are found - for (const $call of Query.searchFrom($region, Call)) { - const $funcDef = $call.definition; - if ($funcDef === undefined) { - continue; - } - this.instrument($funcDef); - } - } - countOp($op) { - // If not a valid op, return - if (!this.isValidOp($op)) { - return; - } - console.log(`Op (${$op.kind}): ${$op.code}`); - // Always add to ops counter - const opsCounter = this.getCounter("ops", ""); - const opsCounterStmt = ClavaJoinPoints.stmtLiteral(opsCounter.getRef($op).code + "++;"); - $op.insertBefore(opsCounterStmt); - // Calculate type and bitwidth - const $builtinType = this.toBuiltinType($op.type); - const counterType = this.getCounterType($builtinType); - const bitwidth = $builtinType !== undefined ? String($op.bitWidth) : undefined; - // Get counter - const counter = this.getCounter(counterType, bitwidth); - // Add to corresponding counter type - const counterStmt = ClavaJoinPoints.stmtLiteral(counter.getRef($op).code + "++;"); - $op.insertBefore(counterStmt); - } - getCounter(counterType, bitwidth) { - const counterName = this.getCounterPrefix(counterType, bitwidth) + "_counter"; - // Check if counter exists - let counter = this.counters.get(counterName); - if (counter === undefined) { - counter = new GlobalVariable(counterName, this.$counterType, "0"); - this.counters.set(counterName, counter); - } - return counter; - } - getCounterPrefix(counterType, bitwidth = "unknown") { - // If counterType is undefined, return unknown, without looking at the bitwidth - if (counterType === undefined) { - return "unknown"; - } - let counterPrefix = counterType; - if (bitwidth !== "") { - counterPrefix += "_"; - } - counterPrefix += bitwidth; - return counterPrefix; - } - getCounterType($builtinType) { - if ($builtinType === undefined) { - return undefined; - } - if ($builtinType.isFloat) { - return "flops"; - } - else if ($builtinType.isInteger) { - return "iops"; - } - else { - PrintOnce.message(`OpsCounter: could not determine if builtinType ${$builtinType.kind} is integer or float`); - return undefined; - } - } - toBuiltinType($type) { - if ($type instanceof BuiltinType) { - return $type; - } - PrintOnce.message(`OpsCounter: could not determine builtinType of ${$type.joinPointType}`); - return undefined; - } - /** - * Adds code that prints the operation counting report. - */ - log($insertionPoint) { - const logger = new Logger(); - for (const entry of this.counters.entries()) { - const counterName = entry[0]; - const counter = entry[1]; - logger - .text(counterName + ": ") - .longLong(counter.getRef($insertionPoint).code) - .ln(); - } - logger.log($insertionPoint); - } - isValidOp($op) { - const isValid = OpsCounter.validOps.has($op.kind); - if (!isValid) { - return false; - } - if (!this.filterFunction($op)) { - return false; - } - return true; - } -} -//# sourceMappingURL=OpsCounter.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/stats/StaticOpsCounter.js b/ClavaLaraApi/src-lara/clava/clava/stats/StaticOpsCounter.js deleted file mode 100644 index 89952549a9..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/stats/StaticOpsCounter.js +++ /dev/null @@ -1,230 +0,0 @@ -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { BinaryOp, BuiltinType, Call, FunctionJp, Loop, Op, Param, Varref, } from "../../Joinpoints.js"; -import OpsBlock from "./OpsBlock.js"; -export default class StaticOpsCounter { - // Whitelist of ops - static validOps = new Set([ - "mul", - "div", - "rem", - "add", - "sub", - "shl", - "shr", - "cmp", - "and", - "xor", - "or", - "l_and", - "l_or", - "mul_assign", - "div_assign", - "rem_assign", - "add_assign", - "sub_assign", - "shl_assign", - "shr_assign", - "and_assign", - "xor_assign", - "or_assign", - "post_inc", - "post_dec", - "pre_inc", - "pre_dec", - ]); - instrumentedFunctions = new Set(); - filterFunction; - constructor(filterFunction = ($op) => true) { - this.filterFunction = filterFunction; - } - count($fn, opsBlock, includeOpKind = false) { - const $function = $fn instanceof FunctionJp - ? $fn - : $fn.getAncestor("function"); - if ($function === undefined) { - PrintOnce.message(`StaticOpsCounter.count: Could not find function corresponding to the join point ${$fn.location}`); - return; - } - const functionId = `${$function.name}@${$function.location}`; - // Check if it is already instrumented - if (this.instrumentedFunctions.has(functionId)) { - // TODO: Support recursive function calls - return; - } - this.instrumentedFunctions.add(functionId); - console.log("StaticOpsCounter.count: Estimating ops of function " + functionId); - opsBlock ??= new OpsBlock(functionId); - // Go statement-by-statement - $function.body.children.forEach(($stmt) => { - this.countOpStatic($stmt, opsBlock, includeOpKind); - }); - return opsBlock; - } - countOpStatic($stmt, opsBlock, includeOpKind) { - // If stmt is a loop, count new block, recursively - if ($stmt == undefined) { - return; - } - if ($stmt instanceof Loop) { - if ($stmt.kind !== "for") { - console.log(`Ignoring loops that are not 'fors' (location ${$stmt.location}) for now`); - return; - } - const rank = $stmt.rank; - const nestedId = `${opsBlock.id} => ${rank[rank.length - 1]}`; - // Create block for loop - const nestedOpsBlock = new OpsBlock(nestedId); - this.countOpStatic($stmt.init, opsBlock, includeOpKind); - this.countOpStatic($stmt.cond, nestedOpsBlock, includeOpKind); - this.countOpStatic($stmt.step, nestedOpsBlock, includeOpKind); - // Extract iterations - const iter = $stmt.iterationsExpr; - let replacementsMap = {}; - do { - replacementsMap = this.analyseIterationsExpr(iter, $stmt); - for (const rep in replacementsMap) { - for (const $jp of iter.descendants) { - if ($jp.code === rep) { - $jp.replaceWith(replacementsMap[rep]); // TODO: Do calculation without altering the source code. - } - } - } - } while (Object.keys(replacementsMap).length > 0); - nestedOpsBlock.repetitions = iter.code; - // Add to nested blocks - opsBlock.nestedOpsBlocks.push(nestedOpsBlock); - // Go statement-by-statement - $stmt.body.children.forEach(($nestedStmt) => { - this.countOpStatic($nestedStmt, nestedOpsBlock, includeOpKind); - }); - return; - } - // If stmt is not a loop, count ops - // Apply to all ops found in the stmt - for (const $op of Query.searchFrom($stmt, Op)) { - // If not a valid op, continue - if (!this.isValidOp($op)) { - continue; - } - // Calculate type and bitwidth - const $builtinType = this.toBuiltinType($op.type); - const counterType = this.getCounterType($builtinType); - const bitwidth = $builtinType !== undefined ? String($op.bitWidth) : undefined; - // Increment counter - let opsId = `${counterType}-${bitwidth}`; - if (includeOpKind) { - opsId += `-${$op.kind}`; - } - opsBlock.add(opsId); - } - // Call function recursively when function calls are found - for (const $call of Query.searchFrom($stmt, Call)) { - const $funcDef = $call.definition; - if ($funcDef === undefined) { - continue; - } - this.count($funcDef, opsBlock, includeOpKind); - } - } - getCounterType($builtinType) { - if ($builtinType === undefined) { - return undefined; - } - if ($builtinType.isFloat) { - return "flops"; - } - else if ($builtinType.isInteger) { - return "iops"; - } - else { - PrintOnce.message(`StaticOpsCounter: could not determine if builtinType ${$builtinType.kind} is integer or float`); - return undefined; - } - } - toBuiltinType($type) { - if ($type instanceof BuiltinType) { - return $type; - } - PrintOnce.message(`StaticOpsCounter: could not determine builtinType of ${$type.joinPointType}`); - return undefined; - } - isValidOp($op) { - const isValid = StaticOpsCounter.validOps.has($op.kind); - if (!isValid) { - return false; - } - if (!this.filterFunction($op)) { - return false; - } - return true; - } - analyseIterationsExpr($expr, $source) { - const result = {}; - for (const $varref of Query.searchFromInclusive($expr, Varref)) { - if (result[$varref.name] !== undefined) { - continue; - } - if ($varref.decl instanceof Param) { - console.log(`Var ${$varref.name} is a parameter`); - continue; - } - console.log(`REFS of ${$varref.name}`); - const $lastWrite = this.getLastWrite($source, $varref.vardecl); - if ($lastWrite === undefined) { - console.log("Could not find last write"); - continue; - } - console.log(`Last write of ${$varref.vardecl.name}: ${$lastWrite.code}`); - result[$varref.name] = $lastWrite; - } - return result; - } - getLastWrite($currentJp, $vardecl) { - if ($currentJp === undefined) { - console.log("Could not find declaration"); - return undefined; - } - // Get siblings on the left - const siblLeft = $currentJp.siblingsLeft; - // Go back until the variable declaration/parameter is found - for (let i = siblLeft.length - 1; i >= 0; i--) { - const sibl = siblLeft[i]; - // For each sibling, find write references to the variable - const refs = sibl.getDescendantsAndSelf("varref").filter((varref) => varref.name === $vardecl.name); - for (const $ref of refs) { - // Ignore - if ($ref.use === "read") { - continue; - } - // Not supported yet - if ($ref.use === "readwrite") { - console.log("Readwrite not supported yet"); - return undefined; - } - // Check if assignment - const $refParent = $ref.parent; - if ($refParent.kind !== "assign") { - console.log("Not supported when not an assignment"); - return undefined; - } - if ($refParent instanceof BinaryOp) { - return $refParent.right; - } - } - // Check vardecl - const decls = sibl.getDescendantsAndSelf("vardecl").filter((vardecl) => vardecl.equals($vardecl)); - for (const $decl of decls) { - // Found decl - if (!$decl.hasInit) { - console.log(`Variable declaration for ${$decl.name} has no initialization`); - return undefined; - } - return $decl.init; - } - } - // Did not find declaration yet, call on parent - return this.getLastWrite($currentJp.parent, $vardecl); - } -} -//# sourceMappingURL=StaticOpsCounter.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/util/ClavaDataStore.js b/ClavaLaraApi/src-lara/clava/clava/util/ClavaDataStore.js deleted file mode 100644 index 0feeb7301a..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/util/ClavaDataStore.js +++ /dev/null @@ -1,79 +0,0 @@ -import WeaverDataStore from "@specs-feup/lara/api/weaver/util/WeaverDataStore.js"; -import ClavaJavaTypes from "../ClavaJavaTypes.js"; -import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { arrayFromArgs } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -/** - * DataStore used in Clava. - * - */ -export default class ClavaDataStore extends WeaverDataStore { - constructor(data = "LaraI Options", definition = ClavaJavaTypes.CxxWeaver.getWeaverDefinition()) { - super(data, definition); - this.addAlias("Disable Clava Info", "disable_info"); - } - /** - * Wraps a Java DataStore around a Lara DataStore. - */ - dataStoreWrapper(javaDataStore) { - return new ClavaDataStore(javaDataStore, this.definition); - } - /** - * @returns A string with the current C/C++ compiler flags. - */ - getFlags() { - return this.get("Compiler Flags"); - } - /** - * @param flags - A string with C/C++ compiler flags. - * - */ - setFlags(flags) { - this.put("Compiler Flags", flags); - } - /** - * @returns A list with the current extra system includes. - */ - getSystemIncludes() { - return this.get("library includes").getFiles(); - } - /** - * @returns A list with the current user includes. - */ - getUserIncludes() { - return this.get("header includes").getFiles(); - } - /** - * @param arguments - A variable number of strings with the extra system includes. - * - */ - setSystemIncludes(...args) { - const filenames = arrayFromArgs(args); - const files = filenames.map((filename) => Io.getPath(filename)); - this.put("library includes", JavaTypes.FileList.newInstance(files)); - } - /** - * @param arguments - A variable number of strings with the user includes. - * - */ - setUserIncludes(...args) { - const filenames = arrayFromArgs(args); - const files = filenames.map((filename) => Io.getPath(filename)); - this.put("header includes", JavaTypes.FileList.newInstance(files)); - } - /** - * @returns A string with the current compilation standard. - */ - getStandard() { - return this.get("C/C++ Standard").toString(); - } - /** - * @param flags - A string with a C/C++/OpenCL compilation standard. - * - */ - setStandard(standard) { - const stdObject = ClavaJavaTypes.Standard.getEnumHelper().fromValue(standard); - this.put("C/C++ Standard", stdObject); - } -} -//# sourceMappingURL=ClavaDataStore.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/util/CodeInserter.js b/ClavaLaraApi/src-lara/clava/clava/util/CodeInserter.js deleted file mode 100644 index 8645532132..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/util/CodeInserter.js +++ /dev/null @@ -1,62 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import LineInserter from "@specs-feup/lara/api/lara/util/LineInserter.js"; -import Clava from "../Clava.js"; -/** - * Writes the original code of the application, with the possibility of inserting new lines of code. - */ -export default class CodeInserter { - /** - * Maps $file AST ids to an object that maps line numbers to strings to insert. - */ - linesToInserts; - constructor() { - this.linesToInserts = {}; - } - add($file, line, content) { - const astId = $file.astId; - const fileLines = this.getFileLines(astId); - this.addContent(fileLines, line, content); - } - /** - * Writes the code of the current tree, plus the lines to insert, to the given folder. - */ - write(outputFolder) { - const lineInserter = new LineInserter(); - // Write each file, inserting lines if needed - for (const $jp of Clava.getProgram().getDescendants("file")) { - const $file = $jp; - if (!Io.isFile($file.filepath)) { - console.log("CodeInserter.write: skipping file, could not find path '" + - $file.filepath + - "'"); - continue; - } - // Original code - let fileCode = Io.readFile($file.filepath); - // Intrument code, if needed - const fileLines = this.linesToInserts[$file.astId]; - if (fileLines !== undefined) { - fileCode = lineInserter.add(fileCode, fileLines); - } - // Get path for writing file - const outputFilepath = $file.getDestinationFilepath(outputFolder); - Io.writeFile(outputFilepath, fileCode); - } - } - getFileLines(astId) { - let fileLines = this.linesToInserts[astId]; - if (fileLines === undefined) { - fileLines = {}; - this.linesToInserts[astId] = fileLines; - } - return fileLines; - } - addContent(fileLines, line, content) { - const lineStrings = fileLines[line]; - if (lineStrings === undefined) { - fileLines[line] = []; - } - fileLines[line].push(content); - } -} -//# sourceMappingURL=CodeInserter.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/util/FileIterator.js b/ClavaLaraApi/src-lara/clava/clava/util/FileIterator.js deleted file mode 100644 index c1fea73d68..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/util/FileIterator.js +++ /dev/null @@ -1,130 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import { debug } from "@specs-feup/lara/api/lara/core/LaraCore.js"; -import Clava from "../Clava.js"; -/** - * Given a folder, collects sources in that folder, parses and returns one each time next() is called. - * - * Pushes an empty Clava AST. Parsed files are added one at a time, and the AST contains at most one file at any given time. - * - * @param srcFoldername - Name of the folder with the source files to iterate. - * @param sourceExt - Extensions of the source files. - * @param headerExt - Extensions of the header files. - */ -export default class FileIterator { - files = []; - currentFile = 0; - isInit = false; - isClosed = false; - pushedAst = false; - srcFoldername; - sourceExt; - headerExt; - constructor(srcFoldername, sourceExt = ["c", "cpp"], headerExt = ["h", "hpp"]) { - this.srcFoldername = srcFoldername; - this.sourceExt = sourceExt; - this.headerExt = headerExt; - } - /** - * @returns $file join point, if there are still files to iterate over, or undefined otherwise - */ - next() { - // Initialized, in case it has not been initialized yet - this.init(); - // Check if finished - if (!this.hasNext()) { - return undefined; - } - // Next file - const sourceFile = this.files[this.currentFile]; - // Increment - this.currentFile++; - debug("FileIterator.next: Processing file " + sourceFile.toString()); - // Ensure program tree is empty before adding file - Clava.getProgram().removeChildren(); - Clava.getProgram().addFileFromPath(sourceFile); - // Rebuild - Clava.rebuild(); - const $firstChild = Clava.getProgram().getDescendants("file")?.[0]; - return $firstChild; - } - /** - * @returns True if there are still files to iterate over, false otherwise. - */ - hasNext() { - // Init, if not yet initalized - this.init(); - if (this.currentFile < this.files.length) { - return true; - } - // Close, if not yet closed - this.close(); - return false; - } - init() { - if (this.isInit) { - // Already initialized - return; - } - this.isInit = true; - const srcFolder = Io.getPath(Clava.getData().getContextFolder(), this.srcFoldername); - this.addIncludes(srcFolder, this.headerExt); - this.files = this.getFiles(srcFolder, this.sourceExt); - // Sort files - this.files.sort(); - debug("FileIterator: found " + this.files.length + " files"); - // Work on new AST tree - Clava.pushAst(); - this.pushedAst = true; - } - close() { - if (this.isClosed) { - return; - } - this.isClosed = true; - // Recover previous AST - if (this.pushedAst) { - Clava.popAst(); - } - } - /** - * Attempts to add folders of header files as includes. - * - */ - addIncludes(srcFolder, headerExt) { - // TODO: If needed, add a 'nestingLevel' parameter, which includes up to X ancestors for each header, - // cutting off if ancestors go before srcFolder - // Current user includes - const data = Clava.getData(); - const userIncludes = data.getUserIncludes(); - debug("FileIterator._addIncludes: User includes before " + - userIncludes.join(", ")); - // Populate initial set with user includes - const parents = new Set(); - for (const userInclude of userIncludes) { - parents.add(Io.getAbsolutePath(userInclude)); - } - // Get folders of hFiles - const headerFiles = this.getFiles(srcFolder, headerExt); - for (const hFile of headerFiles) { - parents.add(Io.getAbsolutePath(hFile.getParentFile())); - } - // Build new value - const includeFolders = []; - for (const parent of parents.values()) { - // Converting to File - includeFolders.push(Io.getPath(parent)); - } - data.setUserIncludes(...includeFolders.map((folder) => folder.getAbsolutePath())); - debug("FileIterator._addIncludes: User includes after " + - data.getUserIncludes().join(", ")); - } - getFiles(folder, extensions) { - let files = []; - for (const extension of extensions) { - const sourceFiles = Io.getFiles(folder, "*." + extension, true); - files = files.concat(sourceFiles); - } - return files; - } -} -//# sourceMappingURL=FileIterator.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHls.js b/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHls.js deleted file mode 100644 index 4de2a4566c..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHls.js +++ /dev/null @@ -1,151 +0,0 @@ -import Clava from "../Clava.js"; -import ProcessExecutor from "@specs-feup/lara/api/lara/util/ProcessExecutor.js"; -import VitisHlsReportParser from "./VitisHlsReportParser.js"; -import Tool from "@specs-feup/lara/api/lara/tool/Tool.js"; -import ToolUtils from "@specs-feup/lara/api/lara/tool/ToolUtils.js"; -import Io from "@specs-feup/lara/api/lara/Io.js"; -export default class VitisHls extends Tool { - topFunction; - platform; - clock; - vitisDir = "VitisHLS"; - vitisProjName = "VitisHLSClavaProject"; - sourceFiles = []; - flowTarget = "vivado"; - constructor(topFunction, clock = 10, platform = "xcvu5p-flva2104-1-e", disableWeaving = false) { - super("VITIS-HLS", disableWeaving); - this.topFunction = topFunction; - this.platform = platform; - this.setClock(clock); - } - setTopFunction(topFunction) { - this.topFunction = topFunction; - return this; - } - setPlatform(platform) { - this.platform = platform; - return this; - } - setClock(clock) { - if (clock <= 0) { - throw new Error(`${this.getTimestamp()} Clock value must be a positive integer!`); - } - else { - this.clock = clock; - } - return this; - } - setFlowTarget(target) { - this.flowTarget = target; - return this; - } - addSource(file) { - this.sourceFiles.push(file); - return this; - } - getTimestamp() { - const curr = new Date(); - const res = `[${this.toolName} ${curr.getHours()}:${curr.getMinutes()}:${curr.getSeconds()}]`; - return res; - } - synthesize(verbose = true) { - console.log(`${this.getTimestamp()} Setting up Vitis HLS executor`); - this.clean(); - this.generateTclFile(); - this.executeVitis(verbose); - return Io.isFile(this.getSynthesisReportPath()); - } - clean() { - Io.deleteFolderContents(this.vitisDir); - } - getSynthesisReportPath() { - return (this.vitisDir + - "/" + - this.vitisProjName + - "/solution1/syn/report/csynth.xml"); - } - executeVitis(verbose) { - console.log(`${this.getTimestamp()} Executing Vitis HLS`); - const pe = new ProcessExecutor(); - pe.setWorkingDir(this.vitisDir); - pe.setPrintToConsole(verbose); - pe.execute("vitis_hls", "-f", "script.tcl"); - console.log(`${this.getTimestamp()} Finished executing Vitis HLS`); - } - getTclInputFiles() { - let str = ""; - const weavingFolder = ToolUtils.parsePath(Clava.getWeavingFolder()); - // make sure the files are woven - Io.deleteFolderContents(weavingFolder); - Clava.writeCode(weavingFolder); - // if no files were added, we assume that every woven file should be used - if (this.sourceFiles.length == 0) { - console.log(`${this.getTimestamp()} No source files specified, assuming current AST is the input`); - for (const file of Io.getFiles(Clava.getWeavingFolder())) { - const exts = [".c", ".cpp", ".h", ".hpp"]; - const res = exts.some((ext) => file.name.includes(ext)); - if (res) - str += "add_files " + weavingFolder + "/" + file.name + "\n"; - } - } - else { - for (const file of this.sourceFiles) { - str += "add_files " + weavingFolder + "/" + file + "\n"; - } - } - return str; - } - generateTclFile() { - const cmd = ` -open_project ${this.vitisProjName} -set_top ${this.topFunction} -${this.getTclInputFiles()} -open_solution "solution1" -flow_target ${this.flowTarget} -set_part { ${this.platform}} -create_clock -period ${this.clock} -name default -csynth_design -exit - `; - Io.writeFile(this.vitisDir + "/script.tcl", cmd); - } - getSynthesisReport() { - console.log(`${this.getTimestamp()} Processing synthesis report`); - const parser = new VitisHlsReportParser(this.getSynthesisReportPath()); - const json = parser.getSanitizedJSON(); - console.log(`${this.getTimestamp()} Finished processing synthesis report`); - return json; - } - preciseStr(n, decimalPlaces) { - return (+n).toFixed(decimalPlaces); - } - prettyPrintReport(report) { - const period = this.preciseStr(report["clockEstim"], 2); - const freq = this.preciseStr(report["fmax"], 2); - const out = ` ----------------------------------------- -Vitis HLS synthesis report - -Targeted a ${report["platform"]} with target clock ${freq} ns - -Achieved an estimated clock of ${period} ns (${freq} MHz) - -Estimated latency for top function ${report["topFun"]}: -Worst case: ${report["latencyWorst"]} cycles - Avg case: ${report["latencyAvg"]} cycles - Best case: ${report["latencyBest"]} cycles - -Estimated execution time: -Worst case: ${report["execTimeWorst"]} s - Avg case: ${report["execTimeAvg"]} s - Best case: ${report["execTimeBest"]} s - -Resource usage: -FF: ${report["FF"]} (${this.preciseStr(report["perFF"] * 100, 2)}%) -LUT: ${report["LUT"]} (${this.preciseStr(report["perLUT"] * 100, 2)}%) -BRAM: ${report["BRAM"]} (${this.preciseStr(report["perBRAM"] * 100, 2)}%) -DSP: ${report["DSP"]} (${this.preciseStr(report["perDSP"] * 100, 2)}%) -----------------------------------------`; - console.log(out); - } -} -//# sourceMappingURL=VitisHls.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsReportParser.js b/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsReportParser.js deleted file mode 100644 index b7a1204139..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsReportParser.js +++ /dev/null @@ -1,64 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -export default class VitisHlsReportParser { - reportPath; - constructor(reportPath) { - this.reportPath = reportPath; - } - xmlToJson(xml) { - //parses only the "leaves" of the XML string, which is enough for us. For now. - const regex = /(?:<([a-zA-Z'-\d_]*)(?:\s[^>]*)*>)((?:(?!<\1).)*)(?:<\/\1>)|<([a-zA-Z'-]*)(?:\s*)*\/>/gm; - const json = {}; - for (const match of xml.matchAll(regex)) { - const key = match[1] || match[3]; - const val = match[2] && this.xmlToJson(match[2]); - json[key] = (val && Object.keys(val).length ? val : match[2]) || null; - } - return json; - } - getSanitizedJSON() { - const raw = this.getRawJSON(); - const fmax = this.calculateMaxFrequency(raw["EstimatedClockPeriod"]); - const execTimeWorst = this.calculateExecutionTime(raw["Worst-caseLatency"], fmax); - const execTimeAvg = this.calculateExecutionTime(raw["Average-caseLatency"], fmax); - const execTimeBest = this.calculateExecutionTime(raw["Best-caseLatency"], fmax); - const hasFixedLatency = raw["Best-caseLatency"] === raw["Worst-caseLatency"]; - return { - platform: raw["Part"], - topFun: raw["TopModelName"], - clockTarget: raw["TargetClockPeriod"], - clockEstim: raw["EstimatedClockPeriod"], - fmax: fmax, - latencyWorst: raw["Worst-caseLatency"], - latencyAvg: raw["Average-caseLatency"], - latencyBest: raw["Best-caseLatency"], - hasFixedLatency: hasFixedLatency, - execTimeWorst: execTimeWorst, - execTimeAvg: execTimeAvg, - execTimeBest: execTimeBest, - FF: raw["FF"], - LUT: raw["LUT"], - BRAM: raw["BRAM_18K"], - DSP: raw["DSP"], - availFF: raw["AVAIL_FF"], - availLUT: raw["AVAIL_LUT"], - availBRAM: raw["AVAIL_BRAM"], - availDSP: raw["AVAIL_DSP"], - perFF: raw["FF"] / raw["AVAIL_FF"], - perLUT: raw["LUT"] / raw["AVAIL_LUT"], - perBRAM: raw["BRAM_18K"] / raw["AVAIL_BRAM"], - perDSP: raw["DSP"] / raw["AVAIL_DSP"], - }; - } - getRawJSON() { - const xml = Io.readFile(this.reportPath); - return this.xmlToJson(xml); - } - calculateMaxFrequency(clockEstim) { - return (1 / clockEstim) * 1000; - } - calculateExecutionTime(latency, freqMHz) { - const freqHz = freqMHz * 1e6; - return latency / freqHz; - } -} -//# sourceMappingURL=VitisHlsReportParser.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsUtils.js b/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsUtils.js deleted file mode 100644 index 3f06d40ff5..0000000000 --- a/ClavaLaraApi/src-lara/clava/clava/vitishls/VitisHlsUtils.js +++ /dev/null @@ -1,26 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import { WrapperStmt } from "../../Joinpoints.js"; -import ClavaJoinPoints from "../ClavaJoinPoints.js"; -export default class VitisHlsUtils { - static activateAllDirectives(turnOn) { - const pragmas = Query.search(WrapperStmt, { - code: (code) => code.includes("#pragma HLS") || code.includes("#pragma hls"), - }).get(); - if (pragmas == undefined) { - console.log("No pragmas found"); - return; - } - for (const pragma of pragmas) { - console.log(pragma.code); - if (turnOn) { - if (pragma.code.startsWith("//")) { - pragma.replaceWith(ClavaJoinPoints.stmtLiteral(pragma.code.replace("//", ""))); - } - } - else { - pragma.replaceWith(ClavaJoinPoints.stmtLiteral("//" + pragma.code)); - } - } - } -} -//# sourceMappingURL=VitisHlsUtils.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/core.js b/ClavaLaraApi/src-lara/clava/core.js deleted file mode 100644 index a4fdf24c2e..0000000000 --- a/ClavaLaraApi/src-lara/clava/core.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file is used only in Clava Classic to load the core API. - * This is done for compatibility with the previous version of Clava. - * Do not use this file in new (clava-js) projects. - * Remove this file if Clava Classic has died out. - */ -const prefix = "@specs-feup/clava/api/"; -const coreImports = []; -const sideEffectsOnlyImports = ["Joinpoints.js"]; -for (const sideEffectsOnlyImport of sideEffectsOnlyImports) { - await import(prefix + sideEffectsOnlyImport); -} -for (const coreImport of coreImports) { - const foo = Object.entries(await import(prefix + coreImport)); - foo.forEach(([key, value]) => { - // @ts-ignore - globalThis[key] = value; - }); -} -export {}; -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/benchmark/ClavaBenchmarkInstance.js b/ClavaLaraApi/src-lara/clava/lara/benchmark/ClavaBenchmarkInstance.js deleted file mode 100644 index 0ce8754cd5..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/benchmark/ClavaBenchmarkInstance.js +++ /dev/null @@ -1,98 +0,0 @@ -import Io from "@specs-feup/lara/api/lara/Io.js"; -import BenchmarkInstance from "@specs-feup/lara/api/lara/benchmark/BenchmarkInstance.js"; -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import Weaver from "@specs-feup/lara/api/weaver/Weaver.js"; -import Clava from "../..//clava/Clava.js"; -import { Pragma } from "../../Joinpoints.js"; -import CMaker from "../../clava/cmake/CMaker.js"; -import ClavaJoinPoints from "../../clava/ClavaJoinPoints.js"; -/** - * Instance of a Clava benchmark. - * - * Implements _compilePrivate and .getKernel(). - */ -export default class ClavaBenchmarkInstance extends BenchmarkInstance { - cmaker; - cmakerProvider; - constructor(name) { - super(name); - this.cmaker = undefined; - this.cmakerProvider = () => new CMaker(name); - } - setCMakerProvider(cmakerProvider) { - this.cmakerProvider = cmakerProvider; - // New provider set, remove CMaker - this.cmaker = undefined; - } - /** - * The output folder for this BenchmarkInstance. - */ - getOutputFolder() { - return Io.mkdir(this.getBaseFolder(), this.getName()).getAbsolutePath(); - } - compilationEngineProvider(name) { - return new CMaker(name); - } - /** - * Allows to customize the CMake options used during compilation. - * - * @param name - * @returns - */ - getCMaker() { - if (this.cmaker === undefined) { - this.cmaker = this.cmakerProvider(); - } - return this.cmaker; - } - compilePrivate() { - const folder = this.getOutputFolder(); - Clava.writeCode(folder); - //const cmaker = this.getCompilationEngine() as CMaker; - const cmaker = this.getCMaker(); - cmaker.addCurrentAst(); - const exe = cmaker.build(folder); - if (exe !== undefined) { - this.setExecutable(exe); - } - return exe; - } - /** - * Speciallized implementation for Clava that automatically saves and restores the AST, extending classes just need to implement addCode() and loadPrologue(). - */ - loadPrivate() { - // Execute configuration for current instance - this.loadPrologue(); - // Pust an empty AST to the top of the stack - Clava.pushAst(ClavaJoinPoints.program()); - // Add code - this.addCode(); - // Rebuild - Clava.rebuild(); - } - closePrivate() { - // Restore any necessary configurations - this.closeEpilogue(); - // Restore previous AST - Clava.popAst(); - } - loadCached(astFile) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call - console.log(`Loading cached AST from file ${astFile.getAbsolutePath()}...`); - // Load saved AST - const $app = Weaver.deserialize(Io.readFile(astFile)); - // Push loaded AST - Clava.pushAst($app); - } - /** - * Looks for #pragma kernel, returns target of that pragma - */ - getKernel() { - const $pragma = Query.search(Pragma, "kernel").first(); - if ($pragma === undefined) { - throw `ClavaBenchmarkInstance.getKernel: Could not find '#pragma kernel' in benchmark ${this.getName()}`; - } - return $pragma.target; - } -} -//# sourceMappingURL=ClavaBenchmarkInstance.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/code/Energy.js b/ClavaLaraApi/src-lara/clava/lara/code/Energy.js deleted file mode 100644 index 12476195bd..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/code/Energy.js +++ /dev/null @@ -1,52 +0,0 @@ -import EnergyBase from "@specs-feup/lara/api/lara/code/EnergyBase.js"; -import Clava from "../../clava/Clava.js"; -import Logger from "./Logger.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -export default class Energy extends EnergyBase { - /** - * Current SpecsRapl library measures uJ. - */ - getPrintUnit() { - return "uJ"; - } - measure($start, prefix = "", $end = $start) { - //Check for valid joinpoints and additional conditions - if (!this.measureValidate($start, $end, "function")) { - return; - } - // Message about dependency - PrintOnce.message("Woven code has dependency to project SpecsRapl, which can be found at https://github.com/specs-feup/specs-c-libs"); - // Adds SpecsRapl include - Clava.getProgram().addExtraIncludeFromGit("https://github.com/specs-feup/specs-c-libs.git", "SpecsRapl/include/"); - // Adds SpecsRapl source - Clava.getProgram().addExtraSourceFromGit("https://github.com/specs-feup/specs-c-libs.git", "SpecsRapl/src/"); - Clava.getProgram().addExtraLib("-pthread"); - const logger = new Logger(false, this.filename); - // Add include - const $file = $start.getAncestor("file"); - if ($file === undefined) { - console.log("Could not find the corresponding file of the given joinpoint: " + - $start.joinPointType); - return; - } - $file.addInclude("rapl.h", false); - const energyVar = IdGenerator.next("clava_energy_output_"); - const energyVarStart = energyVar + "_start"; - const energyVarEnd = energyVar + "_end"; - const codeBefore = Energy.energy_rapl_measure(energyVarStart); - const codeAfter = Energy.energy_rapl_measure(energyVarEnd); - $start.insert("before", codeBefore); - logger.append(prefix).appendLongLong(energyVarEnd + " - " + energyVarStart); - if (this.printUnit) { - logger.append(this.getPrintUnit()); - } - logger.ln(); - logger.log($end); - $end.insert("after", codeAfter); - } - static energy_rapl_measure(energyVar) { - return `long long ${energyVar} = rapl_energy();`; - } -} -//# sourceMappingURL=Energy.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/code/Logger.js b/ClavaLaraApi/src-lara/clava/lara/code/Logger.js deleted file mode 100644 index abf68fdfe8..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/code/Logger.js +++ /dev/null @@ -1,242 +0,0 @@ -import LoggerBase from "@specs-feup/lara/api/lara/code/LoggerBase.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import PrintOnce from "@specs-feup/lara/api/lara/util/PrintOnce.js"; -import Clava from "../../clava/Clava.js"; -import { FunctionJp, Scope, } from "../../Joinpoints.js"; -export default class Logger extends LoggerBase { - _isCxx = false; - constructor(isGlobal = false, filename) { - super(isGlobal, filename); - // Adds C/C++ specific types - this.Type.set("LONGLONG", 100); - // 64-bit int - this.printfFormat[this.Type.get("LONGLONG")] = "%I64lld"; - } - /** - * Adds code that prints the message built up to that point with the append() functions. - * - */ - log($jp, insertBefore = false) { - if ($jp === undefined) { - this._warn("Given join point is undefined"); - return; - } - const $function = this._logSetup($jp, insertBefore); - if ($function === undefined) { - return; - } - const $file = $function.getAncestor("file"); - this._isCxx = $file.isCxx; - let code = undefined; - if ($file.isCxx) { - code = this._log_cxx($file, $function); - } - else { - code = this._log_c($file, $function); - } - if (code === undefined) { - return; - } - this._insert($jp, insertBefore, code); - return this; - } - /** - * Appends an expression that represents a long long. - * - * @param expr - the expression to append - * @returns The current logger instance - */ - appendLongLong(expr) { - return this._append_private(expr, this.Type.get("LONGLONG")); - } - /** - * Appends an expression that represents a long long. - * - * @param expr - the expression to append - * @returns The current logger instance - */ - longLong(expr) { - return this.appendLongLong(expr); - } - /**** PRIVATE METHODS ****/ - /** - * Checks the initial constrains before executing the actual log (ancestor function, minimum of elements to log, defines the value of insertBefore) - * Should be called on the beggining of each implementation of log - * - * @returns Undefined on failure and a $function instance if successful - */ - _logSetup($jp, insertBefore = false) { - // Validate join point - if (!this._validateJp($jp, "function")) { - return undefined; - } - if (this.currentElements.length === 0) { - this._info("Nothing to log, call append() first"); - return undefined; - } - return $jp.getAncestor("function"); - } - _log_cxx($file, $function) { - if (Clava.useSpecsLogger) { - return this._log_cxx_specslogger($file, $function); - } - else { - return this._log_cxx_stdcpp($file, $function); - } - } - _log_cxx_specslogger($file, $function) { - const loggerName = this._setup_cxx_specslogger($file, $function); - // Create code from elements - const code = loggerName + - ".msg(" + - this.currentElements - .map((element) => { - return this._getPrintableContent(element); - }) - .join(", ") + - ");"; - return code; - } - /** - * Sets up the code for the Logger in the file and function that is called - */ - _setup_cxx_specslogger($file, $function) { - // Warn user about dependency to SpecsLogger library - //Clava.infoProjectDependency("SpecsLogger", "https://github.com/specs-feup/specs-c-libs"); - PrintOnce.message("Woven code has dependency to project SpecsLogger, which can be found at https://github.com/specs-feup/specs-c-libs"); - const declaredName = this._declareName($function.getDeclaration(true), function () { - return IdGenerator.next("clava_logger_"); - }); - const loggerName = declaredName.name; - if (declaredName.alreadyDeclared) { - return loggerName; - } - // Add include to Logger for Cpp only - $file.addInclude("SpecsLogger.h", false); - // Get correct logger - let loggerDecl = undefined; - // If filename use FileLogger - if (this.filename !== undefined) { - loggerDecl = "FileLogger " + loggerName + '("' + this.filename + '");'; - } - // Otherwise, use ConsoleLogger - else { - loggerDecl = "ConsoleLogger " + loggerName + ";"; - } - // Add declaration of correct logger - $function.body.insertBegin(loggerDecl); - return loggerName; - } - _log_cxx_stdcpp($file, $function) { - let streamName; - if (this.filename === undefined) { - streamName = this._setup_cxx_stdcpp_console($file, $function); - } - else { - streamName = this._setup_cxx_stdcpp_file($file, $function); - } - // Create code from elements. - const code = streamName + - " << " + - this.currentElements - .map((element) => { - if (element.type === this.Type.get("NORMAL")) { - return '"' + element.content + '"'; - } - return element.content; - }) - .join(" << ") + - ";"; - return code; - } - _setup_cxx_stdcpp_console($file, $function) { - const streamName = "std::cout"; - // Add include - $file.addInclude("iostream", true); - return streamName; - } - _setup_cxx_stdcpp_file($file, $function) { - const declaredName = this._declareName($function.getDeclaration(true), function () { - return IdGenerator.next("log_file_"); - }); - const streamName = declaredName.name; - if (declaredName.alreadyDeclared) { - return streamName; - } - // Add include - $file.addInclude("fstream", true); - // Declare file stream and open file - $function.body.insertBegin(this._clava_logger_filename_declaration_cpp(streamName, this.filename)); - return streamName; - } - _log_c($file, $function) { - if (this.filename === undefined) { - return this._log_c_console($file, $function); - } - else { - return this._log_c_file($file, $function); - } - } - _log_c_console($file, $function) { - // Setup - $file.addInclude("stdio.h", true); - return this._printfFormat("printf"); - } - _log_c_file($file, $function) { - const fileVar = this._log_c_file_setup($file, $function); - return this._printfFormat("fprintf", "(" + fileVar + ", "); - } - _log_c_file_setup($file, $function) { - const declaredName = this._declareName($function.getDeclaration(true), function () { - return IdGenerator.next("log_file_"); - }); - const varname = declaredName.name; - if (declaredName.alreadyDeclared) { - return varname; - } - // Setup - $file.addInclude("stdio.h", true); - $file.addInclude("stdlib.h", true); - // Declare and open file - const code = this._clava_logger_filename_declaration(varname, this.filename); - // Add code at beginning of the function - $function.body.insertBegin(code); - // Close file at the return points of the function - $function.insertReturn("fclose(" + varname + ");"); - return varname; - } - _insertCode($jp, insertBefore, code) { - const insertBeforeString = insertBefore ? "before" : "after"; - if (insertBefore) { - $jp.insert(insertBeforeString, code); - this.afterJp = $jp; - } - else { - // If $jp is a 'scope' with a 'function' parent, insert before return instead - if ($jp instanceof Scope && - $jp.parent !== undefined && - $jp.parent instanceof FunctionJp) { - this.afterJp = $jp.parent.insertReturn(code); - } - else { - this.afterJp = $jp.insertAfter(code); - } - } - } - _clava_logger_filename_declaration(varname, filename) { - return ` -FILE *${varname} = fopen("${filename}", "w+"); -if (${varname} == NULL) -{ - printf("Error opening file ${filename}\\n"); - exit(1); -} -`; - } - _clava_logger_filename_declaration_cpp(streamName, filename) { - return ` std::ofstream ${streamName}; -${streamName}.open("${filename}", std::ios_base::app); -`; - } -} -//# sourceMappingURL=Logger.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/code/Timer.js b/ClavaLaraApi/src-lara/clava/lara/code/Timer.js deleted file mode 100644 index 88fa3cfd15..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/code/Timer.js +++ /dev/null @@ -1,204 +0,0 @@ -import Platforms from "@specs-feup/lara/api/lara/Platforms.js"; -import TimerBase from "@specs-feup/lara/api/lara/code/TimerBase.js"; -import IdGenerator from "@specs-feup/lara/api/lara/util/IdGenerator.js"; -import { TimerUnit } from "@specs-feup/lara/api/lara/util/TimeUnits.js"; -import { Scope } from "../../Joinpoints.js"; -import Clava from "../../clava/Clava.js"; -import ClavaJoinPoints from "../../clava/ClavaJoinPoints.js"; -import Logger from "./Logger.js"; -export default class Timer extends TimerBase { - addedDefines = new Set(); - /** - * Times the code of a given section. - * - * @param $start - Starting point of the time measure - * @param prefix - Message that will appear before the time measure. If undefined, empty string will be used. - * @param $end - Ending point of the time measure. If undefined, measure is done around starting point. - */ - time($start, prefix = "", $end = $start) { - if (!this._timeValidate($start, $end, "function")) { - return; - } - const $file = $start.getAncestor("file"); - if ($file === undefined) { - console.log("Could not find the corresponding file of the given joinpoint: " + - $start.joinPointType); - return; - } - else if ($file.isCxx) { - return this._time_cpp($start, prefix, $end); - } - else { - return this._time_c($start, prefix, $end); - } - } - _time_cpp($start, prefix = "", $end = $start) { - if (this.timeUnits.unit == TimerUnit.DAYS) { - throw "Timer Exception: Timer metrics not implemented for DAYS in C++"; - } - const cppUnit = this.timeUnits.getCppTimeUnit(); - const logger = new Logger(false, this.filename); - const $file = $start.getAncestor("file"); - // Add include - $file.addInclude("chrono", true); - const startVar = IdGenerator.next("clava_timing_start_"); - const endVar = IdGenerator.next("clava_timing_end_"); - const $codeTic = ClavaJoinPoints.stmtLiteral(this._timer_cpp_now(startVar)); - const $codeToc = ClavaJoinPoints.stmtLiteral(this._timer_cpp_now(endVar)); - const $insertionTic = $codeTic; - const $insertionToc = $codeToc; - // Declare variable for time interval, which uses calculation as initialization - const timeIntervalVar = IdGenerator.next("clava_timing_duration_"); - // Create literal node with calculation of time interval - const $timingResult = ClavaJoinPoints.exprLiteral("long long " + - this._timer_cpp_calc_interval(startVar, endVar, cppUnit, timeIntervalVar)); - // Build message - logger.append(prefix).appendLong(timeIntervalVar); - if (this.printUnit) { - logger.append(this.timeUnits.getUnitsString()); - } - logger.ln(); - // Check if $start is a scope - if ($start instanceof Scope) { - $start.insertBegin($insertionTic); - } - else { - $start.insertBefore($insertionTic); - } - const $startVarDecl = ClavaJoinPoints.stmtLiteral(this._timer_cpp_define_time_var(startVar)); - const $endVarDecl = ClavaJoinPoints.stmtLiteral(this._timer_cpp_define_time_var(endVar)); - $insertionTic.insertBefore($startVarDecl); - $insertionTic.insertBefore($endVarDecl); - let afterJp = undefined; - // Check if $end is a scope - if ($end instanceof Scope) { - $end.insertEnd($insertionToc); - } - else { - $end.insertAfter($insertionToc); - } - $codeToc.insertAfter($timingResult); - afterJp = $timingResult; - // Log time information - if (this.print) { - logger.log($timingResult); - afterJp = logger.getAfterJp(); - } - this.setAfterJp(afterJp); - return timeIntervalVar; - } - _time_c($start, prefix = "", $end = $start) { - const logger = new Logger(false, this.filename); - const $file = $start.getAncestor("file"); - let $varDecl, $codeBefore, $codeAfter, $timingResult; - // Declare variable for time interval, which uses calculation as initialization - const timeIntervalVar = IdGenerator.next("clava_timing_duration_"); - const $timingResultDecl = ClavaJoinPoints.varDeclNoInit(timeIntervalVar, ClavaJoinPoints.builtinType("double")); - if (Platforms.isWindows()) { - //use QueryPerformanceCounter - // Add includes - $file.addInclude("time.h", true); - $file.addInclude("windows.h", true); - // get variable names - const startVar = IdGenerator.next("clava_timing_start_"); - const endVar = IdGenerator.next("clava_timing_end_"); - const frequencyVar = IdGenerator.next("clava_timing_frequency_"); - $varDecl = ClavaJoinPoints.stmtLiteral(this._timer_c_windows_declare_vars(startVar, endVar, frequencyVar)); - $codeBefore = ClavaJoinPoints.stmtLiteral(this._timer_c_windows_get_time(startVar)); - $codeAfter = ClavaJoinPoints.stmtLiteral(this._timer_c_windows_get_time(endVar)); - // Create literal node with calculation of time interval - $timingResult = ClavaJoinPoints.exprLiteral(this._timer_c_windows_calc_interval(startVar, endVar, timeIntervalVar, frequencyVar, String(this.timeUnits.getMagnitudeFactorFromSeconds())), $timingResultDecl.type); - } - else if (Platforms.isLinux()) { - // Add includes - $file.addInclude("time.h", true); - // If C99 or C11 standard, needs define at the beginning of the file - // https://stackoverflow.com/questions/42597685/storage-size-of-timespec-isnt-known - const needsDefine = Clava.getStandard() === "c99" || Clava.getStandard() === "c11"; - if (needsDefine && !this.addedDefines.has($file.location)) { - $file.insertBegin("#define _POSIX_C_SOURCE 199309L"); - this.addedDefines.add($file.location); - } - // get variable names - const startVar = IdGenerator.next("clava_timing_start_"); - const endVar = IdGenerator.next("clava_timing_end_"); - $varDecl = ClavaJoinPoints.stmtLiteral(this._timer_c_linux_declare_vars(startVar, endVar)); - $codeBefore = ClavaJoinPoints.stmtLiteral(this._timer_c_linux_get_time(startVar)); - $codeAfter = ClavaJoinPoints.stmtLiteral(this._timer_c_linux_get_time(endVar)); - // Create literal node with calculation of time interval - $timingResult = ClavaJoinPoints.exprLiteral(this._timer_c_linux_calc_interval(startVar, endVar, timeIntervalVar, String(this.timeUnits.getMagnitudeFactorFromSeconds())), $timingResultDecl.type); - } - else { - throw "Timer Exception: Platform not supported (Windows and Linux only)"; - } - // Build message - logger.append(prefix).appendDouble(timeIntervalVar); - if (this.printUnit) { - logger.append(this.timeUnits.getUnitsString()); - } - logger.ln(); - const $insertionTic = $codeBefore; - const $insertionToc = $codeAfter; - // Check if $start is a scope - if ($start instanceof Scope) { - // Insert code - $start.insertBegin($insertionTic); - } - else { - // Insert code - $start.insertBefore($insertionTic); - } - $insertionTic.insertBefore($varDecl); - $insertionTic.insertBefore($timingResultDecl); - let afterJp = undefined; - // Check if $end is a scope - if ($end instanceof Scope) { - $end.insertEnd($insertionToc); - } - else { - $end.insertAfter($insertionToc); - } - afterJp = $codeAfter.insertAfter($timingResult); - afterJp = $timingResult; - // Log time information - if (this.print) { - logger.log(afterJp); - afterJp = logger.getAfterJp(); - } - this.setAfterJp(afterJp); - return timeIntervalVar; - } - //C codedefs - // Windows - _timer_c_windows_declare_vars(timeStartVar, timeEndVar, timeFrequencyVar) { - return `LARGE_INTEGER ${timeStartVar}, ${timeEndVar}, ${timeFrequencyVar}; -QueryPerformanceFrequency(&${timeFrequencyVar});`; - } - _timer_c_windows_get_time(timeVar) { - return `QueryPerformanceCounter(&${timeVar});`; - } - _timer_c_windows_calc_interval(timeStartVar, timeEndVar, timeDiffenceVar, timeFrequencyVar, factorConversion) { - return `${timeDiffenceVar} = ((${timeEndVar}.QuadPart - ${timeStartVar}.QuadPart) / (double)${timeFrequencyVar}.QuadPart) * (${factorConversion})`; - } - //Linux - _timer_c_linux_declare_vars(timeStartVar, timeEndVar) { - return `struct timespec ${timeStartVar}, ${timeEndVar};`; - } - _timer_c_linux_get_time(timeVar) { - return `clock_gettime(CLOCK_MONOTONIC, &${timeVar});`; - } - _timer_c_linux_calc_interval(timeStartVar, timeEndVar, timeDiffenceVar, factorConversion) { - return `${timeDiffenceVar} = ((${timeEndVar}.tv_sec + ((double) ${timeEndVar}.tv_nsec / 1000000000)) - (${timeStartVar}.tv_sec + ((double) ${timeStartVar}.tv_nsec / 1000000000))) * (${factorConversion})`; - } - //Cpp codedefs - _timer_cpp_define_time_var(timeVar) { - return `std::chrono::high_resolution_clock::time_point ${timeVar};`; - } - _timer_cpp_now(timeVar) { - return `${timeVar} = std::chrono::high_resolution_clock::now();`; - } - _timer_cpp_calc_interval(startVar, endVar, unit, differentialVar) { - return `${differentialVar} = std::chrono::duration_cast(${endVar} - ${startVar}).count()`; - } -} -//# sourceMappingURL=Timer.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/metrics/EnergyMetric.js b/ClavaLaraApi/src-lara/clava/lara/metrics/EnergyMetric.js deleted file mode 100644 index 2184259245..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/metrics/EnergyMetric.js +++ /dev/null @@ -1,38 +0,0 @@ -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import Metric from "@specs-feup/lara/api/lara/metrics/Metric.js"; -import MetricResult from "@specs-feup/lara/api/lara/metrics/MetricResult.js"; -import Energy from "../code/Energy.js"; -/** - * Measures energy consumed during an application. - */ -export default class EnergyMetric extends Metric { - prefix; - energy; - constructor(prefix = "energy:") { - super("Energy"); - this.energy = new Energy(); - this.prefix = prefix; - } - instrument($start, $end = $start) { - this.energy.setPrintUnit(false); - this.energy.measure($start, this.prefix, $end); - } - report(processExecutor) { - const processOutput = processExecutor.getConsoleOutput(); - if (processOutput === undefined) { - throw new Error("No process output found"); - } - const value = Strings.extractValue(this.prefix, processOutput); - if (value === undefined) { - throw new Error("No value found"); - } - return new MetricResult(parseFloat(value), this.energy.getPrintUnit()); - } - getImport() { - return "lara.metrics.EnergyMetric"; - } - getUnit() { - return this.energy.getPrintUnit(); - } -} -//# sourceMappingURL=EnergyMetric.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/lara/metrics/ExecutionTimeMetric.js b/ClavaLaraApi/src-lara/clava/lara/metrics/ExecutionTimeMetric.js deleted file mode 100644 index 9aa95cab3c..0000000000 --- a/ClavaLaraApi/src-lara/clava/lara/metrics/ExecutionTimeMetric.js +++ /dev/null @@ -1,38 +0,0 @@ -import Strings from "@specs-feup/lara/api/lara/Strings.js"; -import Metric from "@specs-feup/lara/api/lara/metrics/Metric.js"; -import MetricResult from "@specs-feup/lara/api/lara/metrics/MetricResult.js"; -import { TimerUnit } from "@specs-feup/lara/api/lara/util/TimeUnits.js"; -import Timer from "../code/Timer.js"; -/** - * Measures execution time of an application. - */ -export default class ExecutionTimeMetric extends Metric { - prefix; - constructor(prefix = "time:") { - super("Execution Time"); - this.prefix = prefix; - } - instrument($start, $end = $start) { - const timer = new Timer(TimerUnit.NANOSECONDS); - timer.setPrintUnit(false); - timer.time($start, this.prefix, $end); - } - report(processExecutor) { - const processOutput = processExecutor.getConsoleOutput(); - if (processOutput === undefined) { - throw new Error("No process output found"); - } - const value = Strings.extractValue(this.prefix, processOutput); - if (value === undefined) { - throw new Error("No value found"); - } - return new MetricResult(parseFloat(value), this.getUnit()); - } - getImport() { - return "lara.metrics.ExecutionTimeMetric"; - } - getUnit() { - return "ns"; - } -} -//# sourceMappingURL=ExecutionTimeMetric.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/WeaverLauncher.js b/ClavaLaraApi/src-lara/clava/weaver/WeaverLauncher.js deleted file mode 100644 index 82b6e4710f..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/WeaverLauncher.js +++ /dev/null @@ -1,8 +0,0 @@ -import WeaverLauncherBase from "@specs-feup/lara/api/weaver/WeaverLauncherBase.js"; -import Clava from "../clava/Clava.js"; -export default class WeaverLauncher extends WeaverLauncherBase { - execute(args) { - return Clava.runClava(args); - } -} -//# sourceMappingURL=WeaverLauncher.js.map \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaBinaryJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaBinaryJp.lara deleted file mode 100644 index 9fffbd6cda..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaBinaryJp.lara +++ /dev/null @@ -1,49 +0,0 @@ -import weaver.jp.BinaryJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(BinaryJp.prototype, 'kind', { - get: function () { - return this.astNode.getOperatorCode(); - } -}); - -_lara_dummy_ = Object.defineProperty(BinaryJp.prototype, 'isInnerExpr', { - get: function () { - var parent = this.parent; - - - - while(parent !== null && parent.instanceOf('expr')){ - if(parent.astNode.getClass().getSimpleName()!=="ParenExpr") - return true; - - parent = parent.parent; - } - - return false; - - } -}); - -_lara_dummy_ = Object.defineProperty(BinaryJp.prototype, 'outerExpr', { - get: function () { - var parent = this.parent; - - - while(parent !== null && parent.instanceOf('expr')){ - if(parent.astNode.getClass().getSimpleName()!=="ParenExpr") - return parent; - - parent = parent.parent; - } - - return null; - } -}); - -_lara_dummy_ = Object.defineProperty(BinaryJp.prototype, 'isLogicOp', { - get: function () { - var kind = this.kind; - return kind === '&&' || kind === '||'; - } -}); \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaCallJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaCallJp.lara deleted file mode 100644 index 9952a11c36..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaCallJp.lara +++ /dev/null @@ -1,18 +0,0 @@ -import weaver.jp.CallJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(CallJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(CallJp.prototype, 'function', { - get: function () { - var functionDecl = this.astNode.getFunctionDecl(); - if(functionDecl.isPresent()) - return CommonJoinPoints.toJoinPoint(functionDecl.get()); - else - return null; - } -}); \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassJp.lara deleted file mode 100644 index 83241d5b98..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassJp.lara +++ /dev/null @@ -1,171 +0,0 @@ -import weaver.jp.ClassJp; -import weaver.Weaver; - -// Override ClassJp constructor -var oldClassJp = ClassJp.prototype; -var oldClass_JP_TYPES = ClassJp._JP_TYPES; - -ClassJp = function(astNode, getDefinition) { - // By default, it gets the definition - getDefinition = typeof getDefinition !== 'undefined' ? getDefinition : true; - - //console.log("getDefinition:" + astNode.getDefinition().isPresent() && getDefinition); - // check for definition - //this.originalAstNode = astNode; - //if(astNode.getDefinition().isPresent() && getDefinition) - // astNode = astNode.getDefinition().get(); - - // Parent constructor - ClassTypeJp.call(this,astNode,getDefinition); -} - -ClassJp.prototype = oldClassJp; -ClassJp._JP_TYPES = oldClass_JP_TYPES; - - - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'id', { - get: function () { - return this._qualifiedName; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, '_qualifiedName', { - get: function () { - return this.astNode.getFullyQualifiedName(); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'superClasses', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getBases())).filter($jp=>$jp.instanceOf("class")); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'allSuperClasses', { - get: function () { - var allSuperClasses = []; - - for(superClass of this.superClasses){ - allSuperClasses.push(superClass); - allSuperClasses = allSuperClasses.concat(superClass.allSuperClasses); - } - - return allSuperClasses; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, '_allMethods', { - get: function () { - var methods = Weaver.toJs(this.astNode.getMethods()); - methods = methods.map(method=> method.getDefinition().isPresent()?method.getDefinition().get():method); - return CommonJoinPoints.toJoinPoints(Weaver.toJs(methods)); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'allMethods', { - get: function () { - //return this._allMethods.filter(method => method.hasBody); - return this._allMethods; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'methods', { - get: function () { - return this.allMethods.filter(method => method.joinPointType === "method"); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'constructors', { - get: function () { - return this.allMethods.filter(method => method.joinPointType === "constructor"); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'fields', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getFields())); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, '_kind', { - get: function () { - return "class"; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'isCustom', { - get: function () { - return this.ancestor("file") != null; - - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'isAbstract', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).getIsAbstract(); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'children', { - get: function () { - return new ClassJp(this.astNode,false)._children; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'members', { - get: function () { - return this.fields.concat(this.allMethods); - } -}); - - - - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'listOfAllMethods', { - get: function () { - - var allMethods = this.methods; - - for ($interface of this.allInterfaces) { - allMethods = allMethods.concat($interface.methods); - } - - for ($superClass of this.allSuperClasses) { - allMethods = allMethods.concat($superClass.methods); - } - - return allMethods; - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'interfaces', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getBases())).filter($jp=>$jp.instanceOf("interface")); - } -}); - -_lara_dummy_ = Object.defineProperty(ClassJp.prototype, 'allInterfaces', { - get: function () { - - var allInterfaces = []; - - for (superInterface of this.interfaces) { - allInterfaces.push(superInterface); - allInterfaces = allInterfaces.concat(superInterface.allInterfaces); - } - - for ($superClass of this.allSuperClasses) { - allInterfaces = allInterfaces.concat($superClass.interfaces); - } - - return allInterfaces; - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassTypeJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassTypeJp.lara deleted file mode 100644 index f7e21e6955..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaClassTypeJp.lara +++ /dev/null @@ -1,28 +0,0 @@ -import weaver.jp.ClassTypeJp; -import weaver.Weaver; - - -// Override ClassTypeJp constructor -var oldClassTypeJp = ClassTypeJp.prototype; -var oldClassType_JP_TYPES = ClassTypeJp._JP_TYPES; - -ClassTypeJp = function(astNode, getDefinition) { - // By default, it gets the definition - getDefinition = typeof getDefinition !== 'undefined' ? getDefinition : true; - - // check for definition - //this.originalAstNode = astNode; - //if (astNode.getDefinition().isPresent() && getDefinition) - // astNode = astNode.getDefinition().get(); - - // var name = Weaver.AST_METHODS.toJavaJoinPoint(astNode).name; - // console.log("CLASS TYPE " + name); - // if (name != 'basic_string') console.log("CLASS TYPE " + astNode.getCode()); - - // Parent constructor - DeclJp.call(this,astNode); -} - -ClassTypeJp.prototype = oldClassTypeJp; -ClassTypeJp._JP_TYPES = oldClassType_JP_TYPES; - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorCallJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorCallJp.lara deleted file mode 100644 index 586a7e01a8..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorCallJp.lara +++ /dev/null @@ -1,20 +0,0 @@ -import weaver.jp.ConstructorCallJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(ConstructorCallJp.prototype, 'function', { - get: function () { - var functionDecl = this.astNode.getDecl(); - if(functionDecl.isPresent()) - return CommonJoinPoints.toJoinPoint(functionDecl.get()); - else - return null; - } -}); - - -_lara_dummy_ = Object.defineProperty(ConstructorCallJp.prototype, 'constructor', { - get: function () { - return this.method; - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorJp.lara deleted file mode 100644 index a5bce67b15..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaConstructorJp.lara +++ /dev/null @@ -1,20 +0,0 @@ -import weaver.jp.ConstructorJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(ConstructorJp.prototype, 'superCalls', { - get: function () { - var initializers = Weaver.toJs(this.astNode.getInitializers()); - // Filter Constructor calls - initializers = initializers.filter(init => init.getValue("initKind").getString() === "BaseInitializer"); - - // Get Constructor calls - initializers = initializers.map(function(init) { - var initExpr = init.getValue("initExpr"); - if(initExpr.getClass().getSimpleName()==="CXXConstructExpr") - return initExpr; - else return initExpr.getSubExpr(); - }); - - return CommonJoinPoints.toJoinPoints(initializers); - } -}); diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaDeclJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaDeclJp.lara deleted file mode 100644 index f4eefff29f..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaDeclJp.lara +++ /dev/null @@ -1,6 +0,0 @@ -import weaver.jp.DeclJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(DeclJp.prototype, 'isStatic', { - get: function () { return false; } -}); diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaElseJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaElseJp.lara deleted file mode 100644 index cbc76aedf8..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaElseJp.lara +++ /dev/null @@ -1,10 +0,0 @@ -import weaver.jp.ElseJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(ElseJp.prototype, 'isElseIf', { - get: function () { - var filteredChildren = this.children.filter(stmt => !stmt.astNode.isWrapper()); - return filteredChildren.length === 1 && filteredChildren[0].instanceOf("if"); - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldJp.lara deleted file mode 100644 index a755fa48c3..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldJp.lara +++ /dev/null @@ -1,27 +0,0 @@ -import weaver.jp.FieldJp; -import weaver.Weaver; - - -_lara_dummy_ = Object.defineProperty(FieldJp.prototype, 'id', { - get: function () { - return this.name; - } -}); - -_lara_dummy_ = Object.defineProperty(FieldJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(FieldJp.prototype, 'class', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getParent()); - } -}); - -_lara_dummy_ = Object.defineProperty(FieldJp.prototype, 'type', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getType()); - } -}); diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldRefJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldRefJp.lara deleted file mode 100644 index 343621150b..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFieldRefJp.lara +++ /dev/null @@ -1,21 +0,0 @@ -import weaver.jp.FieldRefJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(FieldRefJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(FieldRefJp.prototype, 'class', { - get: function () { - return this.field.class; - } -}); - - -_lara_dummy_ = Object.defineProperty(FieldRefJp.prototype, 'field', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getMemberDecl()); - } -}); diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFileJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFileJp.lara deleted file mode 100644 index d51162da03..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFileJp.lara +++ /dev/null @@ -1,26 +0,0 @@ -import weaver.jp.FileJp; -import weaver.Weaver; - - - -_lara_dummy_ = Object.defineProperty(FileJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - - -_lara_dummy_ = Object.defineProperty(FileJp.prototype, 'path', { - get: function () { - return this.astNode.getRelativeFilepath(); - } -}); - -_lara_dummy_ = Object.defineProperty(FileJp.prototype, 'id', { - - get: function () { - return this.name; - } -}); - - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFunctionJp.js b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFunctionJp.js deleted file mode 100644 index c7ec533e76..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaFunctionJp.js +++ /dev/null @@ -1,71 +0,0 @@ -laraImport("weaver.jp.FunctionJp"); -laraImport("weaver.Weaver"); - -// Override FunctionJp constructor -var oldFunctionJp = FunctionJp.prototype; -var oldFunction_JP_TYPES = FunctionJp._JP_TYPES; - -FunctionJp = function (astNode) { - // Parent constructor - DeclJp.call(this, astNode); -}; - -FunctionJp.prototype = oldFunctionJp; -FunctionJp._JP_TYPES = oldFunction_JP_TYPES; - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "id", { - get: function () { - return this.signature; - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "name", { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "signature", { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).signature; - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "returnType", { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getReturnType()); - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "stmts", { - get: function () { - var functionBody = this.astNode.getBody(); - if (!functionBody.isPresent()) return []; - - var functionStmts = functionBody.get().getStatements(); - return CommonJoinPoints.toJoinPoints(Weaver.toJs(functionStmts)); - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "hasBody", { - get: function () { - return this.astNode.getBody().isPresent(); - }, -}); - -_lara_dummy_ = Object.defineProperty(FunctionJp.prototype, "children", { - get: function () { - return new FunctionJp(this.astNode, false)._children; - }, -}); - -_lara_dummy_ = Object.defineProperty(MethodJp.prototype, "isCustom", { - get: function () { - //return true; - //return this.class.isCustom && this.hasBody; - return this.class.isCustom; - }, -}); - -// To avoid warning -ClavaFunctionJp = FunctionJp; diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaIfJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaIfJp.lara deleted file mode 100644 index 1d9e7589e9..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaIfJp.lara +++ /dev/null @@ -1,35 +0,0 @@ -import weaver.jp.IfJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(IfJp.prototype, 'condition', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getCondition()); - } -}); - -_lara_dummy_ = Object.defineProperty(IfJp.prototype, 'then', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getThen().get()); - } -}); - -_lara_dummy_ = Object.defineProperty(IfJp.prototype, 'else', { - get: function () { - if(this.hasElse) - return CommonJoinPoints.toJoinPoint(this.astNode.getElse().get()); - return null; - } -}); - -_lara_dummy_ = Object.defineProperty(IfJp.prototype, 'hasElse', { - get: function () { - return this.astNode.getElse().isPresent(); - } -}); - -_lara_dummy_ = Object.defineProperty(IfJp.prototype, 'isElseIf', { - get: function () { - return this.parent.instanceOf("else") && this.parent.isElseIf; - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaInterfaceJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaInterfaceJp.lara deleted file mode 100644 index 541558aafa..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaInterfaceJp.lara +++ /dev/null @@ -1,84 +0,0 @@ -import weaver.jp.InterfaceJp; -import weaver.Weaver; - - -// Override InterfaceJp constructor -var oldInterfaceJp = InterfaceJp.prototype; -var oldInterface_JP_TYPES = InterfaceJp._JP_TYPES; - - -InterfaceJp = function(astNode, getDefinition) { - // By default, it gets the definition - getDefinition = typeof getDefinition !== 'undefined' ? getDefinition : true; - - // check for definition - //this.originalAstNode = astNode; - //if (astNode.getDefinition().isPresent() && getDefinition) - // astNode = astNode.getDefinition().get(); - - // Parent constructor - ClassTypeJp.call(this,astNode,getDefinition); -} - -InterfaceJp.prototype = oldInterfaceJp; -InterfaceJp._JP_TYPES = oldInterface_JP_TYPES; - - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, '_qualifiedName', { - get: function () { - return this.astNode.getFullyQualifiedName(); - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, '_allMethods', { - get: function () { - var methods = Weaver.toJs(this.astNode.getMethods()); - methods = methods.map(method=> method.getDefinition().isPresent()?method.getDefinition().get():method); - return CommonJoinPoints.toJoinPoints(Weaver.toJs(methods)); - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, 'methods', { - get: function () { - //return this._allMethods.filter(method => method.hasBody); - return this._allMethods; - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, 'allMethods', { - get: function () { - var methods = this.methods; - - for (superInterface of this.allInterfaces) { - methods = methods.concat(superInterface.methods); - } - - return methods; - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, 'interfaces', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getBases())).filter($jp=>$jp.instanceOf("interface")); - } -}); - -_lara_dummy_ = Object.defineProperty(InterfaceJp.prototype, 'allInterfaces', { - get: function () { - - var allInterfaces = []; - - for (superInterface of this.interfaces) { - allInterfaces.push(superInterface); - allInterfaces = allInterfaces.concat(superInterface.allInterfaces); - } - - return allInterfaces; - } -}); \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaJoinPoint.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaJoinPoint.lara deleted file mode 100644 index e1d550ad51..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaJoinPoint.lara +++ /dev/null @@ -1,43 +0,0 @@ -import weaver.jp.JoinPoint; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(JoinPoint.prototype, 'line', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).line; - } -}); - -_lara_dummy_ = Object.defineProperty(JoinPoint.prototype, 'endLine', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).endLine; - } -}); - - -_lara_dummy_ = Object.defineProperty(JoinPoint.prototype, 'code', { - get: function () { - try { - return Weaver.toJs(this.astNode.getCode()); - } - catch(err){ - return null; - } - } -}); - -_lara_dummy_ = Object.defineProperty(JoinPoint.prototype, 'astId', { - get: function () { - return this.astNode.getValue("id"); - } -}); - -JoinPoint.prototype.equals = function(joinPoint) { - - if(joinPoint === undefined) { - return false; - } - - var javaJoinPoint = Weaver.AST_METHODS.toJavaJoinPoint(joinPoint.astNode); - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).compareNodes(javaJoinPoint); -} - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaLoopJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaLoopJp.lara deleted file mode 100644 index 8f15f0922c..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaLoopJp.lara +++ /dev/null @@ -1,19 +0,0 @@ -import weaver.jp.LoopJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(LoopJp.prototype, 'condition', { - get: function () { - var conditionExpr = this.astNode.getStmtCondition(); - if(conditionExpr.isPresent()) - return CommonJoinPoints.toJoinPoint(conditionExpr.get()); - else - return null; - } -}); - -_lara_dummy_ = Object.defineProperty(LoopJp.prototype, 'hasCondition', { - get: function () { - return this.astNode.getStmtCondition().isPresent(); - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMemberCallJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMemberCallJp.lara deleted file mode 100644 index 19f29d3e17..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMemberCallJp.lara +++ /dev/null @@ -1,19 +0,0 @@ -import weaver.jp.MemberCallJp; -import weaver.Weaver; - -// TODO: This *probably* should be changed to use CXXMemberCallExpr.getBase() -// After implementing ThisJp, PointerJp, and other possible memberCall bases -_lara_dummy_ = Object.defineProperty(MemberCallJp.prototype, 'class', { - get: function () { - if(this.method===null) - return null; - else return this.method.class; - - } -}); - -_lara_dummy_ = Object.defineProperty(MemberCallJp.prototype, 'method', { - get: function () { - return this.function; - } -}); \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMethodJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMethodJp.lara deleted file mode 100644 index 79c4f9d5f1..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaMethodJp.lara +++ /dev/null @@ -1,27 +0,0 @@ -import weaver.jp.MethodJp; -import weaver.Weaver; - - -_lara_dummy_ = Object.defineProperty(MethodJp.prototype, 'class', { - get: function () { - var classDecl = this.astNode.getRecordDecl(); - if(classDecl.isPresent()) - return CommonJoinPoints.toJoinPoint(classDecl.get()); - else - return null; - } -}); - -_lara_dummy_ = Object.defineProperty(MethodJp.prototype, 'params', { - get: function () { - var params = []; - for (var param of this.astNode.getParameters()) { - params.push(CommonJoinPoints.toJoinPoint(param)); - } - return params; - } -}); - - - - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaParamJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaParamJp.lara deleted file mode 100644 index 84c2eff8ec..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaParamJp.lara +++ /dev/null @@ -1,14 +0,0 @@ -import weaver.jp.ParamJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(ParamJp.prototype, 'function', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getFunctionDecl()); - } -}); - -_lara_dummy_ = Object.defineProperty(ParamJp.prototype, 'isParam', { - get: function () { - return true; - } -}); \ No newline at end of file diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaTypeJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaTypeJp.lara deleted file mode 100644 index ea50314997..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaTypeJp.lara +++ /dev/null @@ -1,193 +0,0 @@ -import weaver.jp.TypeJp; -import weaver.Weaver; - - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'kind', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).kind; - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isArray', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).isArray; - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isPointer', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).isPointer; - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isPrimitive', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).isBuiltin; - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isClass', { - get: function () { - // if(this.kind !== 'RecordType') return false; - // return this.astNode.getTagKind().toString()==="CLASS"; - - var classType = this.classType; - return this.classType.instanceOf("class"); - } -}); - - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isInterface', { - get: function () { - var classType = this.classType; - return classType.instanceOf("interface"); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'isClassType', { - get: function () { - var classType = this.classType; - return classType.instanceOf("interface") || classType.instanceOf("class"); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'classType', { - get: function () { - - var name = this.astNode.getCode().replace(" &", "").trim(); - var subtype = getRecordType(this); - return subtype; - } -}); - -function getRecordType(type) { - if (type == null) return null; - if (type == undefined) return null; - - if (type.kind === 'RecordType') return CommonJoinPoints.toJoinPoint(type.astNode.getDecl()); - - var childType = null; - - if (type.kind === 'PointerType') { - childType = type.astNode.getPointeeType(); - } - if (type.kind === 'LValueReferenceType' || this.kind === 'RValueReferenceType') { - childType = type.astNode.getReferencee(); - } - if (type.kind === 'QualType') { - childType = type.astNode.getUnqualifiedType(); - } - if (type.kind === 'ElaboratedType') { - childType = type.astNode.getNamedType(); - } - if (type.kind === 'ReferenceType') { - childType = type.astNode.getReferencee(); - } - - if (childType == null || childType == undefined) return null; - - return getRecordType(CommonJoinPoints.toJoinPoint(childType)); -} -/* -public static Type getSingleElement(Type type) { - if (type instanceof DecayedType) { - return ((DecayedType) type).getOriginalType(); - } - - if (type instanceof AdjustedType) { - return ((AdjustedType) type).getAdjustedType(); - } - - if (type instanceof PointerType) { - return ((PointerType) type).getPointeeType(); - } - - if (type instanceof ArrayType) { - return ((ArrayType) type).getElementType(); - } - - if (type instanceof QualType) { - return ((QualType) type).getUnqualifiedType(); - } - - if (type instanceof TypedefType) { - return ((TypedefType) type).getTypeClass(); - } - - return null; - } -*/ - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_hasSugar', { - get: function () { - return this.astNode.hasSugar(); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_desugar', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.desugar()); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_unwrap', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getElementType()); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_desugarAll', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.desugarAll()); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'decl', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getDecl()); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_hasTemplateArgs', { - get: function () { - return this.astNode.hasTemplateArgs(); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_templateArgsTypes', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getTemplateArgumentTypes())); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_typeDescendants', { - get: function () { - return CommonJoinPoints.toJoinPoints(Weaver.toJs(this.astNode.getTypeDescendants())); - } -}); - -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, '_typeDescendantsAndSelf', { - get: function () { - return [this].concat(this._typeDescendants); - } -}); - -// TODO: It currently returns duplicates -_lara_dummy_ = Object.defineProperty(TypeJp.prototype, 'usedTypes', { - get: function () { - var usedTypes = []; - - for(type of this._typeDescendantsAndSelf){ - usedTypes.push(type); - - if(type._hasTemplateArgs) - for(templateType of type._templateArgsTypes) - usedTypes = usedTypes.concat(templateType.usedTypes); - - } - - return usedTypes; - - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarDeclJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarDeclJp.lara deleted file mode 100644 index 70c8bb7362..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarDeclJp.lara +++ /dev/null @@ -1,21 +0,0 @@ -import weaver.jp.VarDeclJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(VarDeclJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(VarDeclJp.prototype, 'type', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getType()); - } -}); - -_lara_dummy_ = Object.defineProperty(VarDeclJp.prototype, 'isParam', { - get: function () { - return false; - } -}); - diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarRefJp.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarRefJp.lara deleted file mode 100644 index 2458aad52d..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/ClavaVarRefJp.lara +++ /dev/null @@ -1,14 +0,0 @@ -import weaver.jp.VarRefJp; -import weaver.Weaver; - -_lara_dummy_ = Object.defineProperty(VarRefJp.prototype, 'name', { - get: function () { - return Weaver.AST_METHODS.toJavaJoinPoint(this.astNode).name; - } -}); - -_lara_dummy_ = Object.defineProperty(VarRefJp.prototype, 'decl', { - get: function () { - return CommonJoinPoints.toJoinPoint(this.astNode.getDeclaration()); - } -}); diff --git a/ClavaLaraApi/src-lara/clava/weaver/jp/CommonJoinPoints.lara b/ClavaLaraApi/src-lara/clava/weaver/jp/CommonJoinPoints.lara deleted file mode 100644 index 0ef8804832..0000000000 --- a/ClavaLaraApi/src-lara/clava/weaver/jp/CommonJoinPoints.lara +++ /dev/null @@ -1,29 +0,0 @@ -// Enable Clava version of common join points -import weaver.jp.ClavaJoinPoint; -import weaver.jp.ClavaClassJp; -import weaver.jp.ClavaClassTypeJp; -import weaver.jp.ClavaInterfaceJp; -import weaver.jp.ClavaDeclJp; -import weaver.jp.ClavaMethodJp; -import weaver.jp.ClavaFunctionJp; -import weaver.jp.ClavaCallJp; -import weaver.jp.ClavaMemberCallJp; -import weaver.jp.ClavaFieldJp; -import weaver.jp.ClavaFieldRefJp; -import weaver.jp.ClavaTypeJp; -import weaver.jp.ClavaVarDeclJp; -import weaver.jp.ClavaVarRefJp; -import weaver.jp.ClavaParamJp; -import weaver.jp.ClavaConstructorJp; -import weaver.jp.ClavaConstructorCallJp; -import weaver.jp.ClavaLoopJp; -import weaver.jp.ClavaIfJp; -import weaver.jp.ClavaBinaryJp; -import weaver.jp.ClavaFileJp; -import weaver.jp.ClavaElseJp; - -// Patches weaver.JoinPoint and other classes -import weaver.jp.JoinPointsCommonPath; - -import weaver.Selector; - diff --git a/ClavaOptionsManager/build.gradle b/ClavaOptionsManager/build.gradle new file mode 100644 index 0000000000..3f9430189a --- /dev/null +++ b/ClavaOptionsManager/build.gradle @@ -0,0 +1,35 @@ +plugins { + id 'application' +} + +repositories { + mavenCentral() +} + +dependencies { + // This dependency is used by the application. + implementation ':ClavaWeaver' + + implementation ':LARAI' + implementation ':WeaverInterface' + implementation ':WeaverOptionsManager' +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +application { + // Define the main class for the application. + mainClass = 'pt.up.fe.specs.clava.ClavaOptionsManagerLauncher' +} + +sourceSets { + main { + java { + srcDir 'src' + } + } +} diff --git a/ClavaOptionsManager/settings.gradle b/ClavaOptionsManager/settings.gradle new file mode 100644 index 0000000000..cb9527b050 --- /dev/null +++ b/ClavaOptionsManager/settings.gradle @@ -0,0 +1,9 @@ +rootProject.name = 'ClavaOptionsManager' + +def laraFrameworkRoot = System.getenv('LARA_FRAMEWORK_HOME') ?: '../../lara-framework' + +includeBuild("${laraFrameworkRoot}/LARAI") +includeBuild("${laraFrameworkRoot}/WeaverInterface") +includeBuild("${laraFrameworkRoot}/WeaverOptionsManager") + +includeBuild("../ClavaWeaver") diff --git a/ClavaOptionsManager/src/pt/up/fe/specs/clava/ClavaOptionsManagerLauncher.java b/ClavaOptionsManager/src/pt/up/fe/specs/clava/ClavaOptionsManagerLauncher.java new file mode 100644 index 0000000000..2685de0f57 --- /dev/null +++ b/ClavaOptionsManager/src/pt/up/fe/specs/clava/ClavaOptionsManagerLauncher.java @@ -0,0 +1,10 @@ +package pt.up.fe.specs.clava; + +import pt.up.fe.specs.WeaverOptionsManagerLauncher; +import pt.up.fe.specs.clava.weaver.CxxWeaver; + +public class ClavaOptionsManagerLauncher extends WeaverOptionsManagerLauncher { + public static void main(String[] args) { + launchGui(new CxxWeaver()); + } +} diff --git a/ClavaTester/.classpath b/ClavaTester/.classpath deleted file mode 100644 index 10c027cc15..0000000000 --- a/ClavaTester/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/ClavaTester/.project b/ClavaTester/.project deleted file mode 100644 index ede85c7615..0000000000 --- a/ClavaTester/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - ClavaTester - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - - - - 1689777598985 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaTester/.settings/org.eclipse.jdt.core.prefs b/ClavaTester/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index d1be34ce5c..0000000000 --- a/ClavaTester/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,22 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled -org.eclipse.jdt.core.compiler.source=1.8 diff --git a/ClavaTester/ivy.xml b/ClavaTester/ivy.xml deleted file mode 100644 index bb5de83c57..0000000000 --- a/ClavaTester/ivy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/ClavaTester/run/ClavaTester-mingw.launch b/ClavaTester/run/ClavaTester-mingw.launch deleted file mode 100644 index bdce100a0c..0000000000 --- a/ClavaTester/run/ClavaTester-mingw.launch +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaLauncher.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaLauncher.java deleted file mode 100644 index 5c77bba72b..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaLauncher.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.List; - -import com.google.common.base.Preconditions; - -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.lazy.ThreadSafeLazy; -import pt.up.fe.specs.util.providers.FileResourceProvider.ResourceWriteData; - -/** - * - * @author JoaoBispo - * - */ -public class ClavaLauncher { - - private static final String CLAVA_CLASSNAME = "pt.up.fe.specs.cxxweaver.CxxWeaverLauncher"; - - private static final Lazy CLAVA_LAUNCHER = new ThreadSafeLazy<>(() -> ClavaLauncher.newInstance()); - - public static ClavaLauncher getInstance() { - return CLAVA_LAUNCHER.get(); - } - - private static ClavaLauncher newInstance() { - // Destination folder for Clava jar - File clavaFolder = SpecsIo.mkdir(SpecsIo.getJarPath(ClavaLauncher.class).orElse(SpecsIo.getWorkingDir()), - "clava_jar"); - - // Prepare resource - ResourceWriteData clavaJar = ClavaTesterWebResource.CLAVA_JAR.writeVersioned(clavaFolder, ClavaLauncher.class); - - loadLibrary(clavaJar.getFile()); - - try { - Class clavaClass = Class.forName(CLAVA_CLASSNAME); - Method method = clavaClass.getMethod("execute", List.class); - return new ClavaLauncher(method); - } catch (NoSuchMethodException | SecurityException | ClassNotFoundException | IllegalArgumentException e) { - throw new RuntimeException("Could not create dynamic method for invoking Clava", e); - } - - } - - private final Method method; - - private ClavaLauncher(Method method) { - this.method = method; - } - - public boolean execute(List args) { - - try { - Object result = method.invoke(null, args); - Preconditions.checkArgument(result instanceof Boolean); - return (Boolean) result; - } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException("Problems while calling Clava", e); - } - - } - - /** - * Adds the supplied Java Archive library to java.class.path. This is benign if the library is already loaded. - * - *

- * Based on this answer: https://stackoverflow.com/questions/27187566/load-jar-dynamically-at-runtime - */ - private static synchronized void loadLibrary(File jar) { - try { - /*We are using reflection here to circumvent encapsulation; addURL is not public*/ - java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader(); - java.net.URL url = jar.toURI().toURL(); - /*Disallow if already loaded*/ - for (java.net.URL it : java.util.Arrays.asList(loader.getURLs())) { - if (it.equals(url)) { - return; - } - } - java.lang.reflect.Method method = java.net.URLClassLoader.class.getDeclaredMethod("addURL", - new Class[] { java.net.URL.class }); - method.setAccessible(true); /*promote the method to public access*/ - method.invoke(loader, new Object[] { url }); - } catch (final java.lang.NoSuchMethodException | java.lang.IllegalAccessException - | java.net.MalformedURLException | java.lang.reflect.InvocationTargetException e) { - throw new RuntimeException("Could not dynamically load jar '" + jar + "'", e); - } - } -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestResult.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestResult.java deleted file mode 100644 index 621edf8b9c..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestResult.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import java.util.Optional; - -public class ClavaTestResult { - - private final boolean success; - private final String errorMessage; - private final ClavaTestStage lastExecutedStage; - private final Throwable exception; - - public static ClavaTestResult newSuccess(ClavaTestStage lastExecutedStage) { - return new ClavaTestResult(true, null, lastExecutedStage, null); - } - - public static ClavaTestResult newFail(String message, ClavaTestStage lastExecutedStage) { - return new ClavaTestResult(false, message, lastExecutedStage, null); - } - - public static ClavaTestResult newFail(Throwable e, ClavaTestStage lastExecutedStage) { - return new ClavaTestResult(false, "Exception:\n" + e.getMessage(), lastExecutedStage, e); - } - - private ClavaTestResult(boolean success, String errorMessage, ClavaTestStage lastExecutedStage, - Throwable exception) { - this.success = success; - this.errorMessage = errorMessage; - this.lastExecutedStage = lastExecutedStage; - this.exception = exception; - } - - public Optional getErrorMessage() { - if (isSuccess()) { - return Optional.empty(); - } - - return Optional.of(errorMessage); - } - - public boolean isSuccess() { - return success; - } - - public ClavaTestStage getLastExecutedStage() { - return lastExecutedStage; - } - - @Override - public String toString() { - StringBuilder message = new StringBuilder(); - - message.append("[" + lastExecutedStage + "] "); - if (success) { - message.append("Success"); - } else { - message.append("Fail: " + errorMessage); - } - - return message.toString(); - } - - public Throwable getException() { - return exception; - } - - public boolean isException() { - return exception != null; - } -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestStage.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestStage.java deleted file mode 100644 index 39649c6b59..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTestStage.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -public enum ClavaTestStage { - - CLAVA, - CMAKE, - RUN_PROGRAM; -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTester.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTester.java deleted file mode 100644 index 6002517f24..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTester.java +++ /dev/null @@ -1,255 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import pt.up.fe.specs.clang.Platforms; -import pt.up.fe.specs.clang.SupportedPlatform; -import pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.parsing.arguments.ArgumentsParser; -import pt.up.fe.specs.util.properties.SpecsProperties; -import pt.up.fe.specs.util.system.ProcessOutputAsString; -import pt.up.fe.specs.util.utilities.ProgressCounter; -import pt.up.fe.specs.util.utilities.StringLines; - -public class ClavaTester { - - private static final String CMAKELISTS_FILENAME = "CMakeLists.txt"; - private static final String ARGS_FILENAME = "args.txt"; - - // private static final Set EXECUTABLES_IGNORE_LIST = new HashSet<>(Arrays.asList("makefile")); - - private final SupportedPlatform platform; - private final SpecsProperties config; - - public ClavaTester(SupportedPlatform platform, SpecsProperties clavaTesterProps) { - this.platform = platform; - this.config = clavaTesterProps; - } - - public ClavaTestResult test(File clavaConfig) { - // Call Clava with the config file - List args = Arrays.asList("-c", clavaConfig.getAbsolutePath()); - - try { - // boolean success = ClavaLauncher.getInstance().execute(args); - boolean success = ClavaWeaverLauncher.execute(args); - if (!success) { - return ClavaTestResult.newFail("Clava execution did not succeed", ClavaTestStage.CLAVA); - } - } catch (Exception e) { - return ClavaTestResult.newFail(e, ClavaTestStage.CLAVA); - } - - File configFolder = clavaConfig.getParentFile(); - - // Check if there is a CMake file to build application - File cmakelists = new File(configFolder, CMAKELISTS_FILENAME); - if (!cmakelists.exists()) { - SpecsLogs.msgInfo( - "Could not find a '" + CMAKELISTS_FILENAME + "' file in the folder of the Clava config, returning"); - return ClavaTestResult.newSuccess(ClavaTestStage.CLAVA); - } - - // Call CMake stage - StageResult cmakeResult = stageCmake(configFolder); - if (!cmakeResult.getResult().isSuccess()) { - return cmakeResult.getResult(); - } - - // Call last stage, Run Program - File buildFolder = cmakeResult.getData(); - try { - return stageRunProgram(buildFolder, configFolder); - } catch (Exception e) { - return ClavaTestResult.newFail(e, ClavaTestStage.RUN_PROGRAM); - } - - } - - private ClavaTestResult stageRunProgram(File buildFolder, File configFolder) { - - File executable = Platforms.getExecutableTry(buildFolder).orElse(null); - if (executable == null) { - return ClavaTestResult.newFail( - "Could not find executable in build folder '" + buildFolder.getAbsolutePath() + "'", - ClavaTestStage.RUN_PROGRAM); - } - /* - // Find executable - List executables = IoUtils.getFiles(buildFolder).stream() - .filter(this::isExecutable) - .collect(Collectors.toList()); - - if (executables.isEmpty()) { - return ClavaTestResult.newFail( - "Could not find executable in build folder '" + buildFolder.getAbsolutePath() + "'", - ClavaTestStage.RUN_PROGRAM); - } - - File executable = getExecutable(executables); - */ - // Check if there are arguments to be used when calling the program - File argsFile = new File(configFolder, ARGS_FILENAME); - - // If file does not exist, call program once, without arguments - if (!argsFile.isFile()) { - SpecsLogs.msgInfo("No '" + ARGS_FILENAME + "' file found, executing once without arguments"); - return runProgram(Arrays.asList(executable.getAbsolutePath()), buildFolder); - } - - // Read arguments file, each non-empty line represents the arguments with which the program should be called - List executions = StringLines.getLines(argsFile).stream() - .filter(line -> !line.isEmpty()) - .collect(Collectors.toList()); - - ProgressCounter progress = new ProgressCounter(executions.size()); - ArgumentsParser parser = ArgumentsParser.newCommandLine(); - String executablePath = executable.getAbsolutePath(); - SpecsLogs.msgInfo("Found " + executions.size() + " executions"); - for (String execution : executions) { - SpecsLogs.msgInfo("Executing " + executable.getName() + " " + execution + "... " + progress.next()); - List command = new ArrayList<>(); - command.add(executablePath); - command.addAll(parser.parse(execution)); - - ClavaTestResult result = runProgram(command, buildFolder); - if (!result.isSuccess()) { - return result; - } - } - - return ClavaTestResult.newSuccess(ClavaTestStage.RUN_PROGRAM); - } - - private ClavaTestResult runProgram(List command, File buildFolder) { - ProcessOutputAsString output = SpecsSystem.runProcess(command, buildFolder, false, true); - if (output.isError()) { - return ClavaTestResult.newFail( - "Problems while running the program '" + command.get(0) + "'", - ClavaTestStage.RUN_PROGRAM); - } - - return ClavaTestResult.newSuccess(ClavaTestStage.RUN_PROGRAM); - } - - /* - private static File getExecutable(List executables) { - if (executables.isEmpty()) { - throw new RuntimeException("Could not find an executable file in the build folder"); - } - - if (executables.size() == 1) { - return executables.get(0); - } - - File lastModified = null; - for (int i = 0; i < executables.size(); i++) { - File currentFile = executables.get(i); - - // Check if file is part of the ignore list - if (EXECUTABLES_IGNORE_LIST.contains(currentFile.getName().toLowerCase())) { - LoggingUtils.msgInfo("Ignoring executable '" + currentFile.getName() + "'"); - continue; - } - - // If no file yet, just use it - if (lastModified == null) { - lastModified = currentFile; - continue; - } - - if (lastModified.lastModified() < currentFile.lastModified()) { - lastModified = currentFile; - } - } - - LoggingUtils.msgInfo("Found more than 1 executable file in the build folder, choosing the most recent one: " - + lastModified.getAbsolutePath()); - - return lastModified; - } - */ - /* - private boolean isExecutable(File file) { - if (platform.isWindows()) { - return file.getName().endsWith(".exe"); - } - - if (platform.isLinux()) { - return file.canExecute(); - } - - throw new NotImplementedException("Not implemented for platform " + platform); - } - */ - - private StageResult stageCmake(File configFolder) { - // Prepare folder for compilation - String buildFoldername = "build-" + platform.getName(); - File buildFolder = SpecsIo.mkdir(configFolder, buildFoldername); - - if (config.getBoolean(ClavaTesterProperties.CLEAN_BUILD_FOLDER)) { - if (!SpecsIo.deleteFolderContents(buildFolder)) { - return new StageResult<>(ClavaTestResult.newFail( - "Could not delete contents of build folder '" + buildFolder.getAbsolutePath() + "'", - ClavaTestStage.CMAKE)); - } - } - - // Create makefile with cmake - List cmakeCommand = new ArrayList<>(); - cmakeCommand.add("cmake"); - cmakeCommand.add(".."); - - String cmakeGenerator = config.get(ClavaTesterProperties.CMAKE_GENERATOR); - if (!cmakeGenerator.isEmpty()) { - cmakeCommand.add("-G"); - cmakeCommand.add(cmakeGenerator); - } - - // Call cmake in build folder - ProcessOutputAsString cmakeOutput = SpecsSystem.runProcess(cmakeCommand, buildFolder, false, true); - if (cmakeOutput.isError()) { - return new StageResult<>(ClavaTestResult.newFail( - "Problems while executing 'cmake'", ClavaTestStage.CMAKE)); - } - - // Call make - String makeCommand = config.get(ClavaTesterProperties.MAKE_COMMAND); - if (makeCommand.isEmpty()) { - SpecsLogs.msgInfo( - "No make command defined (property '" + ClavaTesterProperties.MAKE_COMMAND.getKey() - + "', using 'make')"); - makeCommand = "make"; - } - - ProcessOutputAsString makeOutput = SpecsSystem.runProcess(Arrays.asList(makeCommand), buildFolder, false, true); - if (makeOutput.isError()) { - return new StageResult<>(ClavaTestResult.newFail( - "Problems while executing 'make'", ClavaTestStage.CMAKE)); - } - - return new StageResult(buildFolder, ClavaTestResult.newSuccess(ClavaTestStage.CMAKE)); - } - -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterArgs.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterArgs.java deleted file mode 100644 index 346cfa9123..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterArgs.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import java.io.File; - -public class ClavaTesterArgs { - - private final File baseFolder; - private final boolean cleanBuild; - private final boolean cleanData; - - public ClavaTesterArgs(File baseFolder, boolean cleanBuild, boolean cleanData) { - this.baseFolder = baseFolder; - this.cleanBuild = cleanBuild; - this.cleanData = cleanData; - } - - public File getBaseFolder() { - return baseFolder; - } - - public boolean isCleanBuild() { - return cleanBuild; - } - - public boolean isCleanData() { - return cleanData; - } - -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterLauncher.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterLauncher.java deleted file mode 100644 index 4853d3cd88..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterLauncher.java +++ /dev/null @@ -1,412 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -import pt.up.fe.specs.clang.SupportedPlatform; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.csv.CsvWriter; -import pt.up.fe.specs.util.properties.SpecsProperties; -import pt.up.fe.specs.util.providers.FileResourceProvider.ResourceWriteData; -import pt.up.fe.specs.util.providers.WebResourceProvider; -import pt.up.fe.specs.util.providers.impl.GenericWebResourceProvider; -import pt.up.fe.specs.util.utilities.ProgressCounter; -import pt.up.fe.specs.util.utilities.StringLines; - -public class ClavaTesterLauncher { - - private static final String WEBRESOURCES_FILENAME = "clavatester.webresources"; - private static final String CLEAN_BUILD_ARG = "-clean-build"; - private static final String CLEAN_DATA_ARG = "-clean-data"; - // private static final List ARGS = Arrays.asList("-clean-build", "-clean-data"); - - public static void main(String[] args) { - SpecsSystem.programStandardInit(); - - ClavaTesterArgs clavaTesterArgs = parseArgs(args); - - if (clavaTesterArgs.isCleanBuild()) { - cleanBuild(clavaTesterArgs.getBaseFolder()); - } - - if (clavaTesterArgs.isCleanData()) { - cleanData(clavaTesterArgs.getBaseFolder()); - } - - File baseFolder = clavaTesterArgs.getBaseFolder(); - SpecsProperties clavaTesterProps = getProps(baseFolder, args); - - // Detect platform - SupportedPlatform platform = SupportedPlatform.getCurrentPlatform(); - - // Prepare web-resources - prepareWebResources(baseFolder); - - // Find Clava configuration files for the current platform - String suffix = "-" + platform.getName() + ".clava"; - - List clavaConfigs = SpecsIo.getFilesRecursive(baseFolder).stream() - .filter(file -> file.getName().toLowerCase().endsWith(suffix)) - .collect(Collectors.toList()); - - // Sort, in Linux file listing usually are not sorted - Collections.sort(clavaConfigs); - - // Create tester - ClavaTester tester = new ClavaTester(platform, clavaTesterProps); - - // Incrementally write results - CsvWriter csvWriter = new CsvWriter("Clava config", "Status", "Stage", "Error message"); - File csvFile = new File(baseFolder, "clava-tester-results-" + platform + ".csv"); - - ProgressCounter progress = new ProgressCounter(clavaConfigs.size()); - SpecsLogs.msgInfo("Found " + clavaConfigs.size() + " Clava configuration files"); - Map results = new LinkedHashMap<>(); - for (File clavaConfig : clavaConfigs) { - SpecsLogs.msgInfo("Testing '" + clavaConfig.getAbsolutePath() + "' " + progress.next()); - ClavaTestResult result = tester.test(clavaConfig); - results.put(clavaConfig, result); - - if (result.isSuccess()) { - SpecsLogs.msgInfo("Execution ok\n"); - } else { - SpecsLogs.msgInfo("Execution failed:\n" + result.getErrorMessage().get() + "\n"); - if (result.isException()) { - result.getException().printStackTrace(); - } - } - - SpecsLogs.msgInfo("-------------------------\n"); - - // Save CSV - csvWriter.addLine(toCsvLine(clavaConfig, result)); - SpecsIo.write(csvFile, csvWriter.buildCsv()); - - } - - // Save results - // saveResults(results, baseFolder); - - } - - private static void prepareWebResources(File baseFolder) { - List webResourcesLines = getWebResources(baseFolder); - if (webResourcesLines.isEmpty()) { - return; - } - - SpecsLogs.msgInfo("Found " + webResourcesLines.size() + " resources to download"); - ProgressCounter progress = new ProgressCounter(webResourcesLines.size()); - for (String webResource : webResourcesLines) { - SpecsLogs.msgInfo("Processing " + webResource + "... " + progress.next()); - - WebResourceProvider webResourceProvider = parseWebResource(webResource).orElse(null); - if (webResourceProvider == null) { - continue; - } - - // // Split into URL and version - // String[] resourceParts = webResource.split(","); - // if (resourceParts.length == 1) { - // LoggingUtils.msgInfo( - // "Expected to find one ',' character, separating the URL from the version: " + webResource); - // continue; - // } - // - // if (resourceParts.length > 2) { - // LoggingUtils.msgInfo( - // "Expected to find only one ',' character, separating the URL from the version: " + webResource); - // } - // - // String url = resourceParts[0].trim(); - // String version = resourceParts[1].trim(); - // - // int rootEndIndex = url.lastIndexOf('/'); - // if (rootEndIndex == -1) { - // LoggingUtils.msgInfo("Expected to find at least one '/' in the URL: " + url); - // continue; - // } - // - // if (rootEndIndex == url.length() - 1) { - // LoggingUtils.msgInfo("URL should represent a file and not end with a '/': " + url); - // continue; - // } - // - // String rootUrl = url.substring(0, rootEndIndex + 1); - // String resourceUrl = url.substring(rootEndIndex + 1); - // - // if (!resourceUrl.endsWith(".zip")) { - // LoggingUtils.msgInfo("Expected URL to end with '.zip': " + url); - // continue; - // } - // - // WebResourceProvider webResourceProvider = new GenericWebResourceProvider(rootUrl, resourceUrl, version); - ResourceWriteData zipData = webResourceProvider.writeVersioned(baseFolder, ClavaTesterLauncher.class, - false); - - if (!zipData.isNewFile()) { - SpecsLogs.msgInfo("File '" + webResourceProvider.getResourceUrl() + "' is up-to-date"); - continue; - } - - SpecsIo.extractZip(zipData.getFile(), baseFolder); - - // Overwrite zip file, to reduce size, and keep it there for book-keeping of next versions - SpecsIo.write(zipData.getFile(), - "File was successfully extracted (current version: " + webResourceProvider.getVersion() + ")"); - } - - } - - private static List getWebResources(File baseFolder) { - File webResources = new File(baseFolder, WEBRESOURCES_FILENAME); - - if (!webResources.isFile()) { - SpecsLogs - .msgInfo("Did not find a '" + WEBRESOURCES_FILENAME + "' file, skipping download of web resources"); - return Collections.emptyList(); - } - - return StringLines.getLines(webResources); - } - - private static Optional parseWebResource(String webResource) { - // Split into URL and version - String[] resourceParts = webResource.split(","); - if (resourceParts.length == 1) { - SpecsLogs.msgInfo( - "Expected to find one ',' character, separating the URL from the version: " + webResource); - return Optional.empty(); - } - - if (resourceParts.length > 2) { - SpecsLogs.msgInfo( - "Expected to find only one ',' character, separating the URL from the version: " + webResource); - } - - String url = resourceParts[0].trim(); - String version = resourceParts[1].trim(); - - int rootEndIndex = url.lastIndexOf('/'); - if (rootEndIndex == -1) { - SpecsLogs.msgInfo("Expected to find at least one '/' in the URL: " + url); - return Optional.empty(); - } - - if (rootEndIndex == url.length() - 1) { - SpecsLogs.msgInfo("URL should represent a file and not end with a '/': " + url); - return Optional.empty(); - } - - String rootUrl = url.substring(0, rootEndIndex + 1); - String resourceUrl = url.substring(rootEndIndex + 1); - - if (!resourceUrl.endsWith(".zip")) { - SpecsLogs.msgInfo("Expected URL to end with '.zip': " + url); - return Optional.empty(); - } - - WebResourceProvider webResourceProvider = new GenericWebResourceProvider(rootUrl, resourceUrl, version); - - return Optional.of(webResourceProvider); - } - - private static List toCsvLine(File clavaConfig, ClavaTestResult result) { - List line = new ArrayList<>(); - - line.add(clavaConfig.getAbsolutePath()); - line.add(result.isSuccess() ? "Pass" : "Fail"); - line.add(result.getLastExecutedStage().toString()); - line.add(SpecsStrings.escapeJson(result.getErrorMessage().orElse(""))); - - return line; - } - - /* - private static void saveResults(Map results, File folder) { - CsvWriter csvWriter = new CsvWriter(); - csvWriter.setHeader(Arrays.asList("Clava config", "Status", "Stage", "Error message")); - - for (Entry entry : results.entrySet()) { - List line = new ArrayList<>(); - line.add(entry.getKey().getAbsolutePath()); - line.add(entry.getValue().isSuccess() ? "Pass" : "Fail"); - line.add(entry.getValue().getLastExecutedStage().toString()); - line.add(ParseUtils.escapeJson(entry.getValue().getErrorMessage().orElse(""))); - - csvWriter.addLine(line); - } - - IoUtils.write(new File(folder, "clava-tester-results.csv"), csvWriter.buildCsv()); - } - */ - private static SpecsProperties getProps(File baseFolder, String[] args) { - if (args.length < 2) { - SpecsLogs.msgInfo("No properties file defined, returning default properties"); - return SpecsProperties.newEmpty(); - } - - File propsFile = new File(baseFolder, args[1]); - if (!propsFile.isFile()) { - SpecsLogs.msgInfo("Properties file '" + args[1] + "' not fould, returning default properties"); - } - - return SpecsProperties.newInstance(propsFile); - } - - private static ClavaTesterArgs parseArgs(String[] args) { - List argsList = new ArrayList<>(Arrays.asList(args)); - - // Check if there are flags - boolean cleanBuild = processArg(argsList, CLEAN_BUILD_ARG); - boolean cleanData = processArg(argsList, CLEAN_DATA_ARG); - - // If no arguments, assum current folder - if (args.length == 0) { - File baseFolder = SpecsIo.getWorkingDir(); - SpecsLogs.msgInfo("No arguments given, assuming current folder (" + baseFolder.getAbsolutePath() + ")"); - return new ClavaTesterArgs(baseFolder, cleanBuild, cleanData); - } - - File baseFolder = SpecsIo.mkdir(args[0]); - SpecsLogs.msgInfo("Using '" + baseFolder.getAbsolutePath() + "' as base folder."); - return new ClavaTesterArgs(baseFolder, cleanBuild, cleanData); - } - - private static boolean processArg(List argsList, String booleanArg) { - Integer cleanIndex = null; - - // Find arg - for (int i = 0; i < argsList.size(); i++) { - String arg = argsList.get(i); - if (arg.toLowerCase().equals(booleanArg)) { - cleanIndex = i; - break; - } - } - - // Clean arg found - if (cleanIndex != null) { - argsList.remove(cleanIndex.intValue()); - return true; - } - - return false; - } - - /** - * Deletes build folders and woven code folders - * - * @param baseFolder - */ - private static void cleanBuild(File baseFolder) { - List foldersToClean = SpecsIo.getFoldersRecursive(baseFolder).stream() - .filter(ClavaTesterLauncher::isBuildFolder) - .collect(Collectors.toList()); - - SpecsLogs.msgInfo("Build cleaning: found " + foldersToClean.size() + " folders to clean"); - ProgressCounter progress = new ProgressCounter(foldersToClean.size()); - - Collections.sort(foldersToClean); - - for (File folderToClean : foldersToClean) { - SpecsLogs - .msgInfo("Deleting folder '" + folderToClean.getAbsolutePath() + "'... " + progress.next()); - SpecsIo.deleteFolder(folderToClean); - } - - } - - private static void cleanData(File baseFolder) { - List foldersToClean = SpecsIo.getFoldersRecursive(baseFolder).stream() - .filter(ClavaTesterLauncher::isDataFolder) - .collect(Collectors.toList()); - - SpecsLogs.msgInfo("Data cleaning: found " + foldersToClean.size() + " folders to clean"); - ProgressCounter progress = new ProgressCounter(foldersToClean.size()); - - Collections.sort(foldersToClean); - - for (File folderToClean : foldersToClean) { - SpecsLogs - .msgInfo("Deleting folder '" + folderToClean.getAbsolutePath() + "'... " + progress.next()); - SpecsIo.deleteFolder(folderToClean); - } - - // Delete webresources - for (String webResource : getWebResources(baseFolder)) { - WebResourceProvider parsedResource = parseWebResource(webResource).orElse(null); - if (parsedResource == null) { - continue; - } - - File webFile = new File(baseFolder, parsedResource.getFilename()); - if (webFile.isFile()) { - SpecsLogs.msgInfo("Deleting web-resource '" + webFile.getAbsolutePath() + "'"); - webFile.delete(); - } - - } - - } - - private static boolean isBuildFolder(File folder) { - String folderName = folder.getName(); - - // This is based on the .gitignore file - - if (folderName.equals("build")) { - return true; - } - - if (folderName.startsWith("build-")) { - return true; - } - - if (folderName.equals("weaved_code")) { - return true; - } - - if (folderName.equals("woven_code")) { - return true; - } - - return false; - } - - private static boolean isDataFolder(File folder) { - String folderName = folder.getName(); - - // This is based on the .gitignore file - - if (folderName.equals("data")) { - return true; - } - - return false; - } - -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterProperties.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterProperties.java deleted file mode 100644 index c27d32f463..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import pt.up.fe.specs.util.providers.StringProvider; - -public enum ClavaTesterProperties implements StringProvider { - - CMAKE_GENERATOR, - CLEAN_BUILD_FOLDER, - MAKE_COMMAND; - - @Override - public String getString() { - return name(); - } -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterWebResource.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterWebResource.java deleted file mode 100644 index f796be3cc5..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/ClavaTesterWebResource.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -import pt.up.fe.specs.util.providers.WebResourceProvider; - -public interface ClavaTesterWebResource { - - static WebResourceProvider create(String resourceUrl, String version) { - return WebResourceProvider.newInstance("http://specs.fe.up.pt/resources/", resourceUrl, version); - } - - WebResourceProvider CLAVA_JAR = create("clava/Clava.jar", "v1.1"); -} diff --git a/ClavaTester/src/pt/up/fe/specs/clava/tester/StageResult.java b/ClavaTester/src/pt/up/fe/specs/clava/tester/StageResult.java deleted file mode 100644 index 2784bf582e..0000000000 --- a/ClavaTester/src/pt/up/fe/specs/clava/tester/StageResult.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.tester; - -public class StageResult { - - private final O data; - private final ClavaTestResult result; - - public StageResult(ClavaTestResult result) { - this(null, result); - } - - public StageResult(O data, ClavaTestResult result) { - this.data = data; - this.result = result; - } - - public O getData() { - return data; - } - - public ClavaTestResult getResult() { - return result; - } -} diff --git a/ClavaViewer/.classpath b/ClavaViewer/.classpath deleted file mode 100644 index 8d81e378c4..0000000000 --- a/ClavaViewer/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/ClavaViewer/.project b/ClavaViewer/.project deleted file mode 100644 index f5795f13bc..0000000000 --- a/ClavaViewer/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - ClavaViewer - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - - - - 1689777598988 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaViewer/ivy.xml b/ClavaViewer/ivy.xml deleted file mode 100644 index 2eee7117d4..0000000000 --- a/ClavaViewer/ivy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - diff --git a/ClavaViewer/resources/code/test.c b/ClavaViewer/resources/code/test.c deleted file mode 100644 index 41eb23eca2..0000000000 --- a/ClavaViewer/resources/code/test.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main() { - - int a; - - a = 2 + 3; - - return a; -} - diff --git a/ClavaViewer/run/ClavaViewer.launch b/ClavaViewer/run/ClavaViewer.launch deleted file mode 100644 index c0230a3841..0000000000 --- a/ClavaViewer/run/ClavaViewer.launch +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerFrame.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerFrame.java deleted file mode 100644 index 0f6167f597..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerFrame.java +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Font; -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.swing.JButton; -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JEditorPane; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextPane; -import javax.swing.text.BadLocationException; -import javax.swing.text.Style; -import javax.swing.text.StyleConstants; -import javax.swing.text.StyledDocument; - -import org.suikasoft.jOptions.Interfaces.DataStore; - -import jsyntaxpane.DefaultSyntaxKit; -import jsyntaxpane.syntaxkits.CppSyntaxKit; -import pt.up.fe.specs.util.SpecsIo; - -public class ClavaViewerFrame extends JFrame { - /** - * - */ - private static final long serialVersionUID = 1L; - - private final DataStore data; - - private final JTabbedPane codeTab; - private final JEditorPane cppCodeView; - private final JScrollPane cppCodeScroll; - private final JEditorPane astView; - private final JScrollPane astScroll; - private final JTextPane diagnosticsView; - private final JScrollPane diagnosticsScroll; - private final JCheckBoxMenuItem useCpp11; - - private final Style commonStyle, errorStyle; - - public ClavaViewerFrame() { - super("Clava AST"); - - data = DataStore.newInstance("ClavaPrinter Data"); - - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - - DefaultSyntaxKit.initKit(); - DefaultSyntaxKit.registerContentType("text/cpp", CppSyntaxKit.class.getName()); - // DefaultSyntaxKit.registerContentType("text/lara", LaraSyntaxKit.class.getName()); - // DefaultSyntaxKit.registerContentType("application/x-matisse-bytecode", BytecodeSyntaxKit.class.getName()); - // DefaultSyntaxKit.registerContentType("application/x-matisse-ast", AstSyntaxKit.class.getName()); - - cppCodeView = new JEditorPane(); - cppCodeScroll = new JScrollPane(cppCodeView); - cppCodeView.setContentType("text/cpp"); - cppCodeView.setText(SpecsIo.getResource(ClavaViewerResource.TEST)); - - codeTab = new JTabbedPane(); - codeTab.addTab("C/C++", cppCodeScroll); - - astView = new JEditorPane(); - astScroll = new JScrollPane(astView); - astView.setContentType("text/cpp"); - - diagnosticsView = new JTextPane(); - diagnosticsScroll = new JScrollPane(diagnosticsView); - - commonStyle = diagnosticsView.addStyle("common", null); - StyleConstants.setForeground(commonStyle, Color.BLACK); - errorStyle = diagnosticsView.addStyle("error", null); - StyleConstants.setForeground(errorStyle, Color.RED); - - diagnosticsView.setEditable(false); - diagnosticsView.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); - - JMenuBar menuBar = new JMenuBar(); - JMenu fileMenu = new JMenu("File"); - JMenuItem newItem = new JMenuItem("New"); - newItem.addActionListener(evt -> { - cppCodeView.setText(""); - astView.setText(""); - }); - fileMenu.add(newItem); - JMenuItem openItem = new JMenuItem("Open File..."); - openItem.addActionListener(evt -> { - JFileChooser chooser = new JFileChooser(); - int returnVal = chooser.showOpenDialog(ClavaViewerFrame.this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - - cppCodeView.setText(SpecsIo.read(chooser.getSelectedFile())); - /* - try { - try (FileReader reader = new FileReader(chooser.getSelectedFile())) { - cppCodeView.setText(readAll(reader)); - } - } catch (IOException e) { - e.printStackTrace(); - } - */ - } - }); - fileMenu.add(openItem); - menuBar.add(fileMenu); - - JMenu parseMenu = new JMenu("Clava"); - - useCpp11 = new JCheckBoxMenuItem("C++11"); - useCpp11.setSelected(true); - useCpp11.addActionListener(evt -> data.set(ClavaViewerKeys.IS_CPP, useCpp11.isSelected())); - parseMenu.add(useCpp11); - - menuBar.add(parseMenu); - - setJMenuBar(menuBar); - - setLayout(new BorderLayout()); - - JPanel toolbar = new JPanel(); - - DemoMode[] values = DemoMode.values(); - for (int i = 0; i < values.length; i++) { - DemoMode mode = values[i]; - JButton button = new JButton(mode.getLabel()); - button.addActionListener(evt -> { - // applyPassesItem.setSelected(mode.getApplyPasses()); - // convertToCssaItem.setSelected(mode.getConvertToCssa()); - - parseCode(mode.getPrinter(), data); - // int menuIndex = Arrays.asList(PrintMode.values()).indexOf(mode.getMode()); - // modeItems.get(menuIndex).doClick(); - }); - toolbar.add(button); - } - - add(toolbar, BorderLayout.NORTH); - JSplitPane horizontalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, codeTab, astScroll); - add(horizontalSplit, BorderLayout.CENTER); - horizontalSplit.setDividerLocation(400); - JSplitPane verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, horizontalSplit, diagnosticsScroll); - verticalSplit.setDividerLocation(500); - add(verticalSplit); - - setSize(1200, 700); - - // modeItems.get(1).doClick(); - } - - private void parseCode(CodeViewer printer, DataStore data) - - { - - try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) { - PrintStream reportStream = new PrintStream(byteStream); - - astView.setContentType(printer.getContentType()); - - diagnosticsView.setText(""); - diagnosticsScroll.updateUI(); - - try { - addDiagnosticsText("Starting...\n", commonStyle); - long start = System.nanoTime(); - - String code = cppCodeView.getText(); - - String result = printer.getCode(code, data); - - long end = System.nanoTime(); - addDiagnosticsText("Finished in " + Math.round((end - start) * 1.0e-9 * 100) / 100.0 + " seconds.\n", - commonStyle); - - astView.setText(result); - astScroll.updateUI(); - - } catch (RuntimeException e) { - e.printStackTrace(reportStream); - } finally { - reportStream.flush(); - String text = byteStream.toString(); - - addDiagnosticsText(text, errorStyle); - } - } catch (Exception e) { - e.printStackTrace(); - - StringWriter writer = new StringWriter(); - e.printStackTrace(new PrintWriter(writer)); - } - - } - - private void addDiagnosticsText(String text, Style style) throws BadLocationException { - StyledDocument document = diagnosticsView.getStyledDocument(); - document.insertString(document.getLength(), text, style); - diagnosticsScroll.updateUI(); - } - -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerKeys.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerKeys.java deleted file mode 100644 index 6e58f001c1..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerKeys.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Datakey.KeyFactory; - -public interface ClavaViewerKeys { - - DataKey IS_CPP = KeyFactory.bool("Is Cpp") - .setDefault(() -> true); -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerResource.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerResource.java deleted file mode 100644 index fd93151ae6..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ClavaViewerResource.java +++ /dev/null @@ -1,20 +0,0 @@ -package pt.up.fe.specs.clava.viewer; - -import pt.up.fe.specs.util.providers.ResourceProvider; - -public enum ClavaViewerResource implements ResourceProvider { - TEST("test.c"); - - private static final String BASEPATH = "code/"; - - private final String resource; - - private ClavaViewerResource(String resource) { - this.resource = ClavaViewerResource.BASEPATH + resource; - } - - @Override - public String getResource() { - return resource; - } -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/CodeViewer.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/CodeViewer.java deleted file mode 100644 index 0071c5116c..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/CodeViewer.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -import org.suikasoft.jOptions.Interfaces.DataStore; - -public interface CodeViewer { - - /** - * Parsers the give code. - * - * @param code - * @param data - * @return - */ - String getCode(String code, DataStore data); - - String getContentType(); -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ContentType.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ContentType.java deleted file mode 100644 index 18bb87f5c9..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/ContentType.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -public enum ContentType { - TEXT_CPP("text/cpp"); - - private String contentType; - - private ContentType(String contentType) { - this.contentType = contentType; - } - - public String getName() { - return contentType; - } -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/DemoMode.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/DemoMode.java deleted file mode 100644 index 04f98e67cd..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/DemoMode.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -import pt.up.fe.specs.clava.viewer.codeprinters.ClavaAstViewer; - -public enum DemoMode { - - CLAVA_AST("Clava AST", new ClavaAstViewer(false)), - CLAVA_CPP("C/C++", new ClavaAstViewer(true)); - - private final String label; - private final CodeViewer printer; - - private DemoMode(String label, CodeViewer printer) { - this.label = label; - this.printer = printer; - } - - public String getLabel() { - return label; - } - - public CodeViewer getPrinter() { - return printer; - } - -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/Launcher.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/Launcher.java deleted file mode 100644 index 4d7b33dae2..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/Launcher.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2014 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer; - -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.properties.SpecsProperty; - -public class Launcher { - public static void main(String[] args) { - SpecsSystem.programStandardInit(); - SpecsProperty.ShowStackTrace.applyProperty("true"); - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - try { - UIManager.setLookAndFeel( - UIManager.getSystemLookAndFeelClassName()); - } catch (Exception e) { - // Don't care. - } - - new ClavaViewerFrame().setVisible(true); - } - }); - } -} diff --git a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/codeprinters/ClavaAstViewer.java b/ClavaViewer/src/pt/up/fe/specs/clava/viewer/codeprinters/ClavaAstViewer.java deleted file mode 100644 index eb195ace5f..0000000000 --- a/ClavaViewer/src/pt/up/fe/specs/clava/viewer/codeprinters/ClavaAstViewer.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright 2015 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.viewer.codeprinters; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import org.suikasoft.jOptions.Interfaces.DataStore; - -import pt.up.fe.specs.clang.codeparser.CodeParser; -import pt.up.fe.specs.clava.ast.extra.App; -import pt.up.fe.specs.clava.viewer.ClavaViewerKeys; -import pt.up.fe.specs.clava.viewer.CodeViewer; -import pt.up.fe.specs.clava.viewer.ContentType; -import pt.up.fe.specs.util.SpecsIo; - -public class ClavaAstViewer implements CodeViewer { - - // private final boolean processTree; - private final boolean printCode; - - public ClavaAstViewer(boolean printCode) { - // this.processTree = processTree; - this.printCode = printCode; - } - - @Override - public String getCode(String code, DataStore data) { - - boolean isCpp = data.get(ClavaViewerKeys.IS_CPP); - String extension = isCpp ? "cpp" : "c"; - // Create file from given code - File cppFile = new File("clava_printer_test." + extension); - - SpecsIo.write(cppFile, code); - - List options = new ArrayList<>(); - if (isCpp) { - options.add("-std=c++11"); - } - - App clavaAst = CodeParser.newInstance().parse(Arrays.asList(cppFile), options); - - // ClangRootNode ast = new ClangAstParser().parse(Arrays.asList(cppFile.getAbsolutePath()), options); - // App clavaAst = new ClavaParser(ast, processTree).parse(); - - SpecsIo.delete(cppFile); - - if (printCode) { - return clavaAst.getTranslationUnits().stream() - .map(tu -> tu.getCode()) - .collect(Collectors.joining("\n\n/*****************/\n\n")); - } - - return clavaAst.toTree(); - } - - @Override - public String getContentType() { - if (printCode) { - return ContentType.TEXT_CPP.getName(); - } - - // TODO: Create syntax for AST - return ContentType.TEXT_CPP.getName(); - } - -} diff --git a/ClavaWeaver/.classpath b/ClavaWeaver/.classpath deleted file mode 100644 index 91efcb4719..0000000000 --- a/ClavaWeaver/.classpath +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/.gitignore b/ClavaWeaver/.gitignore index 4af3abe128..1170455d2e 100644 --- a/ClavaWeaver/.gitignore +++ b/ClavaWeaver/.gitignore @@ -1,2 +1,10 @@ cxx_weaver_output/ AutoParStats-default.json + +src/**/abstracts/ +src/**/exceptions/CxxWeaverException.java +src/**/enums/ +*.dotty +CxxWeaver.json +CxxWeaver.png +CxxWeaver.svg diff --git a/ClavaWeaver/.ignore b/ClavaWeaver/.ignore new file mode 100644 index 0000000000..89cefad6f6 --- /dev/null +++ b/ClavaWeaver/.ignore @@ -0,0 +1,3 @@ +!src/**/abstracts/ +!src/**/exceptions/CxxWeaverException.java +!src/**/enums/ \ No newline at end of file diff --git a/ClavaWeaver/.project b/ClavaWeaver/.project deleted file mode 100644 index 8221969294..0000000000 --- a/ClavaWeaver/.project +++ /dev/null @@ -1,35 +0,0 @@ - - - ClavaWeaver - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.apache.ivyde.eclipse.ivynature - org.eclipse.buildship.core.gradleprojectnature - - - - 1689777598991 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - - diff --git a/ClavaWeaver/.settings/org.eclipse.jdt.core.prefs b/ClavaWeaver/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f6c5ea36f6..0000000000 --- a/ClavaWeaver/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore -org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull -org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning -org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled diff --git a/ClavaWeaver/build.gradle b/ClavaWeaver/build.gradle index 8d117f89ea..687d2b6e97 100644 --- a/ClavaWeaver/build.gradle +++ b/ClavaWeaver/build.gradle @@ -1,71 +1,43 @@ plugins { id 'distribution' + id 'application' + id 'java' } -// Java project -apply plugin: 'java' - -// Executable -apply plugin: 'application' - java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 -} - - -application { - // For most input codes this is not necessary, but for the largest example we have tested (LSU-gcc, ~700.000 LoC) - // it needs a large amount of memory - //applicationDefaultJvmArgs = ["-Xmx6g"] + withSourcesJar() } + // Repositories providers repositories { - // Gearman - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - mavenCentral() } -dependencies { - implementation "junit:junit:4.13.1" - +configurations { + weaverGeneratorRuntime +} - implementation ":CommonsLangPlus" - implementation ":GsonPlus" +dependencies { implementation ":jOptions" - implementation ":JsEngine" implementation ":SpecsUtils" - implementation ":XStreamPlus" - implementation ":tdrcLibrary" implementation ":LanguageSpecification" - implementation ":LaraCommonLanguageApi" - implementation ":LaraDoc" - implementation ":LaraFramework" implementation ":LARAI" - implementation ":LaraLoc" - implementation ":LaraUnit" implementation ":LaraUtils" - implementation ":WeaverGenerator" implementation ":WeaverInterface" implementation ":AntarexClavaApi" implementation ":ClangAstParser" implementation ":ClavaAst" - implementation ":ClavaHls" implementation ":ClavaLaraApi" - implementation ":ClavaWeaverSpecs" - - implementation group: 'com.google.guava', name: 'guava', version: '19.0' - implementation group: 'com.google.code.gson', name: 'gson', version: '2.4' -} + implementation 'com.google.guava:guava:33.4.0-jre' -java { - withSourcesJar() + weaverGeneratorRuntime ":WeaverGenerator" } // Project sources @@ -73,55 +45,25 @@ sourceSets { main { java { srcDir 'src' - srcDir 'test' - } - - resources { - srcDir 'resources' - } - } - - - test { - java { - srcDir 'test' - } - - resources { - srcDir 'resources' } } - -} - -application { - mainClass.set("pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher") -} - -// Clava -task clava(type: JavaExec) { - group = "Execution" - description = "Launches Clava" - classpath = sourceSets.main.runtimeClasspath - mainClass = 'pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher' - args = [] } -// Clava Doc (old version) -task clavadoc(type: JavaExec) { +// Re-run the weaver generator +tasks.register('generateWeaver', JavaExec) { group = "Execution" - description = "Generates Documentation (Legacy)" - classpath = sourceSets.main.runtimeClasspath - mainClass = 'pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher' + description = "Generates the Weaver Abstracts" + classpath = configurations.weaverGeneratorRuntime + mainClass = 'org.lara.interpreter.weaver.generator.commandline.WeaverGenerator' args = [ - '-doc', - '--output', - '"../docs/api"', - '--clean', - '--exclude', - '_', - '--packages', -// '{"Clava API": ["../ClavaLaraApi/src-lara-clava/clava"], "LARA API": ["../LaraApi/src-lara-base","../LaraApi}/src-lara","../LARAI/src-lara","../LaraExtraApi/src-lara","../ClavaLaraApi/src-lara/clava"], "LARA Common Language API": ["../LaraCommonLanguageApi/src-lara"], "ANTAREX API": ["../AntarexClavaApi/src-lara/clava"]}', - '{\'Clava API\': [\'../ClavaLaraApi/src-lara-clava/clava\'], \'LARA API\': [\'../LaraApi/src-lara-base\',\'../LaraApi}/src-lara\',\'../LARAI/src-lara\',\'../LaraExtraApi/src-lara\',\'../ClavaLaraApi/src-lara/clava\'], \'LARA Common Language API\': [\'../LaraCommonLanguageApi/src-lara\'], \'ANTAREX API\': [\'../AntarexClavaApi/src-lara/clava\']}', + "-w", "CxxWeaver", + "-x", "./resources/clava/weaverspecs", + "-o", "./src", + "-p", "pt.up.fe.specs.clava.weaver", + "-n", "pt.up.fe.specs.clava.ClavaNode", + "-e", + "-j" ] -} \ No newline at end of file +} + +compileJava.dependsOn generateWeaver diff --git a/ClavaWeaver/eclipse.build b/ClavaWeaver/eclipse.build deleted file mode 100644 index e0fb56b89e..0000000000 --- a/ClavaWeaver/eclipse.build +++ /dev/null @@ -1,8 +0,0 @@ -https://github.com/specs-feup/lara-framework -https://github.com/specs-feup/specs-java-libs -https://github.com/specs-feup/specs-lara -https://github.com/specs-feup/clava ---build ---project ClavaWeaver ---main pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher ---jar subfolder diff --git a/ClavaWeaver/ivy.xml b/ClavaWeaver/ivy.xml deleted file mode 100644 index ed77c51b1e..0000000000 --- a/ClavaWeaver/ivy.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/ClavaWeaver/resources/clava/clava_icon_300dpi.png b/ClavaWeaver/resources/clava/clava_icon_300dpi.png deleted file mode 100644 index b0ea7e2f20..0000000000 Binary files a/ClavaWeaver/resources/clava/clava_icon_300dpi.png and /dev/null differ diff --git a/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.js b/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.js new file mode 100644 index 0000000000..a2e20ff07a --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.js @@ -0,0 +1,30 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; +import path from "path"; + +const referenceFolder = Clava.getWeavingFolder(); +const clavaFolder = path.dirname(path.dirname(path.dirname(referenceFolder))); +const headerFilePath = path.join( + clavaFolder, + "ClavaWeaver", + "resources", + "clava", + "test", + "api", + "cpp", + "src", + "add_header_file.h" +); + +const headerFile = Io.getPath(headerFilePath); + +if (!Io.isFile(headerFile)) { + throw new Error("Could not find header file " + headerFile); +} + +// Manually add header file +const $file = ClavaJoinPoints.file(headerFile); +Clava.addFile($file); + +console.log($file.code); diff --git a/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.lara b/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.lara deleted file mode 100644 index e362ebb6c4..0000000000 --- a/ClavaWeaver/resources/clava/test/api/AddHeaderFileTest.lara +++ /dev/null @@ -1,18 +0,0 @@ -import clava.Clava; -import clava.ClavaJoinPoints; -import lara.Io; - -aspectdef AddHeaderFileTest - - // Manually add header file - var headerFile = Io.getPath("cxx_weaver_output/add_header_file.h"); - if(!Io.isFile(headerFile)) { - throw "Could not find header file " + headerFile; - } - - var $file = ClavaJoinPoints.file(headerFile); - Clava.addFile($file, "cxx_weaver_output"); - - println($file.code); - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.js b/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.js new file mode 100644 index 0000000000..815fc029d6 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.js @@ -0,0 +1,117 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +/** + * @return static array declarations that have constant size + */ +function getArrayVardecls($jp) { + const $arrayVardecls = []; + + // Search for variable declarations + for (const $vardecl of Query.searchFrom($jp, "vardecl")) { + // Check array types + if (!$vardecl.type.isArray) { + continue; + } + + // Consider only constant array types for now, that have more than two dimensions + if ($vardecl.type.arraySize < 1) { + continue; + } + + if ($vardecl.type.arrayDims.length < 2) { + continue; + } + + $arrayVardecls.push($vardecl); + } + + return $arrayVardecls; +} + +function getVardeclUses($vardecl, $vardeclScope) { + // Get all varrefs in the vardecl scope + if ($vardeclScope === undefined) { + $vardeclScope = $vardecl.getAncestor("scope"); + + // If scope is still undefined, return + if ($vardeclScope === undefined) { + console.log( + "Could not find a local scope for $vardecl at '" + + $vardecl.location + + "', global scope not supported" + ); + return []; + } + } + + const $usedVarrefs = []; + + for (const $varref of Query.searchFrom($vardeclScope, "varref")) { + // Check if the declaration is the same + if ($vardecl.compareNodes($varref.declaration)) { + $usedVarrefs.push($varref); + } + } + + return $usedVarrefs; +} + +function getVardeclInfo($vardecl) { + const vardeclInfo = {}; + + const $function = $vardecl.getAncestor("function"); + + if ($function === undefined) { + console.log( + "Could not find function of $vardecl '" + + $vardecl.location + + "', global variables not supported" + ); + return; + } + + vardeclInfo["functionName"] = $function.name; + vardeclInfo["vardeclName"] = $vardecl.name; + + return vardeclInfo; +} + +function linearizeArray(vardeclInfo) { + // Go to the function where the variable declaration appears + const queryResult = Query.search("function", vardeclInfo["functionName"]) + .search("vardecl", vardeclInfo["vardeclName"]) + .chain(); + + // Check number of results + if (queryResult.length > 1) { + console.log( + "Found more than one candidate for the function/vardecl pair '" + + vardeclInfo["functionName"] + + "'/'" + + vardeclInfo["vardeclName"] + + "'" + ); + return; + } + + const $vardecl = queryResult[0]["vardecl"]; + + console.log("DECL: " + $vardecl.location); +} + +// Get candidate vardecls +const $arrayVardecls = getArrayVardecls( + Query.search("function", "main").getFirst() +); + +// Check vardecl use +// (not currently being done) +const vardeclsInfo = []; +for (const $arrayVardecl of $arrayVardecls) { + vardeclsInfo.push(getVardeclInfo($arrayVardecl)); +} + +// Transform each vardecl +for (const vardeclInfo of vardeclsInfo) { + linearizeArray(vardeclInfo); +} diff --git a/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.lara b/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.lara deleted file mode 100644 index 40547cf769..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ArrayLinearizerTest.lara +++ /dev/null @@ -1,149 +0,0 @@ -import weaver.Query; - -aspectdef ArrayLinearizerTest - - // Get candidate vardecls - var $arrayVardecls = getArrayVardecls(Query.search('function', 'main').getFirst()); - - - - // Check vardecl use - // (not currently being done) - var vardeclsInfo = []; - for(var $arrayVardecl of $arrayVardecls) { - /* - println("VARDECL: " + $arrayVardecl.code + " (at " + $arrayVardecl.location + ")"); - //println("TYPE: " + $arrayVardecl.type.joinPointType); - //println("Array size: " + $arrayVardecl.type.arraySize); - - var $varrefs = getVardeclUses($arrayVardecl); - - for(var $varref of $varrefs) { - println("Use: " + $varref.location); - } - */ - - vardeclsInfo.push(getVardeclInfo($arrayVardecl)); - } - - - - // Transform each vardecl - for(var vardeclInfo of vardeclsInfo) { - linearizeArray(vardeclInfo); - } - -/* - select param end - apply - -// if(!$param.type.instanceOf('arrayType')) { -// continue; -// } - - println("Param Type: " + $param.name + " is a " + $param.type.joinPointType + " -> " + $param.type.code); - println("Desugared param Type: " + $param.name + " is a " + $param.type.desugarAll.joinPointType + " -> " + $param.type.desugarAll.code); - end -*/ - -/* - select vardecl end - apply - if(!$vardecl.type.desugarAll.instanceOf('arrayType')) { - continue; - } - - println("Array Type: " + $vardecl.name + " -> " + $vardecl.type.code); - end - println("Hello"); -*/ -end - -/** - * @return static array declarations that have constant size - */ -function getArrayVardecls($jp) { - - var $arrayVardecls = []; - - // Search for variable declarations - for(var $vardecl of Query.searchFrom($jp, 'vardecl')) { - - // Check array types - if(!$vardecl.type.isArray) { - continue; - } - - // Consider only constant array types for now, that have more than two dimensions - if($vardecl.type.arraySize < 1) { - continue; - } - - if($vardecl.type.arrayDims.length < 2) { - continue; - } - - $arrayVardecls.push($vardecl); - } - - return $arrayVardecls; -} - -function getVardeclUses($vardecl, $vardeclScope) { - // Get all varrefs in the vardecl scope - if($vardeclScope === undefined) { - $vardeclScope = $vardecl.getAncestor('scope'); - - // If scope is still undefined, return - if($vardeclScope === undefined) { - println("Could not find a local scope for $vardecl at '"+$vardecl.location+"', global scope not supported"); - return []; - } - } - - - var $usedVarrefs = []; - - for(var $varref of Query.searchFrom($vardeclScope, 'varref')) { - // Check if the declaration is the same - if($vardecl.compareNodes($varref.declaration)) { - $usedVarrefs.push($varref); - } - } - - return $usedVarrefs; -} - -function getVardeclInfo($vardecl) { - var vardeclInfo = {}; - - var $function = $vardecl.getAncestor('function'); - - if($function === undefined) { - println("Could not find function of $vardecl '"+$vardecl.location+"', global variables not supported"); - return; - } - - vardeclInfo['functionName'] = $function.name; - vardeclInfo['vardeclName'] = $vardecl.name; - - return vardeclInfo; -} - -function linearizeArray(vardeclInfo) { - // Go to the function where the variable declaration appears - var queryResult = Query.search('function', vardeclInfo['functionName']).search('vardecl', vardeclInfo['vardeclName']).chain(); - - // Check number of results - if(queryResult.length > 1) { - println("Found more than one candidate for the function/vardecl pair '"+vardeclInfo['functionName']+"'/'"+vardeclInfo['vardeclName']+"'"); - return; - } - - var $function = queryResult[0]['function']; - var $vardecl = queryResult[0]['vardecl']; - - - println("DECL: " + $vardecl.location); - -} diff --git a/ClavaWeaver/resources/clava/test/api/AutoParInlineTest.lara b/ClavaWeaver/resources/clava/test/api/AutoParInlineTest.lara deleted file mode 100644 index c2e07b0f34..0000000000 --- a/ClavaWeaver/resources/clava/test/api/AutoParInlineTest.lara +++ /dev/null @@ -1,41 +0,0 @@ -import clava.autopar.RunInlineFunctionCalls; -import weaver.Query; -import clava.Clava; - -aspectdef AutoParInlineTest - - var $call = Query.search('call', {name: 'bar'}).first(); - if($call === undefined) { - throw "Could not find call to 'bar'"; - } - - var exprStmt = $call.getAstAncestor('ExprStmt'); - - - var o = undefined; - call o : inlinePreparation("bar", $call, exprStmt); - - - if(o.$newStmts.length > 0) - { - var replacedCallStr = '// ClavaInlineFunction : ' + exprStmt.code + ' countCallInlinedFunction : ' + countCallInlinedFunction; - //println("REPLACED CALL STR:\n" + replacedCallStr); - exprStmt.insert before replacedCallStr; - - //var insertedCode = ""; - for(var $newStmt of o.$newStmts) - { - //insertedCode += $newStmt.code + "\n"; - exprStmt.insertBefore($newStmt); - } - //println("INSERTED CODE:\n" + insertedCode); - - exprStmt.detach(); - - } - - println("Code:\n" + Clava.getProgram().code); - - Clava.rebuild(); - -end diff --git a/ClavaWeaver/resources/clava/test/api/AutoParTest.lara b/ClavaWeaver/resources/clava/test/api/AutoParTest.lara deleted file mode 100644 index 28f04b6965..0000000000 --- a/ClavaWeaver/resources/clava/test/api/AutoParTest.lara +++ /dev/null @@ -1,11 +0,0 @@ -import clava.autopar.Parallelize; -import clava.Clava; - -aspectdef AutoParTest - Parallelize.forLoops(); - - select omp end - apply - println("Inserted OpenMP pragma: " + $omp.code); - end -end diff --git a/ClavaWeaver/resources/clava/test/api/CMakerTest.js b/ClavaWeaver/resources/clava/test/api/CMakerTest.js index d2b024c09b..180b9e5fb8 100644 --- a/ClavaWeaver/resources/clava/test/api/CMakerTest.js +++ b/ClavaWeaver/resources/clava/test/api/CMakerTest.js @@ -1,7 +1,6 @@ -laraImport("lara.Io"); -laraImport("lara.Platforms"); -laraImport("clava.cmake.CMaker"); -laraImport("clava.Clava"); +import Io from "@specs-feup/lara/api/lara/Io.js"; +import Platforms from "@specs-feup/lara/api/lara/Platforms.js"; +import CMaker from "@specs-feup/clava/api/clava/cmake/CMaker.js"; const cmaker = new CMaker("testapp") .setMinimumVersion("3.0.2") @@ -17,7 +16,7 @@ if (Platforms.isWindows()) { const executable = cmaker.build(); if (executable !== undefined) { - println("Created executable: " + Io.removeExtension(executable.getName())); + console.log("Created executable: " + Io.removeExtension(executable.getName())); } else { - println("Could not create executable"); + console.log("Could not create executable"); } diff --git a/ClavaWeaver/resources/clava/test/api/CfgApi.js b/ClavaWeaver/resources/clava/test/api/CfgApi.js index 8e41c13c0a..5f56bc132b 100644 --- a/ClavaWeaver/resources/clava/test/api/CfgApi.js +++ b/ClavaWeaver/resources/clava/test/api/CfgApi.js @@ -1,8 +1,6 @@ -laraImport("clava.graphs.ControlFlowGraph"); -laraImport("clava.graphs.cfg.CfgUtils"); -laraImport("clava.graphs.cfg.CfgEdgeType"); -laraImport("weaver.Query"); -laraImport("lara.graphs.Graphs"); +import ControlFlowGraph from "@specs-feup/clava/api/clava/graphs/ControlFlowGraph.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; const $functions = Query.search("function"); for (const $function of $functions) { @@ -18,25 +16,25 @@ buildAndVerifyCfg($gotoLabelFunction, cfgOptions); // Stress test for(const $stmt of Query.search("function", "foo").search("statement")) { -// println("CFG for stmt:\n" + $stmt.code) +// console.log("CFG for stmt:\n" + $stmt.code) // const smallCfg = ControlFlowGraph.build($stmt, true); -// println(Graphs.toDot(smallCfg.graph)); +// console.log(Graphs.toDot(smallCfg.graph)); } function buildAndVerifyCfg($function, options) { const cfg = ControlFlowGraph.build($function, true, options); if (options !== undefined) { - println(`Options used and Graph for ${$function.name}:`) - println(`${JSON.stringify(options, null, 2)}`); + console.log(`Options used and Graph for ${$function.name}:`) + console.log(`${JSON.stringify(options, null, 2)}`); } else - println(`Graph for ${$function.name}:`) + console.log(`Graph for ${$function.name}:`) - println(Graphs.toDot(cfg.graph)); + console.log(Graphs.toDot(cfg.graph)); verifyGraph(cfg) - println(`Verification completed for ${$function.name}\n`) + console.log(`Verification completed for ${$function.name}\n`) } function verifyGraph(cfg) { @@ -46,12 +44,12 @@ function verifyGraph(cfg) { for(const stmt of node.data().stmts) { const graphNode= cfg.getNode(stmt); if(graphNode === undefined) { - println("Stmt "+stmt.astId+" " + stmt.joinPointType + "@" + stmt.location + " does not have a graph node"); + console.log("Stmt "+stmt.astId+" " + stmt.joinPointType + "@" + stmt.location + " does not have a graph node"); continue; } if(!node.equals(graphNode)) { - println("Stmt " + stmt.joinPointType + "@" + stmt.location + " has a graph node but is not the same"); + console.log("Stmt " + stmt.joinPointType + "@" + stmt.location + " has a graph node but is not the same"); continue; } } diff --git a/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.js b/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.js new file mode 100644 index 0000000000..324a997460 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.js @@ -0,0 +1,12 @@ +import ClavaCode from "@specs-feup/clava/api/clava/ClavaCode.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $pragma of Query.search("pragma", { name: "foo_loop_once" })) { + console.log("Executes once: " + ClavaCode.isExecutedOnce($pragma.target)); +} + +for (const $pragma of Query.search("pragma", { name: "foo_loop_not_once" })) { + console.log( + "Cannot prove one exec: " + ClavaCode.isExecutedOnce($pragma.target) + ); +} diff --git a/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.lara b/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.lara deleted file mode 100644 index eb6f65a8d1..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ClavaCodeTest.lara +++ /dev/null @@ -1,16 +0,0 @@ -import clava.ClavaCode; - -aspectdef ClavaCodeTest - - select pragma{"foo_loop_once"} end - apply - println("Executes once: " + ClavaCode.isExecutedOnce($pragma.target)); - end - - select pragma{"foo_loop_not_once"} end - apply - println("Cannot prove one exec: " + ClavaCode.isExecutedOnce($pragma.target)); - end - -end - diff --git a/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.js b/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.js new file mode 100644 index 0000000000..0a26264568 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.js @@ -0,0 +1,17 @@ +import ClavaDataStore from "@specs-feup/clava/api/clava/util/ClavaDataStore.js"; +import WeaverOptions from "@specs-feup/lara/api/weaver/WeaverOptions.js"; + +const dataStore = new ClavaDataStore(WeaverOptions.getData()); +console.log("GET:" + dataStore.get("Disable Remote Dependencies")); +console.log("TYPE:" + dataStore.getType("Disable Remote Dependencies")); +dataStore.put("Disable Remote Dependencies", true); +console.log("GET AFTER PUT:" + dataStore.get("Disable Remote Dependencies")); +dataStore.put("Disable Remote Dependencies", false); +console.log("Disable info:" + dataStore.get("disable_info")); +console.log("System includes:" + dataStore.getSystemIncludes()); +dataStore.setSystemIncludes("extra_system_include"); +console.log("System includes after:" + dataStore.getSystemIncludes()); +console.log("Flags:" + dataStore.getFlags()); +const flags = dataStore.getFlags() + " -O3"; +dataStore.setFlags(flags); +console.log("Flags after:" + dataStore.getFlags()); diff --git a/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.lara b/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.lara deleted file mode 100644 index 7e8b8d3c45..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ClavaDataStoreTest.lara +++ /dev/null @@ -1,23 +0,0 @@ -import lara.util.DataStore; -import clava.util.ClavaDataStore; -import weaver.WeaverOptions; - -aspectdef DataStoreTest - - - var dataStore = new ClavaDataStore(WeaverOptions.getData()); - println("GET:" + dataStore.get("javascript")); - println("TYPE:" + dataStore.getType("javascript")); - dataStore.put("javascript", false); - println("GET AFTER PUT:" + dataStore.get("javascript")); - dataStore.put("javascript", true); - //println("Keys:" + dataStore.getKeys()); - println("Disable info:" + dataStore.get("disable_info")); - println("System includes:" + dataStore.getSystemIncludes()); - dataStore.setSystemIncludes("extra_system_include"); - println("System includes after:" + dataStore.getSystemIncludes()); - println("Flags:" + dataStore.getFlags()); - var flags = dataStore.getFlags() + " -O3"; - dataStore.setFlags(flags); - println("Flags after:" + dataStore.getFlags()); -end diff --git a/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.js b/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.js new file mode 100644 index 0000000000..2c8765ebc5 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.js @@ -0,0 +1,72 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + + +function test() { + let $aLoop; + + // Get a join point + for (const $loop of Query.search("loop")) { + $aLoop = $loop; + } + + let $aScope; + for (const $scope of Query.search("scope")) { + $aScope = $scope; + } + + // Push AST + Clava.pushAst(); + + // Find equivalent join point + const $eqLoop = Clava.findJp($aLoop); + if ($eqLoop === undefined) { + console.log("Could not find loop"); + return; + } + + // Find equivalent join point scope + const $eqScope = Clava.findJp($aScope); + if ($eqScope === undefined) { + console.log("Could not find scope"); + return; + } + + $eqLoop.insertBefore("// Pushed AST"); + + console.log("Pushed AST:\n" + Query.root().code); + + Clava.popAst(); + + console.log("Original AST:\n" + Query.root().code); + + ////// + + JpCreateTest(); +} + + +function JpCreateTest() { + // New line + console.log("JpCreateTest"); + + // Create join point + let astNode; + let $loopJp; + for (const $loop of Query.search("loop")) { + $loopJp = $loop; + astNode = $loop.node; + // Finish after first loop + } + + // Check if loop has node + console.log("Has node? " + $loopJp.hasNode(astNode)); + + // Create join point + const $newLoopJp = ClavaJoinPoints.toJoinPoint(astNode); + + console.log("Are JPs equal? " + $newLoopJp.equals($loopJp)); +} + +test(); diff --git a/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.lara b/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.lara deleted file mode 100644 index a56e9180a3..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ClavaFindJpTest.lara +++ /dev/null @@ -1,83 +0,0 @@ -import clava.Clava; -import lara.Io; -import clava.ClavaJoinPoints; -import weaver.JoinPoints; - -aspectdef ClavaTest - - var $aLoop = undefined; - - // Get a join point - select loop end - apply - $aLoop = $loop; - end - - var $aScope = undefined; - select scope end - apply - $aScope = $scope; - end - - // Push AST - Clava.pushAst(); - - // Find equivalent join point - var $eqLoop = Clava.findJp($aLoop); - if($eqLoop === undefined) { - println("Could not find loop"); - return; - } - - // Find equivalent join point scope - var $eqScope = Clava.findJp($aScope); - if($eqScope === undefined) { - println("Could not find scope"); - return; - } - - $eqLoop.insertBefore("// Pushed AST"); - - select program end - apply - println("Pushed AST:\n" + $program.code); - end - - Clava.popAst(); - - select program end - apply - println("Original AST:\n" + $program.code); - end - - - ////// - - call JpCreateTest(); - -end - -aspectdef JpCreateTest - - // New line - println("JpCreateTest"); - - // Create join point - var astNode = undefined; - var $loopJp = undefined; - select loop end - apply - $loopJp = $loop; - astNode = $loop.node; - // Finish after first loop - end - - // Check if loop has node - println("Has node? " + $loopJp.hasNode(astNode)); - - // Create join point - //var $newLoopJp = ClavaJoinPoints.create(astNode); - var $newLoopJp = ClavaJoinPoints.toJoinPoint(astNode); - - println("Are JPs equal? " + $newLoopJp.equals($loopJp)); -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/ClavaJoinPointsTest.js b/ClavaWeaver/resources/clava/test/api/ClavaJoinPointsTest.js index bccaacd6c0..da155f4895 100644 --- a/ClavaWeaver/resources/clava/test/api/ClavaJoinPointsTest.js +++ b/ClavaWeaver/resources/clava/test/api/ClavaJoinPointsTest.js @@ -1,5 +1,5 @@ -laraImport("clava.ClavaJoinPoints"); -laraImport("weaver.Query"); +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; var intType = ClavaJoinPoints.builtinType("int"); var doubleType = ClavaJoinPoints.builtinType("double"); @@ -8,34 +8,34 @@ var intPointerType = ClavaJoinPoints.pointer(intType); var intPointerExpr = ClavaJoinPoints.exprLiteral("aPointer", intPointerType); // Type Literal of user defined type -println("User literal type: " + ClavaJoinPoints.typeLiteral("xpto").code); +console.log("User literal type: " + ClavaJoinPoints.typeLiteral("xpto").code); // Stmt Literal -println("Literal statement: " + ClavaJoinPoints.stmtLiteral("int a = 0;").code); +console.log("Literal statement: " + ClavaJoinPoints.stmtLiteral("int a = 0;").code); // TypedefDecl var typedefDecl = ClavaJoinPoints.typedefDecl( ClavaJoinPoints.builtinType("int"), "custom_int" ); -println("Typedef decl: " + typedefDecl.code); +console.log("Typedef decl: " + typedefDecl.code); // TypedefType -println("Typedef type: " + ClavaJoinPoints.typedefType(typedefDecl).code); +console.log("Typedef type: " + ClavaJoinPoints.typedefType(typedefDecl).code); // Cast -println( - "C-Style cast: " + ClavaJoinPoints.cStyleCast(doubleType, intExpr).code +console.log( + "C-Style cast: " + ClavaJoinPoints.cStyleCast(doubleType, intExpr).code ); // If Stmt -println("Empty if:\n" + ClavaJoinPoints.ifStmt("a == 0").code); -println( - "If with then:\n" + +console.log("Empty if:\n" + ClavaJoinPoints.ifStmt("a == 0").code); +console.log( + "If with then:\n" + ClavaJoinPoints.ifStmt("a == 0", ClavaJoinPoints.stmtLiteral("a = 1;")).code ); -println( - "If with else:\n" + +console.log( + "If with else:\n" + ClavaJoinPoints.ifStmt( "a == 0", undefined, @@ -44,21 +44,21 @@ println( ); // For Stmt -println("Empty for:\n" + ClavaJoinPoints.forStmt().code); -println( - "Complete for:\n" + +console.log("Empty for:\n" + ClavaJoinPoints.forStmt().code); +console.log( + "Complete for:\n" + ClavaJoinPoints.forStmt("int i=0;", "i<10;", "i++;", "i = i+1;\ni = i - 1;") .code ); // Unary Operator var addressOfOp = ClavaJoinPoints.unaryOp("&", intExpr); -println("AddressOf code: " + addressOfOp.code); -println("AddressOf code type: " + addressOfOp.type.code); +console.log("AddressOf code: " + addressOfOp.code); +console.log("AddressOf code type: " + addressOfOp.type.code); var derefOp = ClavaJoinPoints.unaryOp("*", intPointerExpr); -println("Deref code: " + derefOp.code); -println("Deref code type: " + derefOp.type.code); +console.log("Deref code: " + derefOp.code); +console.log("Deref code type: " + derefOp.type.code); const xConstPointerDecl = Query.search("function", "constPointer") .search("vardecl", "x") @@ -67,42 +67,42 @@ const xConstPointerRef = ClavaJoinPoints.varRef(xConstPointerDecl); // Deref of qualified pointer const derefQualified = ClavaJoinPoints.unaryOp("*", xConstPointerRef); -println("Deref code: " + derefQualified.code); -println("Deref code type: " + derefQualified.type.code); +console.log("Deref code: " + derefQualified.code); +console.log("Deref code type: " + derefQualified.type.code); var type; type = ClavaJoinPoints.type("int"); -println("Builtin type: " + type.joinPointType); +console.log("Builtin type: " + type.joinPointType); type = ClavaJoinPoints.type("uint64_t"); -println("Literal type: " + type.node.getClass()); +console.log("Literal type: " + type.node.getClass()); var type2 = ClavaJoinPoints.type(type); -println("Same type: " + (type === type2)); // They should be the same join point +console.log("Same type: " + (type === type2)); // They should be the same join point type2 = ClavaJoinPoints.type(ClavaJoinPoints.varDeclNoInit("dummyVar", type)); -println("Same type again: " + (type.code === type2.code)); // No longer the same join point, but the same node +console.log("Same type again: " + (type.code === type2.code)); // No longer the same join point, but the same node // Invalid input, only strings or jps try { - ClavaJoinPoints.type([0, 1]); - println("fail 1"); + ClavaJoinPoints.type([0, 1]); + console.log("fail 1"); } catch (e) { - println("Rejected invalid input type"); + console.log("Rejected invalid input type"); } // Invalid input, jp must have type try { - ClavaJoinPoints.type(ClavaJoinPoints.file("dummyFile")); - println("fail 2"); + ClavaJoinPoints.type(ClavaJoinPoints.file("dummyFile")); + console.log("fail 2"); } catch (e) { - println("Rejected jp without type"); + console.log("Rejected jp without type"); } // Varref var $varref = ClavaJoinPoints.varRef("varref_test", type); -println("Varref code: " + $varref.code); -println("Varref type: " + $varref.type.code); +console.log("Varref code: " + $varref.code); +console.log("Varref type: " + $varref.type.code); var $varref2 = ClavaJoinPoints.varRef( ClavaJoinPoints.varDeclNoInit("varref_test_2", type) ); -println("Varref2 code: " + $varref2.code); -println("Varref2 type: " + $varref2.type.code); +console.log("Varref2 code: " + $varref2.code); +console.log("Varref2 type: " + $varref2.type.code); // ArrayAccess var $constArrayType = ClavaJoinPoints.constArrayType(intType, 10, 10, 10); @@ -110,19 +110,19 @@ var $arrayVarRef = ClavaJoinPoints.varRef("a", $constArrayType); var $arrayAccess1 = ClavaJoinPoints.arrayAccess($arrayVarRef, ClavaJoinPoints.integerLiteral(0), ClavaJoinPoints.integerLiteral(1), ClavaJoinPoints.integerLiteral(2)); var $arrayAccess2 = ClavaJoinPoints.arrayAccess($arrayVarRef, [ClavaJoinPoints.integerLiteral(3), ClavaJoinPoints.integerLiteral(4)]); var $arrayAccess3 = ClavaJoinPoints.arrayAccess($arrayVarRef, ClavaJoinPoints.integerLiteral(5)); -println("ArrayAccess1 code: " + $arrayAccess1.code); -println("ArrayAccess1 type: " + $arrayAccess1.type.code); -println("ArrayAccess2 code: " + $arrayAccess2.code); -println("ArrayAccess2 type: " + $arrayAccess2.type.code); -println("ArrayAccess3 code: " + $arrayAccess3.code); -println("ArrayAccess3 type: " + $arrayAccess3.type.code); +console.log("ArrayAccess1 code: " + $arrayAccess1.code); +console.log("ArrayAccess1 type: " + $arrayAccess1.type.code); +console.log("ArrayAccess2 code: " + $arrayAccess2.code); +console.log("ArrayAccess2 type: " + $arrayAccess2.type.code); +console.log("ArrayAccess3 code: " + $arrayAccess3.code); +console.log("ArrayAccess3 type: " + $arrayAccess3.type.code); // IncompleteArrayType -var $incompleteArrayType = ClavaJoinPoints.incompleteArrayType(intType); -println("IncompleteArrayType code: " + $incompleteArrayType.code); +const $incompleteArrayType = ClavaJoinPoints.incompleteArrayType(intType); +console.log("IncompleteArrayType code: " + $incompleteArrayType.code); // InitList const $literalTwo = ClavaJoinPoints.integerLiteral(2) const $initList = ClavaJoinPoints.initList($literalTwo, $literalTwo, $literalTwo, $literalTwo, $literalTwo); -println("InitList code: " + $initList.code); -println("InitList type: " + $initList.type.code); +console.log("InitList code: " + $initList.code); +console.log("InitList type: " + $initList.type.code); diff --git a/ClavaWeaver/resources/clava/test/api/ClavaTest.js b/ClavaWeaver/resources/clava/test/api/ClavaTest.js new file mode 100644 index 0000000000..395f4880fa --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ClavaTest.js @@ -0,0 +1,11 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +// Add file +const $newFile = ClavaJoinPoints.fileWithSource( + "addedFile.cpp", + "int foo() {return 0;}" +).rebuild(); +Clava.addFile($newFile); +console.log("Add file:\n" + Query.search("file", "addedFile.cpp").first().code); diff --git a/ClavaWeaver/resources/clava/test/api/ClavaTest.lara b/ClavaWeaver/resources/clava/test/api/ClavaTest.lara deleted file mode 100644 index fa4f2604d0..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ClavaTest.lara +++ /dev/null @@ -1,12 +0,0 @@ -import clava.Clava; -import weaver.Query; -import clava.ClavaJoinPoints; - -aspectdef ClavaTest - - // Add file - var $newFile = ClavaJoinPoints.fileWithSource("addedFile.cpp", "int foo() {return 0;}").rebuild(); - Clava.addFile($newFile); - println("Add file:\n" + Query.search('file', 'addedFile.cpp').first().code); - -end diff --git a/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.js b/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.js new file mode 100644 index 0000000000..847cab7b60 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.js @@ -0,0 +1,13 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import ClavaType from "@specs-feup/clava/api/clava/ClavaType.js"; + +const intType = ClavaJoinPoints.builtinType("int"); +const intExpr = ClavaJoinPoints.exprLiteral("2 + 3", intType); + +// Transform the expression into a statement +console.log( + "Expr to Stmt type: " + ClavaType.asStatement(intExpr).joinPointType +); + +// Transform the expression into a scope +console.log("Expr to Scope type: " + ClavaType.asScope(intExpr).joinPointType); diff --git a/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.lara b/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.lara deleted file mode 100644 index 0280d22167..0000000000 --- a/ClavaWeaver/resources/clava/test/api/ClavaTypeTest.lara +++ /dev/null @@ -1,14 +0,0 @@ -import clava.ClavaJoinPoints; -import clava.ClavaType; - -aspectdef ClavaTypeTest - - var intType = ClavaJoinPoints.builtinType("int"); - var intExpr = ClavaJoinPoints.exprLiteral("2 + 3", intType); - - // Transform the expression into a statement - println("Expr to Stmt type: " + ClavaType.asStatement(intExpr).joinPointType); - - // Transform the expression into a scope - println("Expr to Scope type: " + ClavaType.asScope(intExpr).joinPointType); -end diff --git a/ClavaWeaver/resources/clava/test/api/Code2VecTest.js b/ClavaWeaver/resources/clava/test/api/Code2VecTest.js deleted file mode 100644 index 1ee5daef32..0000000000 --- a/ClavaWeaver/resources/clava/test/api/Code2VecTest.js +++ /dev/null @@ -1,3 +0,0 @@ -laraImport("lcl.ml.Code2Vec"); - -new Code2Vec().printPaths(); \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/CodeInserterTest.js b/ClavaWeaver/resources/clava/test/api/CodeInserterTest.js index 8ce9231783..cafe3383d3 100644 --- a/ClavaWeaver/resources/clava/test/api/CodeInserterTest.js +++ b/ClavaWeaver/resources/clava/test/api/CodeInserterTest.js @@ -1,15 +1,13 @@ -laraImport("clava.util.CodeInserter"); -laraImport("clava.Clava"); -laraImport("weaver.Query"); -laraImport("lara.Io"); +import CodeInserter from "@specs-feup/clava/api/clava/util/CodeInserter.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; -var codeInserter = new CodeInserter(); +const codeInserter = new CodeInserter(); -var outputFolder = Clava.getWeavingFolder(); -//var outputFolder = Io.getAbsolutePath(Io.mkdir("./codeInserter")); +const outputFolder = Clava.getWeavingFolder(); // Select the only file of the test -var $file = Clava.getProgram().getDescendants("file")[0]; +const $file = Clava.getProgram().getDescendants("file")[0]; codeInserter.add( $file, @@ -29,17 +27,15 @@ codeInserter.add($file, 1, "#include "); // Write codeInserter.write(outputFolder); -// Check file (first element is the folder) -//println("PATHS:"); -//printObject(Io.getFilesRecursive(outputFolder)); -//println("PATHS *.c:"); -//printObject(Io.getFilesRecursive(outputFolder, "*.c")); +const outputFiles = Io.getFiles(outputFolder, undefined, true); +const outputFile = outputFiles.map((file) => file.getPath()).find((file) => file.endsWith("code_inserter.c")); -//var outputFile = Io.getFilesRecursive(outputFolder)[0]; -var outputFile = Io.getFiles(outputFolder, undefined, true)[0]; +if (!outputFile) { + throw new Error("Output file not found"); +} // Print file -println(Io.readFile(outputFile)); +console.log(Io.readFile(outputFile)); // Clean //Io.deleteFolder(outputFolder); diff --git a/ClavaWeaver/resources/clava/test/api/CodeSimplifyAssignmentTest.js b/ClavaWeaver/resources/clava/test/api/CodeSimplifyAssignmentTest.js index 62cbc45b00..3fe6a5ba3f 100644 --- a/ClavaWeaver/resources/clava/test/api/CodeSimplifyAssignmentTest.js +++ b/ClavaWeaver/resources/clava/test/api/CodeSimplifyAssignmentTest.js @@ -1,10 +1,10 @@ -laraImport("clava.Clava"); -laraImport("clava.code.SimplifyAssignment"); -laraImport("weaver.Query"); +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import SimplifyAssignment from "@specs-feup/clava/api/clava/code/SimplifyAssignment.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; for (const $op of Query.search("binaryOp")) { SimplifyAssignment($op); } Clava.rebuild(); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/CodeSimplifyTernaryOpTest.js b/ClavaWeaver/resources/clava/test/api/CodeSimplifyTernaryOpTest.js index 10a2f7e55b..e943365713 100644 --- a/ClavaWeaver/resources/clava/test/api/CodeSimplifyTernaryOpTest.js +++ b/ClavaWeaver/resources/clava/test/api/CodeSimplifyTernaryOpTest.js @@ -1,10 +1,10 @@ -laraImport("clava.Clava"); -laraImport("clava.code.SimplifyTernaryOp"); -laraImport("weaver.Query"); +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import SimplifyTernaryOp from "@specs-feup/clava/api/clava/code/SimplifyTernaryOp.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; -for ($stmt of Query.search("exprStmt")) { +for (const $stmt of Query.search("exprStmt")) { SimplifyTernaryOp($stmt); } Clava.rebuild(); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/EnergyTest.js b/ClavaWeaver/resources/clava/test/api/EnergyTest.js new file mode 100644 index 0000000000..913106bf45 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/EnergyTest.js @@ -0,0 +1,13 @@ +import Energy from "@specs-feup/clava/api/lara/code/Energy.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Instrument call +const energy = new Energy(); + +for (const $call of Query.search("call")) { + energy.measure($call, "Energy:"); +} + +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/api/EnergyTest.lara b/ClavaWeaver/resources/clava/test/api/EnergyTest.lara deleted file mode 100644 index bfe25816f3..0000000000 --- a/ClavaWeaver/resources/clava/test/api/EnergyTest.lara +++ /dev/null @@ -1,18 +0,0 @@ -import lara.code.Energy; - -aspectdef InstrumentCode - - // Instrument call - var energy = new Energy(); - - select call end - apply - energy.measure($call, "Energy:"); - end - - select file end - apply - println($file.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/api/FileIteratorTest.js b/ClavaWeaver/resources/clava/test/api/FileIteratorTest.js new file mode 100644 index 0000000000..4622474684 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/FileIteratorTest.js @@ -0,0 +1,34 @@ +import FileIterator from "@specs-feup/clava/api/clava/util/FileIterator.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Write source files to a temporary folder +const tempFolder = Io.getTempFolder("ClavaFileIteratorTest"); +Clava.writeCode(tempFolder); + +// Iterate method 1 +const fileIterator = new FileIterator(tempFolder); + +let $file = fileIterator.next(); +while ($file !== undefined) { + console.log("Iterator 1"); + $file = fileIterator.next(); +} + +// Iterate method 2 +const fileIterator2 = new FileIterator(tempFolder); + +while (fileIterator2.hasNext()) { + $file = fileIterator2.next(); + console.log("Iterator 2"); +} + +// Generic select after iterator +const fileIterator3 = new FileIterator(tempFolder); +fileIterator3.next(); + +for (const _ of Query.search("file")) { + console.log("Single file"); +} +Io.deleteFolder(tempFolder); diff --git a/ClavaWeaver/resources/clava/test/api/FileIteratorTest.lara b/ClavaWeaver/resources/clava/test/api/FileIteratorTest.lara deleted file mode 100644 index 28ec35e939..0000000000 --- a/ClavaWeaver/resources/clava/test/api/FileIteratorTest.lara +++ /dev/null @@ -1,39 +0,0 @@ -import clava.util.FileIterator; -import lara.Io; -import clava.Clava; - -aspectdef FileIteratorTest - - // Write source files to a temporary folder - var tempFolder = Io.getTempFolder("ClavaFileIteratorTest"); - Clava.writeCode(tempFolder); - - // Iterate method 1 - var fileIterator = new FileIterator(tempFolder); - - var $file = fileIterator.next(); - while ($file !== undefined) { - println("Iterator 1"); - $file = fileIterator.next(); - } - - // Iterate method 2 - var fileIterator2 = new FileIterator(tempFolder); - - while (fileIterator2.hasNext()) { - var $file = fileIterator2.next(); - println("Iterator 2"); - } - - // Generic select after iterator - var fileIterator3 = new FileIterator(tempFolder); - fileIterator3.next(); - - select file end - apply - println("Single file"); - end - - Io.deleteFolder(tempFolder); - -end diff --git a/ClavaWeaver/resources/clava/test/api/HlsTest.lara b/ClavaWeaver/resources/clava/test/api/HlsTest.lara deleted file mode 100644 index d6aa0c588b..0000000000 --- a/ClavaWeaver/resources/clava/test/api/HlsTest.lara +++ /dev/null @@ -1,18 +0,0 @@ -import clava.hls.HLSAnalysis; -import weaver.Query; - -aspectdef HlsTestTest - - var filter = {joinPointType: "function", - qualifiedName: name => name.endsWith("_Kernel")}; - var $fnKernelArray = Query.search("function", filter).get(); - - - for (var $fnKernel of $fnKernelArray) { - println($fnKernel.joinPointType + " --> " + $fnKernel.qualifiedName); - HLSAnalysis.applyGenericStrategies($fnKernel); - } - - println(Query.root().code); - -end diff --git a/ClavaWeaver/resources/clava/test/api/InlinerTest.js b/ClavaWeaver/resources/clava/test/api/InlinerTest.js index b52610369a..b9107cabba 100644 --- a/ClavaWeaver/resources/clava/test/api/InlinerTest.js +++ b/ClavaWeaver/resources/clava/test/api/InlinerTest.js @@ -1,10 +1,10 @@ "use strict"; -laraImport("clava.opt.NormalizeToSubset"); -laraImport("clava.code.Inliner"); -laraImport("clava.opt.PrepareForInlining"); +import NormalizeToSubset from "@specs-feup/clava/api/clava/opt/NormalizeToSubset.js"; +import Inliner from "@specs-feup/clava/api/clava/code/Inliner.js"; +import PrepareForInlining from "@specs-feup/clava/api/clava/opt/PrepareForInlining.js"; -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; //setDebug(true); @@ -18,7 +18,7 @@ for (const $call of Query.search("function", "main").search("call")) { // inline() accepts an exprStmt. All calls must be inside exprStmt now const $callParent = $call.getAncestor("exprStmt"); if (!$callParent.instanceOf("exprStmt")) { - println( + console.log( `Could not inline call ${$call.name}@${$call.location}, ancestor is ${$callParent.joinPointType}` ); continue; @@ -30,10 +30,10 @@ for (const $call of Query.search("function", "main").search("call")) { const inliner = new Inliner(); inliner.inlineFunctionTree(Query.search("function", "main").first()); -println(Query.search("function", "main").first().code); +console.log(Query.search("function", "main").first().code); // Multile successive inlines of the same function -println("# Test inline of successive calls"); +console.log("# Test inline of successive calls"); for (const $call of Query.search("function", "inlineTest2").search("call")) { PrepareForInlining($call.function); } @@ -41,18 +41,18 @@ for (const $call of Query.search("function", "inlineTest2").search("call")) { new Inliner().inlineFunctionTree( Query.search("function", "inlineTest2").first() ); -println(Query.search("function", "inlineTest2").first().code); +console.log(Query.search("function", "inlineTest2").first().code); new Inliner().inlineFunctionTree( Query.search("function", "arrayParam").first() ); -println(Query.search("function", "arrayParam").first().code); +console.log(Query.search("function", "arrayParam").first().code); new Inliner().inlineFunctionTree( Query.search("function", "functionThatCallsFunctionThatUsesGlobal").first() ); -println( +console.log( Query.search("function", "functionThatCallsFunctionThatUsesGlobal").first() .code ); @@ -71,7 +71,7 @@ new Inliner().inlineFunctionTree( ).first() ); -println( +console.log( Query.search( "function", "functionThatCallsFunctionWithReturnButsDoesNotUseResult" @@ -82,7 +82,7 @@ new Inliner().inlineFunctionTree( Query.search("function", "functionWithNakedIf").first() ); -println(Query.search("function", "functionWithNakedIf").first().code); +console.log(Query.search("function", "functionWithNakedIf").first().code); new Inliner().inline( Query.search("function", "functionWhichCallIsNotDeclared") @@ -91,7 +91,7 @@ new Inliner().inline( .getAncestor("exprStmt") ); -println( +console.log( Query.search("function", "functionWhichCallIsNotDeclared").first().code ); @@ -99,7 +99,7 @@ new Inliner().inlineFunctionTree( Query.search("function", "functionThatCallsOtherWithVarInStruct").first() ); -println( +console.log( Query.search("function", "functionThatCallsOtherWithVarInStruct").first().code ); @@ -107,7 +107,7 @@ new Inliner().inlineFunctionTree( Query.search("function", "functionThatCallsFunctionWithStruct").first() ); -println( +console.log( Query.search("function", "functionThatCallsFunctionWithStruct").first().code ); @@ -115,7 +115,7 @@ new Inliner().inlineFunctionTree( Query.search("function", "functionThatCallFunctionWith2DimPointer").first() ); -println( +console.log( Query.search("function", "functionThatCallFunctionWith2DimPointer").first() .code ); @@ -124,54 +124,54 @@ new Inliner().inlineFunctionTree( Query.search("function", "functionWithCallWithStatic").first() ); -println(Query.search("function", "functionWithCallWithStatic").first().code); +console.log(Query.search("function", "functionWithCallWithStatic").first().code); new Inliner().inlineFunctionTree( Query.search("function", "callsFunctionWithLabels").first() ); -println(Query.search("function", "callsFunctionWithLabels").first().code); +console.log(Query.search("function", "callsFunctionWithLabels").first().code); -//println(Query.search("function", "functionWithStatic").first().ast); +//console.log(Query.search("function", "functionWithStatic").first().ast); /* -println( +console.log( Query.search("function", "functionWith2DimPointer").search("exprStmt").first() .expr.type.pointee.innerType.elementType.elementType ); */ /* -println( +console.log( Query.search("function", "functionThatCallsFunctionWithStruct") .search("vardecl", "__inline_0_x") .first().type.ast ); */ -//println(Query.search("function", "functioWithStruct").search("vardecl", "x").first().type.ast) -//println(Query.search("function", "functioWithStruct").search("vardecl", "x").first().type.code) +//console.log(Query.search("function", "functioWithStruct").search("vardecl", "x").first().type.ast) +//console.log(Query.search("function", "functioWithStruct").search("vardecl", "x").first().type.code) -//println( +//console.log( // Query.search("function", "functionThatCallsOtherWithVarInStruct").first().ast //); -//println(Query.root().code); +//console.log(Query.root().code); /* const callFiltezL1 = Query.search("function", "callFiltezL1") .search("call") .first(); -println("Bef:\n" + callFiltezL1.function.code); +console.log("Bef:\n" + callFiltezL1.function.code); PrepareForInlining(callFiltezL1.function); -println("Aft:\n" + callFiltezL1.function.code); +console.log("Aft:\n" + callFiltezL1.function.code); const stmtFiltezL1 = callFiltezL1.getAncestor("exprStmt"); inliner.inline(stmtFiltezL1); -println(Query.search("function", "callFiltezL1").first().code); +console.log(Query.search("function", "callFiltezL1").first().code); */ //PrepareForInlining(Query.search("function", "filtez").first()); //PrepareForInlining(Query.search("function", "callFiltezL1").first()); @@ -181,5 +181,5 @@ println(Query.search("function", "callFiltezL1").first().code); new Inliner().inlineFunctionTree( Query.search("function", "callFiltezL2").first() ); -println(Query.search("function", "callFiltezL2").first().code); +console.log(Query.search("function", "callFiltezL2").first().code); */ diff --git a/ClavaWeaver/resources/clava/test/api/JpFilter.js b/ClavaWeaver/resources/clava/test/api/JpFilter.js new file mode 100644 index 0000000000..6c6bb6afb3 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/JpFilter.js @@ -0,0 +1,72 @@ +import JpFilter from "@specs-feup/lara/api/lara/util/JpFilter.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import Weaver from "@specs-feup/lara/api/weaver/Weaver.js"; + +function convert($jps) { + let string = ""; + + let first = true; + for (const $jp of $jps) { + if (first) { + first = false; + } else { + string += ", "; + } + + string += $jp.name; + } + + return string; +} + +function jpName($jp) { + return $jp.name; +} + +const $records = []; +for (const $record of Query.search("record")) { + $records.push($record); +} + +const filter1 = new JpFilter({ name: "A" }); +console.log(convert(filter1.filter($records))); + +const filter2 = new JpFilter({ name: /A/ }); +console.log(convert(filter2.filter($records))); + +const filter3 = new JpFilter({ name: /A/, kind: "class" }); +console.log(convert(filter3.filter($records))); + +const filter4 = new JpFilter({ name: /A/ }); +console.log(convert(filter4.filter($records))); + +const filter5 = new JpFilter({ + name: /A/, + line: function (line) { + return line > 7; + }, +}); +console.log(convert(filter5.filter($records))); + +const $jps = Query.search("record", { name: /A/ }) + .search("field", { name: "x" }) + .get(); + +for (const $selected of $jps) { + console.log("Select function: " + $selected.code); +} + +// Test search inclusive +const $foo2 = Query.search("function", { name: "foo2" }).first(); +const $secondFoo2 = Query.searchFromInclusive($foo2, "function", { + name: "foo2", +}).first(); +console.log("Search inclusive: " + $secondFoo2.name); + +// Test retrieving default attribute of join point +console.log( + "Default attribute of 'function': " + Weaver.getDefaultAttribute("function") +); +console.log( + "Search with default: " + Query.search("function", "foo2").first().name +); diff --git a/ClavaWeaver/resources/clava/test/api/JpFilter.lara b/ClavaWeaver/resources/clava/test/api/JpFilter.lara deleted file mode 100644 index cd19ca41ab..0000000000 --- a/ClavaWeaver/resources/clava/test/api/JpFilter.lara +++ /dev/null @@ -1,72 +0,0 @@ -import lara.util.JpFilter; -import weaver.Query; -import weaver.Weaver; - -aspectdef JpFilterTest - - var $records = []; - select record end - apply - $records.push($record); - end - - - var filter1 = new JpFilter({name: 'A'}); - println(convert(filter1.filter($records))); - - var filter2 = new JpFilter({name: /A/}); - println(convert(filter2.filter($records))); - - var filter3 = new JpFilter({name: /A/, kind: 'class'}); - println(convert(filter3.filter($records))); - - var filter4 = new JpFilter({name: /A/}); - println(convert(filter4.filter($records))); - - var filter5 = new JpFilter({name: /A/, line: function(line){return line > 7;}}); - println(convert(filter5.filter($records))); - - var $jps = Query.search("record", {name: /A/}).search("field", {name: 'x'}).get(); - - for(var $selected of $jps) { - println("Select function: " + $selected.code); - } - - //println("FILTER:"); - //printObject(filter2); - - - // Test search inclusive - var $foo2 = Query.search("function", {name: "foo2"}).first(); - var $secondFoo2 = Query.searchFromInclusive($foo2, "function", {name: "foo2"}).first(); - println("Search inclusive: " + $secondFoo2.name); - - // Test retrieving default attribute of join point - println("Default attribute of 'function': " + Weaver.getDefaultAttribute("function")); - println("Search with default: " + Query.search("function", "foo2").first().name); - -end - -function convert($jps) { - var string = ""; - - var first = true; - for(var $jp of $jps) { - //println("JP:" + $jp); - //println("JP NAME:" + $jp.name); - if(first) { - first = false; - } else { - string += ", "; - } - - string += $jp.name; - } - - return string; - //return $jps.map(jpName).join(", "); -} - -function jpName($jp) { - return $jp.name; -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/LaraCommonLanguageTest.js b/ClavaWeaver/resources/clava/test/api/LaraCommonLanguageTest.js deleted file mode 100644 index 340f53d39b..0000000000 --- a/ClavaWeaver/resources/clava/test/api/LaraCommonLanguageTest.js +++ /dev/null @@ -1,31 +0,0 @@ -laraImport("lcl.LaraCommonLanguage"); -laraImport("weaver.jp.ClavaJoinPoint"); -laraImport("weaver.jp.FileJp"); -laraImport("weaver.Query"); - - var $file = Query.search("file").first(); - //printlnObject($file); - println("line: " + $file.line); - println("is FileJP? : " + ($file instanceof FileJp)); - - var classes = Query.search("classType", "A").get(); - println("# A classes: " + classes.length); - - var classesOnlyDecl = Query.search("classType", "classOnlyDecl").get(); - println("# onlyDecl classes: " + classesOnlyDecl.length); - - var fooFunctions = Query.search("function", "foo").get(); - println("# foo functions: " + fooFunctions.length); - - var fooOnlyDeclFunctions = Query.search("function", "fooOnlyDecl").get(); - println("# fooOnlyDecl functions: " + fooOnlyDeclFunctions.length); - - - var bClasses = Query.search("classType", "B").get(); - println("# B classes: " + bClasses.length); - - var cClasses = Query.search("classType", "C").get(); - println("# C classes: " + cClasses.length); - - var dCalls = Query.search("classType", "D").search("call").get(); - println("# calls in D: " + dCalls.length); \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/LivenessAnalysisTest.js b/ClavaWeaver/resources/clava/test/api/LivenessAnalysisTest.js index e58c59a583..d877d12af6 100644 --- a/ClavaWeaver/resources/clava/test/api/LivenessAnalysisTest.js +++ b/ClavaWeaver/resources/clava/test/api/LivenessAnalysisTest.js @@ -1,12 +1,12 @@ -laraImport("clava.liveness.LivenessAnalysis"); -laraImport("clava.graphs.ControlFlowGraph"); -laraImport("weaver.Query"); +import LivenessAnalysis from "@specs-feup/clava/api/clava/liveness/LivenessAnalysis.js"; +import ControlFlowGraph from "@specs-feup/clava/api/clava/graphs/ControlFlowGraph.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; const $fooFunction = Query.search("function", "foo").first(); const cfgOptions = {splitInstList: true}; const cfg = ControlFlowGraph.build($fooFunction, true, cfgOptions); -println("Liveness results for foo:") +console.log("Liveness results for foo:") const analysisResult = LivenessAnalysis.analyse(cfg.graph); for (const node of cfg.graph.nodes()) { @@ -15,13 +15,13 @@ for (const node of cfg.graph.nodes()) { const liveIn = analysisResult.liveIn.get(node.id()); const liveOut = analysisResult.liveOut.get(node.id()); - println("Node id: " + node.id()); - println("Node stmt: " + node.data().toString()); - println("Def: "+ [...sortSet(def)]); - println("Use: " + [...sortSet(use)]); - println("Live in: " + [...sortSet(liveIn)]); - println("Live out: " + [...sortSet(liveOut)]); - println(); + console.log("Node id: " + node.id()); + console.log("Node stmt: " + node.data().toString()); + console.log("Def: "+ [...sortSet(def)]); + console.log("Use: " + [...sortSet(use)]); + console.log("Live in: " + [...sortSet(liveIn)]); + console.log("Live out: " + [...sortSet(liveOut)]); + console.log(); } function sortSet(set) { diff --git a/ClavaWeaver/resources/clava/test/api/LoggerTest.js b/ClavaWeaver/resources/clava/test/api/LoggerTest.js new file mode 100644 index 0000000000..c3b36ebca7 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/LoggerTest.js @@ -0,0 +1,40 @@ +import Logger from "@specs-feup/clava/api/lara/code/Logger.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const loggerConsole = new Logger(); +const loggerFile = new Logger(false, "log.txt"); + +for (const $call of Query.search("file").search("call")) { + loggerConsole + .append("Print double ") + .appendDouble(2) + .append(" after " + $call.name) + .ln(); + loggerConsole.log($call, true); + + loggerConsole.append("Printing again").ln(); + loggerConsole.log($call); + + loggerFile.append("Logging to a file").ln(); + loggerFile.log($call, true); + + loggerFile.append("Logging again to a file").ln(); + loggerFile.log($call); +} + +const appendLogger = new Logger().long("aLong").longLong("aLongLong"); + +const $vardecl = Query.search("function", "testAppend") + .search("vardecl", "a") + .first(); +appendLogger.log($vardecl); + +for (const $varref of Query.search("function", "testAppendJp").search( + "varref" +)) { + new Logger().int($varref).log($varref); +} + +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/api/LoggerTest.lara b/ClavaWeaver/resources/clava/test/api/LoggerTest.lara deleted file mode 100644 index 1da0946925..0000000000 --- a/ClavaWeaver/resources/clava/test/api/LoggerTest.lara +++ /dev/null @@ -1,49 +0,0 @@ -import lara.code.Logger; -import clava.Clava; - - -aspectdef LoggerTest - - var loggerConsole = new Logger(); - var loggerFile = new Logger(false, "log.txt"); - - - select file.stmt.call end - apply - loggerConsole.append("Print double ").appendDouble(2).append(" after " + $call.name).ln(); - loggerConsole.log($call, true); - - loggerConsole.append("Printing again").ln(); - loggerConsole.log($call); - - loggerFile.append("Logging to a file").ln(); - loggerFile.log($call, true); - - loggerFile.append("Logging again to a file").ln(); - loggerFile.log($call); - end - - - var appendLogger = (new Logger()) - .long("aLong") - .longLong("aLongLong"); - - select function{"testAppend"}.vardecl{"a"} end - apply - appendLogger.log($vardecl); - end - - - select function{"testAppendJp"}.varref end - apply - var appendLoggerJp = (new Logger()) - .int($varref) - .log($varref); - end - - select file end - apply - println($file.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.js b/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.js new file mode 100644 index 0000000000..6427c6e881 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.js @@ -0,0 +1,27 @@ +import Logger from "@specs-feup/clava/api/lara/code/Logger.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const loggerConsole = new Logger(undefined, undefined, true); +const loggerFile = new Logger(false, "log.txt", true); + +for (const $call of Query.search("file").search("call")) { + loggerConsole + .append("Print double ") + .appendDouble(2) + .append(" after " + $call.name) + .ln(); + loggerConsole.log($call, true); + + loggerConsole.append("Printing again").ln(); + loggerConsole.log($call); + + loggerFile.append("Logging to a file").ln(); + loggerFile.log($call, true); + + loggerFile.append("Logging again to a file").ln(); + loggerFile.log($call); +} + +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.lara b/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.lara deleted file mode 100644 index 1bfa6aedf7..0000000000 --- a/ClavaWeaver/resources/clava/test/api/LoggerTestWithLib.lara +++ /dev/null @@ -1,36 +0,0 @@ -import lara.code.Logger; -import clava.Clava; - -aspectdef Launcher - - // Enable SpecsLogger, for testing - Clava.useSpecsLogger = true; - - var loggerConsole = new Logger(); - var loggerFile = new Logger(false, "log.txt"); - - // Disable SpecsLogger, in order to compile again woven code - loggerConsole.useSpecsLogger = false; - loggerFile.useSpecsLogger = false; - - select file.stmt.call end - apply - loggerConsole.append("Print double ").appendDouble(2).append(" after " + $call.name).ln(); - loggerConsole.log($call, true); - - loggerConsole.append("Printing again").ln(); - loggerConsole.log($call); - - loggerFile.append("Logging to a file").ln(); - loggerFile.log($call, true); - - loggerFile.append("Logging again to a file").ln(); - loggerFile.log($call); - end - - select file end - apply - println($file.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/api/MathExtraTest.js b/ClavaWeaver/resources/clava/test/api/MathExtraTest.js new file mode 100644 index 0000000000..524592136f --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/MathExtraTest.js @@ -0,0 +1,13 @@ +import MathExtra from "@specs-feup/clava/api/clava/MathExtra.js"; + +console.log("Original expression: a - (b - c)"); +console.log("Simplified expression: " + MathExtra.simplify("a - (b - c)")); +console.log("Original expression: a - (b - c)^2"); +console.log("Simplified expression: " + MathExtra.simplify("a - (b - c)^2")); + +const constants = {}; +constants["a"] = 2; +console.log("Original expression: a - (b - c), with a=2"); +console.log( + "Simplified expression: " + MathExtra.simplify("a - (b - c)", constants) +); diff --git a/ClavaWeaver/resources/clava/test/api/MathExtraTest.lara b/ClavaWeaver/resources/clava/test/api/MathExtraTest.lara deleted file mode 100644 index 91af7e27bd..0000000000 --- a/ClavaWeaver/resources/clava/test/api/MathExtraTest.lara +++ /dev/null @@ -1,14 +0,0 @@ -import clava.MathExtra; - -aspectdef MathExtraTest - - println("Original expression: a - (b - c)"); - println("Simplified expression: " + MathExtra.simplify("a - (b - c)")); - println("Original expression: a - (b - c)^2"); - println("Simplified expression: " + MathExtra.simplify("a - (b - c)^2")); - - var constants = {}; - constants["a"] = 2; - println("Original expression: a - (b - c), with a=2"); - println("Simplified expression: " + MathExtra.simplify("a - (b - c)", constants)); -end diff --git a/ClavaWeaver/resources/clava/test/api/MpiScatterGatherTest.js b/ClavaWeaver/resources/clava/test/api/MpiScatterGatherTest.js index c85586f35a..2e8afe6737 100644 --- a/ClavaWeaver/resources/clava/test/api/MpiScatterGatherTest.js +++ b/ClavaWeaver/resources/clava/test/api/MpiScatterGatherTest.js @@ -1,5 +1,5 @@ -laraImport("clava.mpi.MpiScatterGatherLoop"); -laraImport("weaver.Query"); +import MpiScatterGatherLoop from "@specs-feup/clava/api/clava/mpi/MpiScatterGatherLoop.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; const $function = Query.search("function", "foo").first(); @@ -12,4 +12,4 @@ const mpiGsl = new MpiScatterGatherLoop( mpiGsl.execute(); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/PassCompositionTest.js b/ClavaWeaver/resources/clava/test/api/PassCompositionTest.js index a01b0ea469..751f15a12c 100644 --- a/ClavaWeaver/resources/clava/test/api/PassCompositionTest.js +++ b/ClavaWeaver/resources/clava/test/api/PassCompositionTest.js @@ -1,11 +1,10 @@ -laraImport("clava.pass.DecomposeDeclStmt"); -laraImport("clava.pass.SimplifySelectionStmts"); -laraImport("clava.code.SimplifyAssignment"); -laraImport("clava.code.StatementDecomposer"); +import DecomposeDeclStmt from "@specs-feup/clava/api/clava/pass/DecomposeDeclStmt.js"; +import SimplifySelectionStmts from "@specs-feup/clava/api/clava/pass/SimplifySelectionStmts.js"; +import StatementDecomposer from "@specs-feup/clava/api/clava/code/StatementDecomposer.js"; -laraImport("lara.pass.composition.Passes"); +import Passes from "@specs-feup/lara/api/lara/pass/composition/Passes.js"; -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; // This type of pass is no longer supported. It is now mandatory to create a class for the pass /* @@ -16,7 +15,7 @@ function SimplifyAssignments($startJp) { } function DummyPass($startJp, options) { - println( + console.log( "Dummy pass that has received an option object with the value '" + options["foo"] + "' for the key 'foo'" @@ -33,4 +32,4 @@ const passes = [ const results = Passes.apply(Query.root(), passes); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/PassSimplifyLoopsTest.js b/ClavaWeaver/resources/clava/test/api/PassSimplifyLoopsTest.js index a33aee9f7d..7860b6cada 100644 --- a/ClavaWeaver/resources/clava/test/api/PassSimplifyLoopsTest.js +++ b/ClavaWeaver/resources/clava/test/api/PassSimplifyLoopsTest.js @@ -1,12 +1,10 @@ -laraImport("clava.Clava"); -laraImport("clava.pass.SimplifyLoops"); -laraImport("clava.code.StatementDecomposer"); -laraImport("clava.pass.DecomposeVarDeclarations"); -laraImport("weaver.Query"); +import SimplifyLoops from "@specs-feup/clava/api/clava/pass/SimplifyLoops.js"; +import StatementDecomposer from "@specs-feup/clava/api/clava/code/StatementDecomposer.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; const statementDecomposer = new StatementDecomposer(); const pass = new SimplifyLoops(statementDecomposer); pass.apply(Query.root()); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.js b/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.js new file mode 100644 index 0000000000..427982e285 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.js @@ -0,0 +1,6 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import DecomposeVarDeclarations from "@specs-feup/clava/api/clava/pass/DecomposeVarDeclarations.js"; + +const result = new DecomposeVarDeclarations().apply(); +console.log("Result: " + result); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.lara b/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.lara deleted file mode 100644 index e5f550ced0..0000000000 --- a/ClavaWeaver/resources/clava/test/api/PassSimplifyVarDeclarations.lara +++ /dev/null @@ -1,10 +0,0 @@ -import weaver.Query; -import clava.pass.DecomposeVarDeclarations; - -aspectdef PassSimplifyVarDeclarations - - var result = (new DecomposeVarDeclarations()).apply(); - println("Result: " + result); - println(Query.root().code); - -end diff --git a/ClavaWeaver/resources/clava/test/api/PassSingleReturnTest.js b/ClavaWeaver/resources/clava/test/api/PassSingleReturnTest.js index 7146a030b3..2e984660dd 100644 --- a/ClavaWeaver/resources/clava/test/api/PassSingleReturnTest.js +++ b/ClavaWeaver/resources/clava/test/api/PassSingleReturnTest.js @@ -1,6 +1,6 @@ -laraImport("clava.Clava"); -laraImport("clava.pass.SingleReturnFunction"); -laraImport("weaver.Query"); +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import SingleReturnFunction from "@specs-feup/clava/api/clava/pass/SingleReturnFunction.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; const pass = new SingleReturnFunction(); for (const $function of Query.search("function")) { @@ -8,4 +8,4 @@ for (const $function of Query.search("function")) { } Clava.rebuild(); -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/QueryTest.js b/ClavaWeaver/resources/clava/test/api/QueryTest.js index 957bce6ec7..bcfead71f5 100644 --- a/ClavaWeaver/resources/clava/test/api/QueryTest.js +++ b/ClavaWeaver/resources/clava/test/api/QueryTest.js @@ -1,37 +1,36 @@ -laraImport("weaver.Query"); - - - - println("query_loop 1"); - for(var query of Query.search("function", "query_loop").search("loop").search("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_loop 2"); - //for(var query of Query.search("function", "query_loop").search("loop").children("scope").children("loop").chain()) { - //for(var query of Query.search("function", "query_loop").search("loop").children("loop").chain()) { - for(var query of Query.search("function", "query_loop").search("loop").scope("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_loop 3"); - //for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("scope").children("loop").chain()) { - //for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("loop").chain()) { - for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).scope("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_empty 1"); - for(var query of Query.search("function", "query_empty").scope().chain()) { - println("joinpoint: " + query["joinpoint"].joinPointType); - } - - - for(var query of Query.search("function", "query_loop").search("loop").search("loop").search("loop").chain()) { - println("chain keys: " + getKeys(query).sort()); - } - - for(var query of Query.search("function", /_regex/)) { - println("regex: " + query.name); - } +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import { getKeys } from "@specs-feup/lara/api/lara/core/LaraCore.js"; + +console.log("query_loop 1"); +for(const query of Query.search("function", "query_loop").search("loop").search("loop").chain()) { + console.log("loop:" + query["loop"].rank); +} + +console.log("query_loop 2"); +//for(const query of Query.search("function", "query_loop").search("loop").children("scope").children("loop").chain()) { +//for(const query of Query.search("function", "query_loop").search("loop").children("loop").chain()) { +for(const query of Query.search("function", "query_loop").search("loop").scope("loop").chain()) { + console.log("loop:" + query["loop"].rank); +} + +console.log("query_loop 3"); +//for(const query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("scope").children("loop").chain()) { +//for(const query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("loop").chain()) { +for(const query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).scope("loop").chain()) { + console.log("loop:" + query["loop"].rank); +} + +console.log("query_empty 1"); +for(const query of Query.search("function", "query_empty").scope().chain()) { + console.log("joinpoint: " + query["joinpoint"].joinPointType); +} + + +for(const query of Query.search("function", "query_loop").search("loop").search("loop").search("loop").chain()) { + console.log("chain keys: " + getKeys(query).sort()); +} + +for(const query of Query.search("function", /_regex/)) { + console.log("regex: " + query.name); +} diff --git a/ClavaWeaver/resources/clava/test/api/QueryTest.lara b/ClavaWeaver/resources/clava/test/api/QueryTest.lara deleted file mode 100644 index 465aa797aa..0000000000 --- a/ClavaWeaver/resources/clava/test/api/QueryTest.lara +++ /dev/null @@ -1,37 +0,0 @@ -import weaver.Query; - -aspectdef QueryTest - - println("query_loop 1"); - for(var query of Query.search("function", "query_loop").search("loop").search("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_loop 2"); - //for(var query of Query.search("function", "query_loop").search("loop").children("scope").children("loop").chain()) { - //for(var query of Query.search("function", "query_loop").search("loop").children("loop").chain()) { - for(var query of Query.search("function", "query_loop").search("loop").scope("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_loop 3"); - //for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("scope").children("loop").chain()) { - //for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).children("loop").chain()) { - for(var query of Query.search("function", "query_loop").search("loop", {"isOutermost": true}).scope("loop").chain()) { - println("loop:" + query["loop"].rank); - } - - println("query_empty 1"); - for(var query of Query.search("function", "query_empty").scope().chain()) { - println("joinpoint: " + query["joinpoint"].joinPointType); - } - - - for(var query of Query.search("function", "query_loop").search("loop").search("loop").search("loop").chain()) { - println("chain keys: " + getKeys(query).sort()); - } - - for(var query of Query.search("function", /_regex/)) { - println("regex: " + query.name); - } -end diff --git a/ClavaWeaver/resources/clava/test/api/RebuildTest.js b/ClavaWeaver/resources/clava/test/api/RebuildTest.js new file mode 100644 index 0000000000..f3a95fff69 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/RebuildTest.js @@ -0,0 +1,30 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Io from "@specs-feup/lara/api/lara/Io.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Manually add header file +const headerFile = Io.getPath("cxx_weaver_output/rebuild.h"); + +const $file = ClavaJoinPoints.file(headerFile); +Clava.addFile($file, "cxx_weaver_output"); + +console.log("Stack size before push: " + Clava.getStackSize()); +Clava.pushAst(); +console.log("Stack size after push: " + Clava.getStackSize()); + +for (const $function of Query.search("function", "main")) { + $function.insertBefore("// Hello"); +} + +Clava.rebuild(); +console.log("Temporary code:\n" + Clava.getProgram().code); + +Clava.popAst(); +console.log("Stack size after pop: " + Clava.getStackSize()); + +// Rebuild two times, to stress test rebuild +Clava.rebuild(); +Clava.rebuild(); + +console.log("Original code:\n" + Clava.getProgram().code); diff --git a/ClavaWeaver/resources/clava/test/api/RebuildTest.lara b/ClavaWeaver/resources/clava/test/api/RebuildTest.lara deleted file mode 100644 index 9c3752431c..0000000000 --- a/ClavaWeaver/resources/clava/test/api/RebuildTest.lara +++ /dev/null @@ -1,70 +0,0 @@ -import clava.Clava; -import clava.ClavaJoinPoints; -import lara.Io; - -aspectdef RebuildTest - - // Manually add header file - var headerFile = Io.getPath("cxx_weaver_output/rebuild.h"); - //println("header exists? " + Io.isFile(headerFile)); - var $file = ClavaJoinPoints.file(headerFile); - Clava.addFile($file, "cxx_weaver_output"); - - //println("Header code: " + $file.code); - - //println("Pushing"); - println("Stack size before push: " + Clava.getStackSize()); - Clava.pushAst(); - println("Stack size after push: " + Clava.getStackSize()); - - select function{"main"} end - apply - $function.insert before "// Hello"; - end - - //println("Rebuilding"); - Clava.rebuild(); - println("Temporary code:\n" + Clava.getProgram().code); - - //println("Poping"); - Clava.popAst(); - println("Stack size after pop: " + Clava.getStackSize()); - //println("Rebuilding"); - - - // Rebuild two times, to stress test rebuild - Clava.rebuild(); - Clava.rebuild(); - - println("Original code:\n" + Clava.getProgram().code); - - - -/* - // Insert error in the code to parse - select function{"main"}.body end - apply - $body.insertBegin("a = 0;\nb = 0;"); - - end - - // Should give an error - Clava.rebuild(); - /* - try { - Clava.rebuild(); - println("Did not find compilation error"); - } catch(e) { - println("Found compilation error"); - } - */ - -// select program end -// apply -// $program.rebuild(); -// end - - - -end - diff --git a/ClavaWeaver/resources/clava/test/api/SelectorTest.js b/ClavaWeaver/resources/clava/test/api/SelectorTest.js new file mode 100644 index 0000000000..aedb7a234c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/SelectorTest.js @@ -0,0 +1,16 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $chain of Query.search("function", "loops") + .search("loop") + .children("scope") + .children("loop") + .chain()) { + console.log("Loop:\n" + $chain["loop"].init.code); +} + +// Test iterator +let iteratorsStmts = 0; +for (const _ of Query.search("function", "iterators").search("statement")) { + iteratorsStmts++; +} +console.log("Stmts in iterators: " + iteratorsStmts); diff --git a/ClavaWeaver/resources/clava/test/api/SelectorTest.lara b/ClavaWeaver/resources/clava/test/api/SelectorTest.lara deleted file mode 100644 index a626558e82..0000000000 --- a/ClavaWeaver/resources/clava/test/api/SelectorTest.lara +++ /dev/null @@ -1,17 +0,0 @@ -import weaver.Query; - -aspectdef SelectorTest - - for(var $chain of Query.search("function", "loops").search("loop").children("scope").children("loop").chain()) { - println("Loop:\n"+$chain["loop"].init.code); - } - - - // Test iterator - var iteratorsStmts = 0; - for(var $stmt of Query.search("function", "iterators").search("statement")) { - iteratorsStmts++; - } - println("Stmts in iterators: " + iteratorsStmts); - -end diff --git a/ClavaWeaver/resources/clava/test/api/SerializeNode.lara b/ClavaWeaver/resources/clava/test/api/SerializeNode.lara deleted file mode 100644 index 134a36323d..0000000000 --- a/ClavaWeaver/resources/clava/test/api/SerializeNode.lara +++ /dev/null @@ -1,16 +0,0 @@ -import weaver.Query; -import weaver.Weaver; - -import lara.Strings; - -aspectdef SerializeNode - - var rootXml = Weaver.serialize(Query.root()); - - //println("ROOT: " + rootXml); - - var $jp = Weaver.deserialize(rootXml); - - println(Query.searchFrom($jp, "function", "foo").first().code); - -end diff --git a/ClavaWeaver/resources/clava/test/api/StatementDecomposerTest.js b/ClavaWeaver/resources/clava/test/api/StatementDecomposerTest.js index 3500b95f0d..916e91b813 100644 --- a/ClavaWeaver/resources/clava/test/api/StatementDecomposerTest.js +++ b/ClavaWeaver/resources/clava/test/api/StatementDecomposerTest.js @@ -1,5 +1,5 @@ -laraImport("clava.code.StatementDecomposer"); -laraImport("weaver.Query"); +import StatementDecomposer from "@specs-feup/clava/api/clava/code/StatementDecomposer.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; //setDebug(); var decomposer = new StatementDecomposer(); @@ -8,4 +8,4 @@ for (var $stmt of Query.search("function", "foo").search("statement")) { decomposer.decomposeAndReplace($stmt); } -println(Query.search("function", "foo").first().code); +console.log(Query.search("function", "foo").first().code); diff --git a/ClavaWeaver/resources/clava/test/api/StaticCallGraphTest.js b/ClavaWeaver/resources/clava/test/api/StaticCallGraphTest.js index 6bf30875cc..43e80703b1 100644 --- a/ClavaWeaver/resources/clava/test/api/StaticCallGraphTest.js +++ b/ClavaWeaver/resources/clava/test/api/StaticCallGraphTest.js @@ -1,28 +1,28 @@ -laraImport("clava.graphs.StaticCallGraph"); -laraImport("lara.graphs.Graphs"); -laraImport("weaver.Query"); +import StaticCallGraph from "@specs-feup/clava/api/clava/graphs/StaticCallGraph.js"; +import Graphs from "@specs-feup/lara/api/lara/graphs/Graphs.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; var fullGraph = StaticCallGraph.build(); -println("Full graph"); -println(fullGraph.toDot()); +console.log("Full graph"); +console.log(fullGraph.toDot()); var functionGraph = StaticCallGraph.build(Query.search("function", "foo1").first(), false); -println("Function graph"); -println(functionGraph.toDot()); +console.log("Function graph"); +console.log(functionGraph.toDot()); var functionGraphFull = StaticCallGraph.build(Query.search("function", "foo1").first()); -println("Function graph full"); -println(functionGraphFull.toDot()); +console.log("Function graph full"); +console.log(functionGraphFull.toDot()); var callGraphFull = StaticCallGraph.build(Query.search("function", "main").search("call", "foo1").first()); -println("Function graph full"); -println(callGraphFull.toDot()); +console.log("Function graph full"); +console.log(callGraphFull.toDot()); // Get leaf nodes const fullLeafNodes = fullGraph.graph.nodes().filter(node => Graphs.isLeaf(node)); -println("Full graph leaf nodes: " + fullLeafNodes.map(node => node.data())) +console.log("Full graph leaf nodes: " + fullLeafNodes.map(node => node.data())) const functionLeafNodes = functionGraph.graph.nodes().filter(node => Graphs.isLeaf(node)); -println("Function graph leaf nodes: " + functionLeafNodes.map(node => node.data())) -println("Function graph leaf nodes with implementation: " + functionLeafNodes.filter(node => node.data().hasCalls()).map(node => node.data())) \ No newline at end of file +console.log("Function graph leaf nodes: " + functionLeafNodes.map(node => node.data())) +console.log("Function graph leaf nodes with implementation: " + functionLeafNodes.filter(node => node.data().hasCalls()).map(node => node.data())) \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/StrcpyChecker.js b/ClavaWeaver/resources/clava/test/api/StrcpyChecker.js new file mode 100644 index 0000000000..67fb8115a5 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/StrcpyChecker.js @@ -0,0 +1,21 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import StrcpyChecker from "@specs-feup/clava/api/clava/analysis/checkers/StrcpyChecker.js"; +import CheckBasedAnalyser from "@specs-feup/clava/api/clava/analysis/CheckBasedAnalyser.js"; +import MessageGenerator from "@specs-feup/clava/api/clava/analysis/MessageGenerator.js"; + +const analyser = new CheckBasedAnalyser(); +analyser.addChecker(new StrcpyChecker()); + +const result = analyser.analyse(Query.search("file").first()); + +const messageManager = new MessageGenerator(false); +messageManager.append(result); +const allMessages = messageManager.generateReport(); + +for (const filename in allMessages) { + const fileMessages = allMessages[filename]; + + for (const message of fileMessages) { + console.log(message.substring(0, message.indexOf(":"))); + } +} diff --git a/ClavaWeaver/resources/clava/test/api/StrcpyChecker.lara b/ClavaWeaver/resources/clava/test/api/StrcpyChecker.lara deleted file mode 100644 index c011f5fc91..0000000000 --- a/ClavaWeaver/resources/clava/test/api/StrcpyChecker.lara +++ /dev/null @@ -1,26 +0,0 @@ -import weaver.Query; -import clava.analysis.checkers.StrcpyChecker; -import clava.analysis.CheckBasedAnalyser; -import clava.analysis.MessageGenerator; - -aspectdef StrcpyCheckerTest - - var analyser = new CheckBasedAnalyser(); - analyser.addChecker(new StrcpyChecker()); - - var result = analyser.analyse(Query.search("file").first()); - - var messageManager = new MessageGenerator(false); - messageManager.append(result); - var allMessages = messageManager.generateReport(); - - for(var filename in allMessages) { - var fileMessages = allMessages[filename]; - - for(var message of fileMessages) { - println(message.substring(0, message.indexOf(":"))); - } - } - -end - \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/SubsetTest.js b/ClavaWeaver/resources/clava/test/api/SubsetTest.js index bf5ac03ef9..ed372d3534 100644 --- a/ClavaWeaver/resources/clava/test/api/SubsetTest.js +++ b/ClavaWeaver/resources/clava/test/api/SubsetTest.js @@ -1,8 +1,8 @@ -laraImport("clava.opt.NormalizeToSubset"); -laraImport("weaver.Query"); +import NormalizeToSubset from "@specs-feup/clava/api/clava/opt/NormalizeToSubset.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; // Normalize all code NormalizeToSubset(Query.root()); // Print code -println(Query.root().code); +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/api/SwitchToIfTransformationTest.js b/ClavaWeaver/resources/clava/test/api/SwitchToIfTransformationTest.js index 16f709d9c6..42515a1420 100644 --- a/ClavaWeaver/resources/clava/test/api/SwitchToIfTransformationTest.js +++ b/ClavaWeaver/resources/clava/test/api/SwitchToIfTransformationTest.js @@ -1,7 +1,7 @@ -laraImport("clava.Clava"); -laraImport("clava.pass.TransformSwitchToIf"); +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import TransformSwitchToIf from "@specs-feup/clava/api/clava/pass/TransformSwitchToIf.js"; -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; const switchTransformer = new TransformSwitchToIf(true); @@ -10,4 +10,4 @@ for (const $switch of Query.search("switch")) { } Clava.rebuild(); -println(Query.search("function", "foo").first().code); \ No newline at end of file +console.log(Query.search("function", "foo").first().code); \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/TimerTest.js b/ClavaWeaver/resources/clava/test/api/TimerTest.js new file mode 100644 index 0000000000..b2b0beb294 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/TimerTest.js @@ -0,0 +1,50 @@ +import Timer from "@specs-feup/clava/api/lara/code/Timer.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Logger from "@specs-feup/clava/api/lara/code/Logger.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Disable SpecsLogger, in order to be able to compile woven code without the project +Clava.useSpecsLogger = false; + +// Instrument call to 'Calculate' +const timer = new Timer(); + +for (const $call of Query.search("call")) { + if ($call.name !== "bar" && $call.name !== "foo") { + continue; + } + + timer.time($call, "Time:"); +} + +// Disable printing result +timer.setPrint(false); + +let $call = Query.search("call", "bar2").first(); +const bar2TimeVar = timer.time($call); +let logger = new Logger(); +logger + .text("I want to print the value of the elapsed time (") + .double(bar2TimeVar) + .text( + "), which is in the unit '" + + timer.getUnit().getUnitsString() + + "' and put other stuff after it" + ) + .ln() + .log(timer.getAfterJp()); + +// Enable printing again +timer.setPrint(true); + +$call = Query.search("call", "bar3").first(); +timer.time($call); +logger = new Logger(); +logger + .text("This should appear after the timer print") + .ln() + .log(timer.getAfterJp()); + +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/api/TimerTest.lara b/ClavaWeaver/resources/clava/test/api/TimerTest.lara deleted file mode 100644 index 3ad9f00dbc..0000000000 --- a/ClavaWeaver/resources/clava/test/api/TimerTest.lara +++ /dev/null @@ -1,55 +0,0 @@ -import lara.code.Timer; -import clava.Clava; -import clava.ClavaJoinPoints; -import lara.code.Logger; - -aspectdef TimerTest - - // Disable SpecsLogger, in order to be able to compile woven code without the project - Clava.useSpecsLogger = false; - - // Instrument call to 'Calculate' - var timer = new Timer(); - - select stmt.call end - apply - if($call.name !== "bar" && $call.name !== "foo") { - continue; - } - - timer.time($call, "Time:"); - end - - // Disable printing result - timer.setPrint(false); - - select call{"bar2"} end - apply - var bar2TimeVar = timer.time($call); - var logger = new Logger(); - logger.text("I want to print the value of the elapsed time (") - .double(bar2TimeVar) - .text("), which is in the unit '" + timer.getUnit().getUnitsString() + "' and put other stuff after it") - .ln() - .log(timer.getAfterJp()); - end - - - // Enable printing again - timer.setPrint(true); - select call{"bar3"} end - apply - timer.time($call); - var logger = new Logger(); - logger.text("This should appear after the timer print") - .ln() - .log(timer.getAfterJp()); - end - - - select file end - apply - println($file.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/api/TimerTestWithCxxFlag.js b/ClavaWeaver/resources/clava/test/api/TimerTestWithCxxFlag.js new file mode 100644 index 0000000000..b2b0beb294 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/TimerTestWithCxxFlag.js @@ -0,0 +1,50 @@ +import Timer from "@specs-feup/clava/api/lara/code/Timer.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Logger from "@specs-feup/clava/api/lara/code/Logger.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Disable SpecsLogger, in order to be able to compile woven code without the project +Clava.useSpecsLogger = false; + +// Instrument call to 'Calculate' +const timer = new Timer(); + +for (const $call of Query.search("call")) { + if ($call.name !== "bar" && $call.name !== "foo") { + continue; + } + + timer.time($call, "Time:"); +} + +// Disable printing result +timer.setPrint(false); + +let $call = Query.search("call", "bar2").first(); +const bar2TimeVar = timer.time($call); +let logger = new Logger(); +logger + .text("I want to print the value of the elapsed time (") + .double(bar2TimeVar) + .text( + "), which is in the unit '" + + timer.getUnit().getUnitsString() + + "' and put other stuff after it" + ) + .ln() + .log(timer.getAfterJp()); + +// Enable printing again +timer.setPrint(true); + +$call = Query.search("call", "bar3").first(); +timer.time($call); +logger = new Logger(); +logger + .text("This should appear after the timer print") + .ln() + .log(timer.getAfterJp()); + +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/api/ToSingleFile.js b/ClavaWeaver/resources/clava/test/api/ToSingleFile.js index bdcbed5c42..749b75c036 100644 --- a/ClavaWeaver/resources/clava/test/api/ToSingleFile.js +++ b/ClavaWeaver/resources/clava/test/api/ToSingleFile.js @@ -1,3 +1,3 @@ -laraImport("clava.ClavaCode"); +import ClavaCode from "@specs-feup/clava/api/clava/ClavaCode.js"; -println(ClavaCode.toSingleFileCode()); +console.log(ClavaCode.toSingleFileCode()); diff --git a/ClavaWeaver/resources/clava/test/api/UserValuesTest.js b/ClavaWeaver/resources/clava/test/api/UserValuesTest.js new file mode 100644 index 0000000000..edf7467388 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/UserValuesTest.js @@ -0,0 +1,33 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import { printObject } from "@specs-feup/lara/api/core/output.js"; + +let $program = Clava.getProgram(); + +$program.setUserField("test", "test string"); +console.log("User field: " + $program.getUserField("test")); + +let anArray = ["Hello", "World"]; +$program.setUserField("anArray", anArray); + +const aMap = { field1: "field1_value", field2: 2 }; +$program.setUserField("aMap", JSON.stringify(aMap)); + +Clava.pushAst(); + +$program = Clava.getProgram(); +console.log("User field after push: " + $program.getUserField("test")); +console.log("Array after push:"); +printObject($program.getUserField("anArray")); +console.log("\nMap after push:"); +printObject(JSON.parse($program.getUserField("aMap"))); +console.log(); +// Changes array +anArray = $program.getUserField("anArray"); +anArray.push("pushed"); +$program.setUserField("anArray", anArray); + +Clava.popAst(); + +$program = Clava.getProgram(); +console.log("Array after pop:"); +printObject($program.getUserField("anArray")); diff --git a/ClavaWeaver/resources/clava/test/api/UserValuesTest.lara b/ClavaWeaver/resources/clava/test/api/UserValuesTest.lara deleted file mode 100644 index 790b26d2cc..0000000000 --- a/ClavaWeaver/resources/clava/test/api/UserValuesTest.lara +++ /dev/null @@ -1,50 +0,0 @@ -import clava.Clava; - -aspectdef UserValues - - select program end - apply - // Previous way of using userField - $program.setUserField("test", "test string"); - // Deprecated get - println("User field: " + $program.getUserField("test")); - - // Now this is also supported - $program.setUserField("test", "test string 2"); - println("User field: " + $program.getUserField("test")); - - var anArray = ["Hello", "World"]; - $program.setUserField("anArray", anArray); - - var aMap = {"field1" : "field1_value", "field2" : 2}; - $program.setUserField("aMap", aMap); - end - - Clava.pushAst(); - - select program end - apply - println("User field after push: " + $program.getUserField("test")); - println("Array after push:"); - printObject($program.getUserField("anArray")); - println("\nMap after push:"); - printObject($program.getUserField("aMap")); - println(); - // Changes array - var anArray = $program.getUserField("anArray"); - anArray.push("pushed"); - $program.setUserField("anArray", anArray); - end - - Clava.popAst(); - - select program end - apply - println("Array after pop:"); - printObject($program.getUserField("anArray")); - end - - //println("PROGRAM:" + Clava.getProgram().extraIncludes); - //println("Standard:" + Clava.getStandard()); -end - diff --git a/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.js b/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.js new file mode 100644 index 0000000000..7a754581fc --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.js @@ -0,0 +1,5 @@ +import WeaverLauncher from "@specs-feup/clava/api/weaver/WeaverLauncher.js"; + +const weaverLauncher = new WeaverLauncher("cxx"); +const weaverResult = weaverLauncher.execute("--help"); +console.log("result:" + weaverResult); diff --git a/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.lara b/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.lara deleted file mode 100644 index 9ad285197b..0000000000 --- a/ClavaWeaver/resources/clava/test/api/WeaverLauncherTest.lara +++ /dev/null @@ -1,8 +0,0 @@ -import weaver.WeaverLauncher; - -aspectdef WeaverLauncherTest - - var weaverLauncher = new WeaverLauncher("cxx"); - var weaverResult = weaverLauncher.execute("--help"); - println("result:" + weaverResult); -end diff --git a/ClavaWeaver/resources/clava/test/api/c/results/ArrayLinearizerTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/ArrayLinearizerTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/ArrayLinearizerTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/ArrayLinearizerTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/AutoParBtTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/AutoParBtTest.lara.txt deleted file mode 100644 index 972a47de4e..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/results/AutoParBtTest.lara.txt +++ /dev/null @@ -1,92 +0,0 @@ -Parallelizing 179 for loops... -Parallelization finished -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m, zeta, eta, xi, add) firstprivate(dnzm1, dnym1, dnxm1, u_exact) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m, eta, xi, add) firstprivate(dnym1, dnxm1, zeta, k, u_exact) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi, add) firstprivate(dnxm1, zeta, eta, k, j, u_exact) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m, add) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m, add) firstprivate(k) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, add) firstprivate(k, j) reduction(+ : rms[:5]) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m, zeta, eta, xi, dtpp, im1, ip1) firstprivate(dnzm1, dnym1, dnxm1, tx2, dx1tx1, c2, xxcon1, dx2tx1, xxcon2, dx3tx1, dx4tx1, c1, xxcon3, xxcon4, xxcon5, dx5tx1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m, eta, xi, dtpp, im1, ip1) firstprivate(dnym1, dnxm1, zeta, tx2, k, dx1tx1, c2, xxcon1, dx2tx1, xxcon2, dx3tx1, dx4tx1, c1, xxcon3, xxcon4, xxcon5, dx5tx1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi, dtpp) firstprivate(dnxm1, zeta, eta, dtemp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, im1, ip1) firstprivate(tx2, k, j, dx1tx1, c2, xxcon1, dx2tx1, xxcon2, dx3tx1, dx4tx1, c1, xxcon3, xxcon4, xxcon5, dx5tx1) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(dssp, k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, i, j, m, zeta, xi, eta, dtpp, jm1, jp1) firstprivate(dnzm1, dnxm1, dnym1, ty2, dy1ty1, yycon2, dy2ty1, c2, yycon1, dy3ty1, dy4ty1, c1, yycon3, yycon4, yycon5, dy5ty1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, j, m, xi, eta, dtpp, jm1, jp1) firstprivate(dnxm1, dnym1, zeta, ty2, k, dy1ty1, yycon2, dy2ty1, c2, yycon1, dy3ty1, dy4ty1, c1, yycon3, yycon4, yycon5, dy5ty1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m, eta, dtpp) firstprivate(dnym1, zeta, xi, dtemp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, jm1, jp1) firstprivate(ty2, k, i, dy1ty1, yycon2, dy2ty1, c2, yycon1, dy3ty1, dy4ty1, c1, yycon3, yycon4, yycon5, dy5ty1) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m) firstprivate(dssp, k, i) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, k, m, eta, xi, zeta, dtpp, km1, kp1) firstprivate(dnym1, dnxm1, dnzm1, tz2, dz1tz1, zzcon2, dz2tz1, dz3tz1, c2, zzcon1, dz4tz1, c1, zzcon3, zzcon4, zzcon5, dz5tz1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, k, m, xi, zeta, dtpp, km1, kp1) firstprivate(dnxm1, dnzm1, eta, tz2, j, dz1tz1, zzcon2, dz2tz1, dz3tz1, c2, zzcon1, dz4tz1, c1, zzcon3, zzcon4, zzcon5, dz5tz1, dssp, dtemp, ue, buf, cuf, q) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, m, zeta, dtpp) firstprivate(dnzm1, eta, xi, dtemp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, km1, kp1) firstprivate(tz2, j, i, dz1tz1, zzcon2, dz2tz1, dz3tz1, c2, zzcon1, dz4tz1, c1, zzcon3, zzcon4, zzcon5, dz5tz1) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, m) firstprivate(dssp, j, i) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, m, zeta, eta) firstprivate(dnzm1, dnym1, xi, i, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m, eta) firstprivate(dnym1, zeta, xi, k, i, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, m, zeta, eta) firstprivate(dnzm1, dnym1, xi, i, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m, eta) firstprivate(dnym1, zeta, xi, k, i, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, i, m, zeta, xi) firstprivate(dnzm1, dnxm1, eta, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi) firstprivate(dnxm1, zeta, eta, k, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, i, m, zeta, xi) firstprivate(dnzm1, dnxm1, eta, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi) firstprivate(dnxm1, zeta, eta, k, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m, eta, xi) firstprivate(dnym1, dnxm1, zeta, k, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi) firstprivate(dnxm1, zeta, eta, k, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m, eta, xi) firstprivate(dnym1, dnxm1, zeta, k, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m, xi) firstprivate(dnxm1, zeta, eta, k, j, temp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, rho_inv) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, rho_inv) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, rho_inv) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m, uijk, up1, um1) firstprivate(dx1tx1, tx2, c2, dx2tx1, xxcon2, con43, dx3tx1, dx4tx1, c1, dx5tx1, xxcon3, xxcon4, xxcon5, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, uijk, up1, um1) firstprivate(k, dx1tx1, tx2, c2, dx2tx1, xxcon2, con43, dx3tx1, dx4tx1, c1, dx5tx1, xxcon3, xxcon4, xxcon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, uijk, up1, um1) firstprivate(k, j, dx1tx1, tx2, c2, dx2tx1, xxcon2, con43, dx3tx1, dx4tx1, c1, dx5tx1, xxcon3, xxcon4, xxcon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m, i) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, m, i) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m, vijk, vp1, vm1) firstprivate(dy1ty1, ty2, dy2ty1, yycon2, c2, dy3ty1, con43, dy4ty1, c1, dy5ty1, yycon3, yycon4, yycon5, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, vijk, vp1, vm1) firstprivate(k, dy1ty1, ty2, dy2ty1, yycon2, c2, dy3ty1, con43, dy4ty1, c1, dy5ty1, yycon3, yycon4, yycon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, vijk, vp1, vm1) firstprivate(k, j, dy1ty1, ty2, dy2ty1, yycon2, c2, dy3ty1, con43, dy4ty1, c1, dy5ty1, yycon3, yycon4, yycon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(j, k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(j, k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(j, k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(j, k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(j, k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, wijk, wp1, wm1) firstprivate(dz1tz1, tz2, dz2tz1, zzcon2, dz3tz1, c2, dz4tz1, con43, c1, dz5tz1, zzcon3, zzcon4, zzcon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, wijk, wp1, wm1) firstprivate(k, dz1tz1, tz2, dz2tz1, zzcon2, dz3tz1, c2, dz4tz1, con43, c1, dz5tz1, zzcon3, zzcon4, zzcon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, wijk, wp1, wm1) firstprivate(k, j, dz1tz1, tz2, dz2tz1, zzcon2, dz3tz1, c2, dz4tz1, con43, c1, dz5tz1, zzcon3, zzcon4, zzcon5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) firstprivate(dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dssp) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, j, i, m) firstprivate(dt) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, i, m) firstprivate(k, dt) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, m) firstprivate(k, j, dt) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, tmp1, tmp2, tmp3) firstprivate(isize, k, j, c2, c1, con43, c3c4, c1345) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(i, tmp1, tmp2) firstprivate(isize, dt, tx1, tx2, dx1, dx2, dx3, dx4, dx5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, tmp1, tmp2, tmp3) firstprivate(jsize, k, i, c2, c1, c3c4, con43, c1345) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(j, tmp1, tmp2) firstprivate(jsize, dt, ty1, ty2, dy1, dy2, dy3, dy4, dy5) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, tmp1, tmp2, tmp3) firstprivate(ksize, j, i, c2, c1, c3c4, con43, c3, c4, c1345) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) private(k, tmp1, tmp2) firstprivate(ksize, dt, tz1, tz2, dz1, dz2, dz3, dz4, dz5) \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/c/results/AutoParInlineTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/AutoParInlineTest.lara.txt deleted file mode 100644 index afddafbf11..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/results/AutoParInlineTest.lara.txt +++ /dev/null @@ -1,29 +0,0 @@ -Code: -/**** File 'autopar_inline.c' ****/ - -int bar() { - int a = 0; - for(int i = 0; i < 10; i++) { - a++; - } - - return a; -} - -int foo() { - int a = 0; - for(int i = 0; i < 10; i++) { - // Variable that may already after inline renaming - int i_1 = 1; - int a_NaN = 0; - for(int i_NaN = 0; i_NaN < 10; i_NaN++) { - a_NaN++; - } - a += a_NaN; - // ClavaInlineFunction : a += bar(); countCallInlinedFunction : NaN - } - - return a; -} - -/**** End File ****/ diff --git a/ClavaWeaver/resources/clava/test/api/c/results/AutoParTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/AutoParTest.lara.txt deleted file mode 100644 index 5c49873254..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/results/AutoParTest.lara.txt +++ /dev/null @@ -1,5 +0,0 @@ -Parallelizing 4 for loops... -Parallelization finished -Inserted OpenMP pragma: #pragma omp parallel for default(shared) firstprivate(numIter) reduction(+ : a) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) reduction(+ : a) -Inserted OpenMP pragma: #pragma omp parallel for default(shared) \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/c/results/EnergyTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/EnergyTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/EnergyTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/EnergyTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/HlsTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/HlsTest.lara.txt deleted file mode 100644 index 9a7d4728ac..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/results/HlsTest.lara.txt +++ /dev/null @@ -1,14 +0,0 @@ -function --> test4_Kernel -/**** File 'hls.c' ****/ - -int * test4_KernelCode(char g[], int h) { - - return 0; -} - -void test4_Kernel(char g[], int h, int **kernelReturn) { - #pragma HLS array_partition variable=g complete - *kernelReturn = test4_KernelCode(g, h); -} - -/**** End File ****/ \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/c/results/InlinerTest.js.macos.txt b/ClavaWeaver/resources/clava/test/api/c/results/InlinerTest.js.macos.txt new file mode 100644 index 0000000000..d4cf4307ba --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/c/results/InlinerTest.js.macos.txt @@ -0,0 +1,561 @@ +int main() { + int A[100] = {1}; + int B[100] = {2}; + int C[100] = {3}; + { + int __inline_0_x; + __inline_0_x = 500; + int *__inline_0_X; + __inline_0_X = A; + int *__inline_0_Y; + __inline_0_Y = B; + { + { + int __inline_0_i; + __inline_0_i = 0; + int __inline_0_decomp_0; + __inline_0_decomp_0 = __inline_0_i < 100; + while(__inline_0_decomp_0) { + __inline_0_X[__inline_0_i] = __inline_0_Y[__inline_0_i] * __inline_0_x; + __inline_0_i++; + __inline_0_decomp_0 = __inline_0_i < 100; + } + } + } + } + int x; + { + int *__inline_3_X; + __inline_3_X = B; + int *__inline_3_Y; + __inline_3_Y = C; + { + { + int __inline_3_i; + __inline_3_i = 0; + int __inline_3_decomp_1; + __inline_3_decomp_1 = __inline_3_i < 100; + while(__inline_3_decomp_1) { + __inline_3_X[__inline_3_i] = __inline_3_X[__inline_3_i] * __inline_3_Y[__inline_3_i]; + __inline_3_i++; + __inline_3_decomp_1 = __inline_3_i < 100; + } + } + { + int __inline_3_i; + __inline_3_i = 0; + int __inline_3_decomp_2; + __inline_3_decomp_2 = __inline_3_i < 100; + while(__inline_3_decomp_2) { + __inline_3_Y[__inline_3_i] = __inline_3_X[__inline_3_i] + __inline_3_Y[__inline_3_i]; + { + int __inline_3___inline_1_x; + __inline_3___inline_1_x = __inline_3_Y[__inline_3_i]; + { + int __inline_3___inline_1_decomp_9; + __inline_3___inline_1_decomp_9 = __inline_3___inline_1_x * __inline_3___inline_1_x; + int __inline_3___inline_1_decomp_10; + __inline_3___inline_1_decomp_10 = __inline_3___inline_1_decomp_9 * __inline_3___inline_1_x; + __inline_3_Y[__inline_3_i] = __inline_3___inline_1_decomp_10; + } + } + __inline_3_i++; + __inline_3_decomp_2 = __inline_3_i < 100; + } + } + { + int __inline_3_i; + __inline_3_i = 0; + int __inline_3_decomp_3; + __inline_3_decomp_3 = __inline_3_i < 100; + while(__inline_3_decomp_3) { + __inline_3_Y[__inline_3_i] = __inline_3_X[__inline_3_i] * __inline_3_Y[__inline_3_i]; + { + int __inline_3___inline_2_x; + __inline_3___inline_2_x = __inline_3_Y[__inline_3_i]; + { + int __inline_3___inline_2_decomp_9; + __inline_3___inline_2_decomp_9 = __inline_3___inline_2_x * __inline_3___inline_2_x; + int __inline_3___inline_2_decomp_10; + __inline_3___inline_2_decomp_10 = __inline_3___inline_2_decomp_9 * __inline_3___inline_2_x; + __inline_3_Y[__inline_3_i] = __inline_3___inline_2_decomp_10; + } + } + __inline_3_i++; + __inline_3_decomp_3 = __inline_3_i < 100; + } + } + int __inline_3_decomp_11; + __inline_3_decomp_11 = __inline_3_X[0] + __inline_3_Y[0]; + x = __inline_3_decomp_11; + } + } + { + int ii; + ii = 0; + int decomp_4; + decomp_4 = ii < 100; + while(decomp_4) { + ii++; + decomp_4 = ii < 100; + } + } + { + int i; + i = 0; + int decomp_6; + decomp_6 = i < 100; + while(decomp_6) { + { + int j; + j = 0; + int decomp_5; + decomp_5 = j < 100; + while(decomp_5) { + int y; + y = x + A[0]; + { + int __inline_7_x; + __inline_7_x = x; + int __inline_7_y; + __inline_7_y = y; + int *__inline_7_X; + __inline_7_X = C; + { + { + int *__inline_7___inline_4_X; + __inline_7___inline_4_X = __inline_7_X; + int *__inline_7___inline_4_Y; + __inline_7___inline_4_Y = __inline_7_X; + { + { + int __inline_7___inline_4_i; + __inline_7___inline_4_i = 0; + int __inline_7___inline_4_decomp_1; + __inline_7___inline_4_decomp_1 = __inline_7___inline_4_i < 100; + while(__inline_7___inline_4_decomp_1) { + __inline_7___inline_4_X[__inline_7___inline_4_i] = __inline_7___inline_4_X[__inline_7___inline_4_i] * __inline_7___inline_4_Y[__inline_7___inline_4_i]; + __inline_7___inline_4_i++; + __inline_7___inline_4_decomp_1 = __inline_7___inline_4_i < 100; + } + } + { + int __inline_7___inline_4_i; + __inline_7___inline_4_i = 0; + int __inline_7___inline_4_decomp_2; + __inline_7___inline_4_decomp_2 = __inline_7___inline_4_i < 100; + while(__inline_7___inline_4_decomp_2) { + __inline_7___inline_4_Y[__inline_7___inline_4_i] = __inline_7___inline_4_X[__inline_7___inline_4_i] + __inline_7___inline_4_Y[__inline_7___inline_4_i]; + { + int __inline_7___inline_4___inline_1_x; + __inline_7___inline_4___inline_1_x = __inline_7___inline_4_Y[__inline_7___inline_4_i]; + { + int __inline_7___inline_4___inline_1_decomp_9; + __inline_7___inline_4___inline_1_decomp_9 = __inline_7___inline_4___inline_1_x * __inline_7___inline_4___inline_1_x; + int __inline_7___inline_4___inline_1_decomp_10; + __inline_7___inline_4___inline_1_decomp_10 = __inline_7___inline_4___inline_1_decomp_9 * __inline_7___inline_4___inline_1_x; + __inline_7___inline_4_Y[__inline_7___inline_4_i] = __inline_7___inline_4___inline_1_decomp_10; + } + } + __inline_7___inline_4_i++; + __inline_7___inline_4_decomp_2 = __inline_7___inline_4_i < 100; + } + } + { + int __inline_7___inline_4_i; + __inline_7___inline_4_i = 0; + int __inline_7___inline_4_decomp_3; + __inline_7___inline_4_decomp_3 = __inline_7___inline_4_i < 100; + while(__inline_7___inline_4_decomp_3) { + __inline_7___inline_4_Y[__inline_7___inline_4_i] = __inline_7___inline_4_X[__inline_7___inline_4_i] * __inline_7___inline_4_Y[__inline_7___inline_4_i]; + { + int __inline_7___inline_4___inline_2_x; + __inline_7___inline_4___inline_2_x = __inline_7___inline_4_Y[__inline_7___inline_4_i]; + { + int __inline_7___inline_4___inline_2_decomp_9; + __inline_7___inline_4___inline_2_decomp_9 = __inline_7___inline_4___inline_2_x * __inline_7___inline_4___inline_2_x; + int __inline_7___inline_4___inline_2_decomp_10; + __inline_7___inline_4___inline_2_decomp_10 = __inline_7___inline_4___inline_2_decomp_9 * __inline_7___inline_4___inline_2_x; + __inline_7___inline_4_Y[__inline_7___inline_4_i] = __inline_7___inline_4___inline_2_decomp_10; + } + } + __inline_7___inline_4_i++; + __inline_7___inline_4_decomp_3 = __inline_7___inline_4_i < 100; + } + } + int __inline_7___inline_4_decomp_11; + __inline_7___inline_4_decomp_11 = __inline_7___inline_4_X[0] + __inline_7___inline_4_Y[0]; + } + } + int __inline_7_decomp_12; + { + int __inline_7___inline_5_x; + __inline_7___inline_5_x = __inline_7_x; + { + int __inline_7___inline_5_decomp_9; + __inline_7___inline_5_decomp_9 = __inline_7___inline_5_x * __inline_7___inline_5_x; + int __inline_7___inline_5_decomp_10; + __inline_7___inline_5_decomp_10 = __inline_7___inline_5_decomp_9 * __inline_7___inline_5_x; + __inline_7_decomp_12 = __inline_7___inline_5_decomp_10; + } + } + int __inline_7_decomp_13; + { + int __inline_7___inline_6_x; + __inline_7___inline_6_x = __inline_7_y; + { + int __inline_7___inline_6_decomp_9; + __inline_7___inline_6_decomp_9 = __inline_7___inline_6_x * __inline_7___inline_6_x; + int __inline_7___inline_6_decomp_10; + __inline_7___inline_6_decomp_10 = __inline_7___inline_6_decomp_9 * __inline_7___inline_6_x; + __inline_7_decomp_13 = __inline_7___inline_6_decomp_10; + } + } + int __inline_7_decomp_14; + __inline_7_decomp_14 = __inline_7_decomp_12 + __inline_7_decomp_13; + int __inline_7_decomp_15; + __inline_7_decomp_15 = __inline_7_decomp_14 + __inline_7_X[6]; + } + } + { + int __inline_8_x; + __inline_8_x = y; + int __inline_8_y; + __inline_8_y = x; + int *__inline_8_X; + __inline_8_X = C; + { + { + int *__inline_8___inline_4_X; + __inline_8___inline_4_X = __inline_8_X; + int *__inline_8___inline_4_Y; + __inline_8___inline_4_Y = __inline_8_X; + { + { + int __inline_8___inline_4_i; + __inline_8___inline_4_i = 0; + int __inline_8___inline_4_decomp_1; + __inline_8___inline_4_decomp_1 = __inline_8___inline_4_i < 100; + while(__inline_8___inline_4_decomp_1) { + __inline_8___inline_4_X[__inline_8___inline_4_i] = __inline_8___inline_4_X[__inline_8___inline_4_i] * __inline_8___inline_4_Y[__inline_8___inline_4_i]; + __inline_8___inline_4_i++; + __inline_8___inline_4_decomp_1 = __inline_8___inline_4_i < 100; + } + } + { + int __inline_8___inline_4_i; + __inline_8___inline_4_i = 0; + int __inline_8___inline_4_decomp_2; + __inline_8___inline_4_decomp_2 = __inline_8___inline_4_i < 100; + while(__inline_8___inline_4_decomp_2) { + __inline_8___inline_4_Y[__inline_8___inline_4_i] = __inline_8___inline_4_X[__inline_8___inline_4_i] + __inline_8___inline_4_Y[__inline_8___inline_4_i]; + { + int __inline_8___inline_4___inline_1_x; + __inline_8___inline_4___inline_1_x = __inline_8___inline_4_Y[__inline_8___inline_4_i]; + { + int __inline_8___inline_4___inline_1_decomp_9; + __inline_8___inline_4___inline_1_decomp_9 = __inline_8___inline_4___inline_1_x * __inline_8___inline_4___inline_1_x; + int __inline_8___inline_4___inline_1_decomp_10; + __inline_8___inline_4___inline_1_decomp_10 = __inline_8___inline_4___inline_1_decomp_9 * __inline_8___inline_4___inline_1_x; + __inline_8___inline_4_Y[__inline_8___inline_4_i] = __inline_8___inline_4___inline_1_decomp_10; + } + } + __inline_8___inline_4_i++; + __inline_8___inline_4_decomp_2 = __inline_8___inline_4_i < 100; + } + } + { + int __inline_8___inline_4_i; + __inline_8___inline_4_i = 0; + int __inline_8___inline_4_decomp_3; + __inline_8___inline_4_decomp_3 = __inline_8___inline_4_i < 100; + while(__inline_8___inline_4_decomp_3) { + __inline_8___inline_4_Y[__inline_8___inline_4_i] = __inline_8___inline_4_X[__inline_8___inline_4_i] * __inline_8___inline_4_Y[__inline_8___inline_4_i]; + { + int __inline_8___inline_4___inline_2_x; + __inline_8___inline_4___inline_2_x = __inline_8___inline_4_Y[__inline_8___inline_4_i]; + { + int __inline_8___inline_4___inline_2_decomp_9; + __inline_8___inline_4___inline_2_decomp_9 = __inline_8___inline_4___inline_2_x * __inline_8___inline_4___inline_2_x; + int __inline_8___inline_4___inline_2_decomp_10; + __inline_8___inline_4___inline_2_decomp_10 = __inline_8___inline_4___inline_2_decomp_9 * __inline_8___inline_4___inline_2_x; + __inline_8___inline_4_Y[__inline_8___inline_4_i] = __inline_8___inline_4___inline_2_decomp_10; + } + } + __inline_8___inline_4_i++; + __inline_8___inline_4_decomp_3 = __inline_8___inline_4_i < 100; + } + } + int __inline_8___inline_4_decomp_11; + __inline_8___inline_4_decomp_11 = __inline_8___inline_4_X[0] + __inline_8___inline_4_Y[0]; + } + } + int __inline_8_decomp_12; + { + int __inline_8___inline_5_x; + __inline_8___inline_5_x = __inline_8_x; + { + int __inline_8___inline_5_decomp_9; + __inline_8___inline_5_decomp_9 = __inline_8___inline_5_x * __inline_8___inline_5_x; + int __inline_8___inline_5_decomp_10; + __inline_8___inline_5_decomp_10 = __inline_8___inline_5_decomp_9 * __inline_8___inline_5_x; + __inline_8_decomp_12 = __inline_8___inline_5_decomp_10; + } + } + int __inline_8_decomp_13; + { + int __inline_8___inline_6_x; + __inline_8___inline_6_x = __inline_8_y; + { + int __inline_8___inline_6_decomp_9; + __inline_8___inline_6_decomp_9 = __inline_8___inline_6_x * __inline_8___inline_6_x; + int __inline_8___inline_6_decomp_10; + __inline_8___inline_6_decomp_10 = __inline_8___inline_6_decomp_9 * __inline_8___inline_6_x; + __inline_8_decomp_13 = __inline_8___inline_6_decomp_10; + } + } + int __inline_8_decomp_14; + __inline_8_decomp_14 = __inline_8_decomp_12 + __inline_8_decomp_13; + int __inline_8_decomp_15; + __inline_8_decomp_15 = __inline_8_decomp_14 + __inline_8_X[6]; + } + } + j++; + decomp_5 = j < 100; + } + } + i++; + decomp_6 = i < 100; + } + } + int sumA; + sumA = 0; + int sumB; + sumB = 0; + int sumC; + sumC = 0; + { + int i; + i = 0; + int decomp_7; + decomp_7 = i < 100; + while(decomp_7) { + sumA = sumA + A[i]; + sumB = sumB + B[i]; + sumC = sumC + C[i]; + i++; + decomp_7 = i < 100; + } + } + + return A[2]; +} + +# Test inline of successive calls +int inlineTest2() { + int a; + a = 0; + int b; + { + int __inline_0_i; + __inline_0_i = a; + { + int __inline_0___return_value; + int __inline_0_decomp_8; + __inline_0_decomp_8 = __inline_0_i == 0; + if(__inline_0_decomp_8) { + __inline_0___return_value = 1; + goto inliner_3___return_label; + } + __inline_0___return_value = 2; + goto inliner_3___return_label; + inliner_3___return_label: + b = __inline_0___return_value; + } + } + a = b; + { + int __inline_1_i; + __inline_1_i = a; + { + int __inline_1___return_value; + int __inline_1_decomp_8; + __inline_1_decomp_8 = __inline_1_i == 0; + if(__inline_1_decomp_8) { + __inline_1___return_value = 1; + goto inliner_0___return_label; + } + __inline_1___return_value = 2; + goto inliner_0___return_label; + inliner_0___return_label: + b = __inline_1___return_value; + } + } + a = b; + + return a; +} + +void arrayParam() { + int a[32]; + int b; + { + int __inline_2_decomp_17; + { + int __inline_2___inline_1_decomp_16; + { + __inline_2___inline_1_decomp_16 = a[0]; + } + __inline_2_decomp_17 = __inline_2___inline_1_decomp_16; + } + b = __inline_2_decomp_17; + } +} + +int functionThatCallsFunctionThatUsesGlobal() { + int decomp_18; + { + decomp_18 = globalVar[0]; + } + + return decomp_18; +} + +void functionThatCallsFunctionWithReturnButsDoesNotUseResult() { + { + int __inline_0_a; + __inline_0_a = 10; + { + int __inline_0___return_value; + if(__inline_0_a) { + __inline_0___return_value = 1; + goto __return_label; + } + __inline_0___return_value = 0; + goto __return_label; + __return_label: + ; + } + } +} + +int functionWithNakedIf(int a) { + int b; + b = 0; + if(a) + { + b = 1; + // This is a comment + } + + return b; +} + +double functionWhichCallIsNotDeclared() { + double decomp_19; + { + int __inline_0_a; + __inline_0_a = 10; + { + double __inline_0_decomp_21; + __inline_0_decomp_21 = functionCalledByOtherFunction(__inline_0_a); + double __inline_0_decomp_22; + __inline_0_decomp_22 = functionCalledByOtherFunction(__inline_0_a); + double __inline_0_decomp_23; + __inline_0_decomp_23 = __inline_0_decomp_21 + __inline_0_decomp_22; + decomp_19 = __inline_0_decomp_23; + } + } + + return decomp_19; +} + +double functionThatCallsOtherWithVarInStruct() { + a_struct b; + double decomp_24; + { + a_struct __inline_0_a; + __inline_0_a = b; + { + double __inline_0_m; + __inline_0_m = 10; + __inline_0_a = (a_struct){__inline_0_m, 20}; + decomp_24 = __inline_0_a.a; + } + } + + return decomp_24; +} + +void functionThatCallsFunctionWithStruct(void *ox2) { + int n2; + n2 = 3; + int xd2; + xd2 = 2; + a_struct exponent2[3]; + { + int __inline_0_n; + __inline_0_n = n2; + int __inline_0_xd1; + __inline_0_xd1 = xd2; + void *__inline_0_ox; + __inline_0_ox = ox2; + { + a_struct (*__inline_0_x)[__inline_0_xd1]; + __inline_0_x = (a_struct (*)[__inline_0_xd1]) __inline_0_ox; + } + } +} + +void functionThatCallFunctionWith2DimPointer(void *os) { + { + void *__inline_0_os; + __inline_0_os = os; + int __inline_0_n; + __inline_0_n = 10; + int __inline_0_m; + __inline_0_m = 20; + { + double (*__inline_0_r)[__inline_0_n][__inline_0_m]; + __inline_0_r = (double (*)[__inline_0_n][__inline_0_m]) __inline_0_os; + } + } +} + +int functionWithCallWithStatic() { + printf("a"); + char size[16]; + __builtin___sprintf_chk(size, 0, __builtin_object_size(size, 2 > 1 ? 1 : 0), "%15.0lf", 4000.0); + int decomp_25; + { + functionWithStatic_static_x++; + decomp_25 = functionWithStatic_static_x; + } + + return decomp_25; +} + +int callsFunctionWithLabels() { + int a; + a = 0; + { + int __inline_0_a; + __inline_0_a = 0; + goto inliner_11_a_label; + __inline_0_a = __inline_0_a + 20; + inliner_11_a_label: + __inline_0_a = __inline_0_a + 10; + a = __inline_0_a; + } + { + int __inline_1_a; + __inline_1_a = 0; + goto inliner_5_a_label; + __inline_1_a = __inline_1_a + 20; + inliner_5_a_label: + __inline_1_a = __inline_1_a + 10; + a = __inline_1_a; + } + + return a; +} diff --git a/ClavaWeaver/resources/clava/test/api/c/results/LoggerTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/LoggerTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/LoggerTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/LoggerTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/SelectorTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/SelectorTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/SelectorTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/SelectorTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/SerializeNode.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/SerializeNode.lara.txt deleted file mode 100644 index eaba234f6f..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/results/SerializeNode.lara.txt +++ /dev/null @@ -1,3 +0,0 @@ -void foo() { - printf("Hello\n"); -} \ No newline at end of file diff --git a/ClavaWeaver/run/weaver/dummy b/ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.js.macos.txt similarity index 100% rename from ClavaWeaver/run/weaver/dummy rename to ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.js.macos.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/StrcpyChecker.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/TimerTest.lara.txt b/ClavaWeaver/resources/clava/test/api/c/results/TimerTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/TimerTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/c/results/TimerTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/TimerTest.lara.unix.txt b/ClavaWeaver/resources/clava/test/api/c/results/TimerTest.js.unix.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/c/results/TimerTest.lara.unix.txt rename to ClavaWeaver/resources/clava/test/api/c/results/TimerTest.js.unix.txt diff --git a/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.txt b/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.txt new file mode 100644 index 0000000000..3be9d3dec0 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.txt @@ -0,0 +1,57 @@ +#include +#include +#include +double bar() { + + return 1.0; +} +double bar2() { + + return 1.0; +} +double bar3() { + + return 1.0; +} +double foo() { + double a = 0; + for(int i = 0; i < 1000; i++) { + LARGE_INTEGER clava_timing_start_4, clava_timing_end_4, clava_timing_frequency_4; + QueryPerformanceFrequency(&clava_timing_frequency_4); + double clava_timing_duration_4; + QueryPerformanceCounter(&clava_timing_start_4); + a += bar(); + QueryPerformanceCounter(&clava_timing_end_4); + clava_timing_duration_4 = ((clava_timing_end_4.QuadPart - clava_timing_start_4.QuadPart) / (double)clava_timing_frequency_4.QuadPart) * (1000); + printf("Time:%fms\n", clava_timing_duration_4); + } + + return a; +} +int main() { + LARGE_INTEGER clava_timing_start_5, clava_timing_end_5, clava_timing_frequency_5; + QueryPerformanceFrequency(&clava_timing_frequency_5); + double clava_timing_duration_5; + QueryPerformanceCounter(&clava_timing_start_5); + foo(); + QueryPerformanceCounter(&clava_timing_end_5); + clava_timing_duration_5 = ((clava_timing_end_5.QuadPart - clava_timing_start_5.QuadPart) / (double)clava_timing_frequency_5.QuadPart) * (1000); + printf("Time:%fms\n", clava_timing_duration_5); + LARGE_INTEGER clava_timing_start_6, clava_timing_end_6, clava_timing_frequency_6; + QueryPerformanceFrequency(&clava_timing_frequency_6); + double clava_timing_duration_6; + QueryPerformanceCounter(&clava_timing_start_6); + bar2(); + QueryPerformanceCounter(&clava_timing_end_6); + clava_timing_duration_6 = ((clava_timing_end_6.QuadPart - clava_timing_start_6.QuadPart) / (double)clava_timing_frequency_6.QuadPart) * (1000); + printf("I want to print the value of the elapsed time (%f), which is in the unit 'ms' and put other stuff after it\n", clava_timing_duration_6); + LARGE_INTEGER clava_timing_start_7, clava_timing_end_7, clava_timing_frequency_7; + QueryPerformanceFrequency(&clava_timing_frequency_7); + double clava_timing_duration_7; + QueryPerformanceCounter(&clava_timing_start_7); + bar3(); + QueryPerformanceCounter(&clava_timing_end_7); + clava_timing_duration_7 = ((clava_timing_end_7.QuadPart - clava_timing_start_7.QuadPart) / (double)clava_timing_frequency_7.QuadPart) * (1000); + printf("%fms\n", clava_timing_duration_7); + printf("This should appear after the timer print\n"); +} diff --git a/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.unix.txt b/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.unix.txt new file mode 100644 index 0000000000..5c872c70aa --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/c/results/TimerTestWithCxxFlag.js.unix.txt @@ -0,0 +1,59 @@ +#define _POSIX_C_SOURCE 199309L +#include +#include + +double bar() { + + return 1.0; +} + +double bar2() { + return 1.0; +} + +double bar3() { + return 1.0; +} + +double foo() { + double a = 0; + for(int i = 0; i < 1000; i++) { + struct timespec clava_timing_start_4, clava_timing_end_4; + double clava_timing_duration_4; + clock_gettime(CLOCK_MONOTONIC, &clava_timing_start_4); + a += bar(); + clock_gettime(CLOCK_MONOTONIC, &clava_timing_end_4); + clava_timing_duration_4 = ((clava_timing_end_4.tv_sec + ((double) clava_timing_end_4.tv_nsec / 1000000000)) - (clava_timing_start_4.tv_sec + ((double) clava_timing_start_4.tv_nsec / 1000000000))) * (1000); + printf("Time:%fms\n", clava_timing_duration_4); + } + + return a; +} + + +int main() { + struct timespec clava_timing_start_5, clava_timing_end_5; + double clava_timing_duration_5; + clock_gettime(CLOCK_MONOTONIC, &clava_timing_start_5); + foo(); + clock_gettime(CLOCK_MONOTONIC, &clava_timing_end_5); + clava_timing_duration_5 = ((clava_timing_end_5.tv_sec + ((double) clava_timing_end_5.tv_nsec / 1000000000)) - (clava_timing_start_5.tv_sec + ((double) clava_timing_start_5.tv_nsec / 1000000000))) * (1000); + printf("Time:%fms\n", clava_timing_duration_5); + + struct timespec clava_timing_start_6, clava_timing_end_6; + double clava_timing_duration_6; + clock_gettime(CLOCK_MONOTONIC, &clava_timing_start_6); + bar2(); + clock_gettime(CLOCK_MONOTONIC, &clava_timing_end_6); + clava_timing_duration_6 = ((clava_timing_end_6.tv_sec + ((double) clava_timing_end_6.tv_nsec / 1000000000)) - (clava_timing_start_6.tv_sec + ((double) clava_timing_start_6.tv_nsec / 1000000000))) * (1000); + printf("I want to print the value of the elapsed time (%f), which is in the unit 'ms' and put other stuff after it\n", clava_timing_duration_6); + + struct timespec clava_timing_start_7, clava_timing_end_7; + double clava_timing_duration_7; + clock_gettime(CLOCK_MONOTONIC, &clava_timing_start_7); + bar3(); + clock_gettime(CLOCK_MONOTONIC, &clava_timing_end_7); + clava_timing_duration_7 = ((clava_timing_end_7.tv_sec + ((double) clava_timing_end_7.tv_nsec / 1000000000)) - (clava_timing_start_7.tv_sec + ((double) clava_timing_start_7.tv_nsec / 1000000000))) * (1000); + printf("%fms\n", clava_timing_duration_7); + printf("This should appear after the timer print\n"); +} diff --git a/ClavaWeaver/resources/clava/test/api/c/src/autopar_inline.c b/ClavaWeaver/resources/clava/test/api/c/src/autopar_inline.c deleted file mode 100644 index b9cce825da..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/src/autopar_inline.c +++ /dev/null @@ -1,25 +0,0 @@ -int bar() { - int a = 0; - - for(int i=0; i<10; i++) { - a++; - } - - return a; -} - -int foo() { - - int a = 0; - - for(int i=0; i<10; i++) { - // Variable that may already after inline renaming - int i_1 = 1; - - a+= bar(); - } - - return a; -} - - diff --git a/ClavaWeaver/resources/clava/test/api/c/src/autopar_test.c b/ClavaWeaver/resources/clava/test/api/c/src/autopar_test.c deleted file mode 100644 index 7e8583ae39..0000000000 --- a/ClavaWeaver/resources/clava/test/api/c/src/autopar_test.c +++ /dev/null @@ -1,37 +0,0 @@ -#include - -double bar(int a) { - return a + 10; -} - -double foo() { - double a = 0; - - int numIter = 1000; - for(int i=0; i - -void foo() { - printf("Hello\n"); -} - -int main() { - - foo(); - - return 0; -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFile.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFile.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFile.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFile.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFileTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFileTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFileTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/AddHeaderFileTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaCodeTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaCodeTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/ClavaCodeTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/ClavaCodeTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.js.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.js.txt new file mode 100644 index 0000000000..f251152a55 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.js.txt @@ -0,0 +1,8 @@ +GET:false +TYPE:class java.lang.Boolean +GET AFTER PUT:true +Disable info:true +System includes: +System includes after:extra_system_include +Flags: +Flags after: -O3 \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.lara.txt deleted file mode 100644 index 1d51735d54..0000000000 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaDataStoreTest.lara.txt +++ /dev/null @@ -1,8 +0,0 @@ -GET:true -TYPE:class java.lang.Boolean -GET AFTER PUT:false -Disable info:false -System includes:[] -System includes after:[extra_system_include] -Flags: -Flags after: -O3 \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaFindJpTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaFindJpTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/ClavaFindJpTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/ClavaFindJpTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTypeTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTypeTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTypeTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/ClavaTypeTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/Code2VecTest.js.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/Code2VecTest.js.txt deleted file mode 100644 index a621781578..0000000000 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/Code2VecTest.js.txt +++ /dev/null @@ -1,55 +0,0 @@ -Warning: using laraImport() for file 'JoinPointsCommonPath.js', however it does not define a variable or class 'JoinPointsCommonPath' -decl (up) file (down) decl -__________________________________ -decl (up) file (down) function (down) param -__________________________________ -decl (up) file (down) function (down) stmt (down) stmt (down) varDecl (down) expr -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) varDecl (down) expr -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) expr (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) stmt (down) expr (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) stmt (down) varRef -__________________________________ -decl (up) file (down) decl -__________________________________ -decl (up) file (down) function (down) param -__________________________________ -decl (up) file (down) function (down) stmt (down) stmt (down) varDecl (down) expr -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) varDecl (down) expr -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) expr (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) loop (down) stmt (down) stmt (down) expr (down) varRef -__________________________________ -decl (up) file (down) function (down) stmt (down) stmt (down) varRef -__________________________________ -param (up) function (down) stmt (down) stmt (down) varDecl (down) expr -__________________________________ -param (up) function (down) stmt (down) loop (down) stmt (down) varDecl (down) expr -__________________________________ -param (up) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -param (up) function (down) stmt (down) loop (down) stmt (down) binary (down) varRef -__________________________________ -param (up) function (down) stmt (down) loop (down) stmt (down) expr (down) varRef -__________________________________ -param (up) function (down) stmt (down) loop (down) stmt (down) stmt (down) expr (down) varRef -__________________________________ -param (up) function (down) stmt (down) stmt (down) varRef -__________________________________ -varRef (up) binary (down) varRef -__________________________________ -varRef (up) binary (down) varRef -__________________________________ diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/EnergyTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/EnergyTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/EnergyTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/EnergyTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/FileIteratorTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/FileIteratorTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/FileIteratorTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/FileIteratorTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/JpFilter.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/JpFilter.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/JpFilter.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/JpFilter.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/LaraCommonLanguageTest.js.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/LaraCommonLanguageTest.js.txt deleted file mode 100644 index 04037ebc80..0000000000 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/LaraCommonLanguageTest.js.txt +++ /dev/null @@ -1,10 +0,0 @@ -Warning: using laraImport() for file 'JoinPointsCommonPath.js', however it does not define a variable or class 'JoinPointsCommonPath' -line: 1 -is FileJP? : true -# A classes: 1 -# onlyDecl classes: 1 -# foo functions: 1 -# fooOnlyDecl functions: 1 -# B classes: 1 -# C classes: 1 -# calls in D: 2 diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTestWithLib.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTestWithLib.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTestWithLib.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/LoggerTestWithLib.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/MathExtraTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/MathExtraTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/MathExtraTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/MathExtraTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/MpiScatterGatherTest.js.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/MpiScatterGatherTest.js.txt index 518b025987..705cf8221c 100644 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/MpiScatterGatherTest.js.txt +++ b/ClavaWeaver/resources/clava/test/api/cpp/results/MpiScatterGatherTest.js.txt @@ -51,4 +51,4 @@ return 0; } foo(); } -/**** End File ****/ \ No newline at end of file +/**** End File ****/ diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/PassSimplifyVarDeclarations.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/PassSimplifyVarDeclarations.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/PassSimplifyVarDeclarations.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/PassSimplifyVarDeclarations.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/QueryTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/QueryTest.lara.txt deleted file mode 100644 index 5d5ef357ed..0000000000 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/QueryTest.lara.txt +++ /dev/null @@ -1,17 +0,0 @@ -query_loop 1 -loop:2,1 -loop:3,1 -loop:3,1,1 -loop:3,1,1 -query_loop 2 -loop:2,1 -loop:3,1 -loop:3,1,1 -query_loop 3 -loop:2,1 -loop:3,1 -query_empty 1 -joinpoint: declStmt -joinpoint: returnStmt -chain keys: _starting_point,function,function_0,loop,loop_0,loop_1,loop_2 -regex: query_regex \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/RebuildTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/RebuildTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/RebuildTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/RebuildTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/TimerTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/TimerTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/TimerTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/TimerTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.js.txt similarity index 74% rename from ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.js.txt index 1278e9b29b..96f59b3a86 100644 --- a/ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.lara.txt +++ b/ClavaWeaver/resources/clava/test/api/cpp/results/UserValuesTest.js.txt @@ -1,6 +1,5 @@ User field: test string -User field: test string 2 -User field after push: test string 2 +User field after push: test string Array after push: [ Hello, diff --git a/ClavaWeaver/resources/clava/test/api/cpp/results/WeaverLauncherTest.lara.txt b/ClavaWeaver/resources/clava/test/api/cpp/results/WeaverLauncherTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/api/cpp/results/WeaverLauncherTest.lara.txt rename to ClavaWeaver/resources/clava/test/api/cpp/results/WeaverLauncherTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/api/cpp/src/add_header_file.cpp b/ClavaWeaver/resources/clava/test/api/cpp/src/add_header_file.cpp new file mode 100644 index 0000000000..33c14ce1d7 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/api/cpp/src/add_header_file.cpp @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/ClavaWeaver/resources/clava/test/api/cpp/src/code2vec.cpp b/ClavaWeaver/resources/clava/test/api/cpp/src/code2vec.cpp deleted file mode 100644 index bb72359350..0000000000 --- a/ClavaWeaver/resources/clava/test/api/cpp/src/code2vec.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include - -int foo(int numIter) { - - int acc = 0; - - for(int i=0; i type.isPointer, +}).get(); + +// Try to determine in expression can be statically determined to be null or 0 +for (const $cast of candidateCasts) { + // Get expression being cast + const $expr = $cast.subExpr; + + // Simplify expression + const simplifiedExpr = MathExtra.simplify($expr); + + if (simplifiedExpr === "0" || simplifiedExpr === "nullptr") { + console.log( + "Found possible NULL pointer dereference in " + + $cast.location + + " (CWE-476)" + ); + } +} + +// Alternatively, code that tests for null pointer could be inserted (if it is detected that such tests is not being done) diff --git a/ClavaWeaver/resources/clava/test/bench/CbMultios.lara b/ClavaWeaver/resources/clava/test/bench/CbMultios.lara deleted file mode 100644 index c8da402970..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/CbMultios.lara +++ /dev/null @@ -1,38 +0,0 @@ -import weaver.Query; -import clava.MathExtra; - -/** - * Based on the challenges in https://github.com/trailofbits/cb-multios/ - */ -aspectdef CbMultios - -//println(Query.search("function", "bitBlaster").first().ast); - - testBitBlaster(); -end - - -function testBitBlaster() { - // Entry point - var $function = Query.search("function", "bitBlaster").first(); - - // Look for casts to pointer type - var candidateCasts = Query.searchFrom($function, "cast", {type: type => type.isPointer}).get(); - - - // Try to determine in expression can be statically determined to be null or 0 - for(var $cast of candidateCasts) { - // Get expression being cast - var $expr = $cast.subExpr; - - // Simplify expression - var simplifiedExpr = MathExtra.simplify($expr); - - if(simplifiedExpr === "0" || simplifiedExpr === "nullptr") { - println("Found possible NULL pointer dereference in " + $cast.location + " (CWE-476)"); - } - } - - // Alternatively, code that tests for null pointer could be inserted (if it is detected that such tests is not being done) - -} diff --git a/ClavaWeaver/resources/clava/test/bench/DspMatmul.js b/ClavaWeaver/resources/clava/test/bench/DspMatmul.js new file mode 100644 index 0000000000..0cbedfd83c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/DspMatmul.js @@ -0,0 +1,3 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/bench/DspMatmul.lara b/ClavaWeaver/resources/clava/test/bench/DspMatmul.lara deleted file mode 100644 index bf46db61d5..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/DspMatmul.lara +++ /dev/null @@ -1,7 +0,0 @@ -import weaver.Query; - -aspectdef DspMatmul - - println(Query.root().code); - -end diff --git a/ClavaWeaver/resources/clava/test/bench/HamidRegion.js b/ClavaWeaver/resources/clava/test/bench/HamidRegion.js new file mode 100644 index 0000000000..ab2a167445 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/HamidRegion.js @@ -0,0 +1,48 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const chain of Query.search("file", "hamid_region.c") + .search("function") + .search("body") + .search("arrayAccess") + .chain()) { + const $function = chain["function"]; + const $arrayAccess = chain["arrayAccess"]; + + console.log("function.name : " + $function.name); + console.log("\t" + "arrayAccess.code : " + $arrayAccess.code); + console.log( + "\t" + "arrayAccess.arrayVar.code : " + $arrayAccess.arrayVar.code + ); + + // 1 + console.log( + "\t" + + "vardecl.code : " + + $arrayAccess.arrayVar.getDescendantsAndSelf("varref")[0].vardecl + .code + ); + console.log( + "\t" + + "vardecl.currentRegion : " + + $arrayAccess.arrayVar.getDescendantsAndSelf("varref")[0].vardecl + .currentRegion + ); + + // 2 + console.log( + "\t" + + "arrayAccess.arrayVar.vardecl.code : " + + $arrayAccess.arrayVar.vardecl.code + ); + console.log( + "\t" + + "arrayAccess.arrayVar.vardecl.currentRegion : " + + $arrayAccess.arrayVar.vardecl.currentRegion + ); +} + +for (const $vardecl of Query.search("file", "hamid_region.h").search( + "vardecl" +)) { + console.log("header vardecl.currentRegion : " + $vardecl.currentRegion); +} diff --git a/ClavaWeaver/resources/clava/test/bench/HamidRegion.lara b/ClavaWeaver/resources/clava/test/bench/HamidRegion.lara deleted file mode 100644 index 8e4c1abe36..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/HamidRegion.lara +++ /dev/null @@ -1,31 +0,0 @@ -aspectdef HamidRegion -/* - select vardecl end - apply - println("Vardecl: " + $vardecl.astId + " -> " + $vardecl.location); - end -*/ - - select file{"hamid_region.c"}.function.body.arrayAccess end - apply - - println('function.name : ' + $function.name); - println('\t' + 'arrayAccess.code : ' + $arrayAccess.code); - println('\t' + 'arrayAccess.arrayVar.code : ' + $arrayAccess.arrayVar.code); - - // 1 - println('\t' + 'vardecl.code : ' + $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.code); - println('\t' + 'vardecl.currentRegion : ' + $arrayAccess.arrayVar.getDescendantsAndSelf('varref')[0].vardecl.currentRegion); - - // 2 - println('\t' + 'arrayAccess.arrayVar.vardecl.code : ' + $arrayAccess.arrayVar.vardecl.code); - println('\t' + 'arrayAccess.arrayVar.vardecl.currentRegion : ' + $arrayAccess.arrayVar.vardecl.currentRegion); - end - - - select file{"hamid_region.h"}.vardecl end - apply - println('header vardecl.currentRegion : ' + $vardecl.currentRegion); - end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/bench/LSIssue1.js b/ClavaWeaver/resources/clava/test/bench/LSIssue1.js new file mode 100644 index 0000000000..ca73cb8f28 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/LSIssue1.js @@ -0,0 +1,16 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +const $t = Query.search("function", { + qualifiedName: (name) => name.endsWith("_Kernel"), +}).first(); +const $nt = $t.clone($t.name + "C", false); +$t.insertBefore($nt); +const $callArgs = $t.params.map(($param) => + ClavaJoinPoints.varRefFromDecl($param) +); +const $call = $nt.newCall($callArgs); +$t.body.replaceWith($call); + +const $newCall = Query.search("call", "matrix_mult_KernelC").first(); +console.log("Def: " + $newCall.definition.name); diff --git a/ClavaWeaver/resources/clava/test/bench/LSIssue1.lara b/ClavaWeaver/resources/clava/test/bench/LSIssue1.lara deleted file mode 100644 index 7ac781bd3d..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/LSIssue1.lara +++ /dev/null @@ -1,39 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; -import clava.hls.HLSAnalysis; -import clava.Clava; - -aspectdef OCL_Experiments - var $t = Query.search("function", {qualifiedName: name => name.endsWith("_Kernel")}).first(); - var $nt = $t.clone($t.name+"C", false); - $t.insertBefore($nt); - var $callArgs = $t.params.map(($param) => - ClavaJoinPoints.varRefFromDecl($param) - ); - var $call = $nt.newCall($callArgs); - $t.body.replaceWith($call); - - - var $newCall = Query.search("call", "matrix_mult_KernelC").first(); - println("Def: " + $newCall.definition.name); -/* - var $kernels = Query.search("function", { - joinPointType: "function", - qualifiedName: name => name.endsWith("lt_Kernel") - }).get(); - - for (var $kernel of $kernels) { - println("\n\n\n"); - println($kernel.joinPointType + " --> " + $kernel.qualifiedName); - HLSAnalysis.applyGenericStrategies($kernel); - } - */ - /* - for(var $f of Query.search("function")) { - println("Function: " + $f.qualifiedName); - println("Ends with lt_Kernel? " + $f.qualifiedName.endsWith("lt_Kernel")); - } - */ - - //println(Query.root().code); -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/bench/LSIssue2.js b/ClavaWeaver/resources/clava/test/bench/LSIssue2.js new file mode 100644 index 0000000000..1b9e9aec01 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/LSIssue2.js @@ -0,0 +1,30 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +const $jp = Query.search("call").first(); +const $var1 = ClavaJoinPoints.varDeclNoInit( + "boolVar", + ClavaJoinPoints.builtinType("bool") +); +const $var2 = ClavaJoinPoints.varDeclNoInit( + "boolVar2", + ClavaJoinPoints.builtinType("bool") +); +$jp.insertAfter($var2); +$jp.insertAfter($var1); +const $ifStmt = ClavaJoinPoints.ifStmt( + ClavaJoinPoints.varRefFromDecl($var1), + ClavaJoinPoints.stmtLiteral("int a = 1;") +); +$var2.insertAfter($ifStmt); + +//ClavaType.asStatement( +const op = ClavaJoinPoints.binaryOp( + "=", + ClavaJoinPoints.varRefFromDecl($var1), + ClavaJoinPoints.varRefFromDecl($var2), + $var1.type +); +//) +console.log("OP: " + op); +$ifStmt.then.insertEnd(op); diff --git a/ClavaWeaver/resources/clava/test/bench/LSIssue2.lara b/ClavaWeaver/resources/clava/test/bench/LSIssue2.lara deleted file mode 100644 index 5ea88c06f2..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/LSIssue2.lara +++ /dev/null @@ -1,37 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; -import clava.ClavaType; -aspectdef LSIssue2 - - var $jp = Query.search("call").first(); - var $var1 = ClavaJoinPoints.varDeclNoInit( - "boolVar", - ClavaJoinPoints.builtinType("bool") - ); - var $var2 = ClavaJoinPoints.varDeclNoInit( - "boolVar2", - ClavaJoinPoints.builtinType("bool") - ); - $jp.insertAfter($var2); - $jp.insertAfter($var1); - var $ifStmt = ClavaJoinPoints.ifStmt( - ClavaJoinPoints.varRefFromDecl($var1), - ClavaJoinPoints.stmtLiteral("int a = 1;") - ); - $var2.insertAfter($ifStmt); - -//ClavaType.asStatement( - var op = ClavaJoinPoints.binaryOp( - "=", - ClavaJoinPoints.varRefFromDecl($var1), - ClavaJoinPoints.varRefFromDecl($var2), - $var1.type - ); - //) -println("OP: " + op); - $ifStmt.then.insertEnd( - op - - ); - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx1.js b/ClavaWeaver/resources/clava/test/bench/LoicEx1.js new file mode 100644 index 0000000000..46d1f197c0 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/LoicEx1.js @@ -0,0 +1,86 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function duplicate($vclass, idNewClass) { + const $newClass = ClavaJoinPoints.classDecl(idNewClass); + $vclass.insertAfter($newClass); + for (let i = 0; i < $vclass.astNumChildren; i++) { + const $vtchild = $vclass.getChild(i); + const astName = $vtchild.astName; + switch (astName) { + case "CXXMethodDecl": + case "CXXDestructorDecl": + case "CXXConstructorDecl": + duplicateMethod($vtchild, $newClass); + break; + case "FieldDecl": { + const $nf = ClavaJoinPoints.field($vtchild.name, $vtchild.type); + $newClass.addField($nf); + break; + } + default: { + // AccessSpecDecl , InlineComment + const $vcopy = $vtchild.deepCopy(); + if ($newClass.astNumChildren == 0) { + $newClass.setFirstChild($vcopy); + } else { + $newClass.lastChild.insertAfter($vcopy); + } + } + } + } + return $newClass; +} + +function duplicateMethod($m, $newClass) { + function setNameMethod($nm) { + if ($nm.astIsInstance("CXXConstructorDecl")) + $nm.setName($newClass.name); + else if ($nm.astIsInstance("CXXDestructorDecl")) + $nm.setName("~" + $newClass.name); + } + + if (!$m.hasDefinition) { + $m = $m.definitionJp; + } + + // Set new name, of if name is the same, automatically removes method from the class + const $newMethod = $m.clone($m.name, false); + + setNameMethod($newMethod); + $newClass.addMethod($newMethod); + $newClass.insertAfter($newMethod); +} + +function printLinksDeclarationDefinition($Class) { + const methods = $Class.methods; + for (const $m of methods) { + console.log(" =================================="); + console.log( + " Declaration of the method = " + + $m.code + + " of the class " + + $Class.name + ); + if ($m.definitionJp !== undefined) { + const $vdef = $m.definitionJp; + console.log(" Associated definition = " + $vdef.code); + if ($vdef.record !== undefined) { + console.log( + " The class of the record field is = " + $vdef.record.name + ); + } else { + console.log( + " The class of the record field is = " + $vdef.record + ); + } + } + } +} + +const $vclass = Query.search("class").first(); +const $newClass1 = duplicate($vclass, "FIRST_DUPLICATION"); +const $newClass2 = duplicate($vclass, "SECOND_DUPLICATION"); +printLinksDeclarationDefinition($newClass1); +printLinksDeclarationDefinition($newClass2); +printLinksDeclarationDefinition($vclass); diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx1.lara b/ClavaWeaver/resources/clava/test/bench/LoicEx1.lara deleted file mode 100644 index 3a336e1eba..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/LoicEx1.lara +++ /dev/null @@ -1,87 +0,0 @@ -import lara.Io; -import clava.Clava; -import clava.ClavaJoinPoints; -import weaver.Query; - - -aspectdef Launcher - var $vclass = Query.search("class").first(); - var $newClass1 = duplicate ($vclass, "FIRST_DUPLICATION"); - var $newClass2 = duplicate ($vclass, "SECOND_DUPLICATION"); - printLinksDeclarationDefinition($newClass1); - printLinksDeclarationDefinition($newClass2); - printLinksDeclarationDefinition($vclass); -end - -function duplicate($vclass, idNewClass) { - var $newClass = ClavaJoinPoints.classDecl(idNewClass); - $vclass.insertAfter($newClass); - for (var i=0; i < $vclass.astNumChildren; i++) { - var $vtchild = $vclass.getChild(i); - var astName = $vtchild.astName; - switch (astName) { - case "CXXMethodDecl": - case "CXXDestructorDecl": - case "CXXConstructorDecl": - duplicateMethod( $vtchild, $newClass ); - break; - case "FieldDecl": - var $nf = ClavaJoinPoints.field($vtchild.name, $vtchild.type); - $newClass.addField($nf); - break; - default: // AccessSpecDecl , InlineComment - var $vcopy = $vtchild.deepCopy(); - if ( $newClass.astNumChildren == 0 ) - $newClass.setFirstChild($vcopy); - else - $newClass.lastChild.insertAfter($vcopy); - } - } - return $newClass; -} - - - function duplicateMethod( $m, $newClass ) { - -// function setNameMethod ($nm, originalMethodName) { - function setNameMethod ($nm) { - if ($nm.astIsInstance("CXXConstructorDecl")) - $nm.setName($newClass.name); - else if ($nm.astIsInstance("CXXDestructorDecl")) - $nm.setName("~" + $newClass.name); -// else { -// $nm.setName(originalMethodName); -// } - } - - if ( ! $m.hasDefinition ) var $m = $m.definitionJp; - //var originalMethodName = $m.name; - // Set new name, of if name is the same, automatically removes method from the class - var $newMethod = $m.clone($m.name, false) ; - //var $newMethod = $m.clone( $newClass.name + "_" + $m.name, false) ; - //$newMethod.removeRecord(); - - setNameMethod($newMethod); - //setNameMethod($newMethod, originalMethodName); - $newClass.addMethod($newMethod); - $newClass.insertAfter ($newMethod); -} - -function printLinksDeclarationDefinition($Class) { - var methods = $Class.methods; - // println( " class = " + $Class.name); - for (var $m of methods) { - println ( " =================================="); - println( " Declaration of the method = " + $m.code + " of the class " + $Class.name); - if ( $m.definitionJp !== undefined ) { - var $vdef = $m.definitionJp; - println( " Associated definition = " + $vdef.code); - if($vdef.record !== undefined) { - println ( " The class of the record field is = " + $vdef.record.name); - } else { - println ( " The class of the record field is = " + $vdef.record); - } - - } - } -} diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx2.js b/ClavaWeaver/resources/clava/test/bench/LoicEx2.js new file mode 100644 index 0000000000..e5b0f795e5 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/LoicEx2.js @@ -0,0 +1,45 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function replaceTypesTemplatesInCall($function) { + let cpt = 0; + const vcalls = $function.calls; + for (const aCall of vcalls) { + const $vargTemplate = undefined; + try { + const $fc = aCall.children[0]; + console.log(" === The first child of the call is : " + $fc.code); + const targs = $fc.getValue("templateArguments"); + for (const x of targs) { + let $vargTemplate = undefined; + try { + $vargTemplate = x.getValue("expr"); + console.log(" *** expression detected = " + x); + } catch (e) {} + + if ($vargTemplate === undefined) + try { + $vargTemplate = x.getValue("type"); + console.log(" *** type detected = " + x); + try { + x.setValue( + "type", + ClavaJoinPoints.typeLiteral("newType" + cpt) + ); + cpt++; + console.log( + " === AFTER MY TRANSFO, The first child of the call is : " + + $fc.code + ); + } catch (e) { + console.log(e); + } + } catch (e) {} + } + } catch (e) {} + } +} + +for (const $function of Query.search("function").get()) { + replaceTypesTemplatesInCall($function); +} diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx2.lara b/ClavaWeaver/resources/clava/test/bench/LoicEx2.lara deleted file mode 100644 index 22e0a88b60..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/LoicEx2.lara +++ /dev/null @@ -1,46 +0,0 @@ -import lara.Io; -import clava.Clava; -import clava.ClavaJoinPoints; - -aspectdef Launcher - select file.function end - apply - replaceTypesTemplatesInCall($function); - end - -end - -function replaceTypesTemplatesInCall($function) { - var cpt = 0; - var vcalls = $function.calls; - for (var aCall of vcalls) { - var $vargTemplate=undefined; - try { - var $fc = aCall.children[0]; - println(" === The first child of the call is : " + $fc.code); - var targs = $fc.getValue("templateArguments"); - for (var x of targs) { - var $vargTemplate = undefined; - try { - $vargTemplate = x.getValue("expr"); - println( " *** expression detected = " + x); - } catch(e) { } - - if ( $vargTemplate === undefined) - try { - $vargTemplate = x.getValue("type"); - println( " *** type detected = " + x); - try { - x.setValue("type", ClavaJoinPoints.typeLiteral("newType" + cpt)); - cpt++; - println(" === AFTER MY TRANSFO, The first child of the call is : " + $fc.code); - } - catch(e) { println(e); } - } - catch(e) { } - - - } - } catch(e) { } - } -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx3.js b/ClavaWeaver/resources/clava/test/bench/LoicEx3.js new file mode 100644 index 0000000000..e142bcdff9 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/bench/LoicEx3.js @@ -0,0 +1,77 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function duplicate($vclass, idNewClass) { + const $newClass = ClavaJoinPoints.classDecl(idNewClass); + $vclass.insertAfter($newClass); + for (let i = 0; i < $vclass.astNumChildren; i++) { + const $vtchild = $vclass.getChild(i); + const astName = $vtchild.astName; + switch (astName) { + case "CXXMethodDecl": + case "CXXDestructorDecl": + case "CXXConstructorDecl": + duplicateMethod($vtchild, $newClass); + break; + case "FieldDecl": { + const $nf = ClavaJoinPoints.field($vtchild.name, $vtchild.type); + $newClass.addField($nf); + break; + } + default: { + // AccessSpecDecl , InlineComment + const $vcopy = $vtchild.deepCopy(); + if ($newClass.astNumChildren == 0) { + $newClass.setFirstChild($vcopy); + } else { + $newClass.lastChild.insertAfter($vcopy); + } + } + } + } + return $newClass; +} + +function duplicateMethod($m, $newClass) { + function setNameConstructorDestructorMethod($nm) { + if ($nm.astIsInstance("CXXConstructorDecl")) + $nm.setName($newClass.name); + else if ($nm.astIsInstance("CXXDestructorDecl")) + $nm.setName("~" + $newClass.name); + } + + if (!$m.hasDefinition) { + $m = $m.definitionJp; + } + const $newMethod = $m.clone($m.name, false); + setNameConstructorDestructorMethod($newMethod); + $newClass.addMethod($newMethod); + $newClass.insertAfter($newMethod); +} + +function printLinksDeclarationDefinition($Class) { + const methods = $Class.methods; + // console.log( " class = " + $Class.name); + for (const $m of methods) { + console.log(" =================================="); + console.log( + " Declaration of the method = " + + $m.code + + " of the class " + + $Class.name + ); + if ($m.definitionJp !== undefined) { + const $vdef = $m.definitionJp; + console.log(" Associated definition = " + $vdef.code); + console.log( + " The class of the record field is = " + $vdef.record.name + ); + } + } +} + +const $vclass = Query.search("class").first(); +const $newClass1 = duplicate($vclass, "FIRST_DUPLICATION"); +const $newClass2 = duplicate($vclass, "SECOND_DUPLICATION"); +printLinksDeclarationDefinition($newClass1); +printLinksDeclarationDefinition($newClass2); diff --git a/ClavaWeaver/resources/clava/test/bench/LoicEx3.lara b/ClavaWeaver/resources/clava/test/bench/LoicEx3.lara deleted file mode 100644 index 04c021ec81..0000000000 --- a/ClavaWeaver/resources/clava/test/bench/LoicEx3.lara +++ /dev/null @@ -1,72 +0,0 @@ -import lara.Io; -import clava.Clava; -import clava.ClavaJoinPoints; -import weaver.Query; - - -aspectdef Launcher - var $vclass = Query.search("class").first(); - var $newClass1 = duplicate ($vclass, "FIRST_DUPLICATION"); - var $newClass2 = duplicate ($vclass, "SECOND_DUPLICATION"); - printLinksDeclarationDefinition($newClass1); - printLinksDeclarationDefinition($newClass2); -end - -function duplicate($vclass, idNewClass) { - var $newClass = ClavaJoinPoints.classDecl(idNewClass); - $vclass.insertAfter($newClass); - for (var i=0; i < $vclass.astNumChildren; i++) { - var $vtchild = $vclass.getChild(i); - var astName = $vtchild.astName; - switch (astName) { - case "CXXMethodDecl": - case "CXXDestructorDecl": - case "CXXConstructorDecl": - duplicateMethod( $vtchild, $newClass ); - break; - case "FieldDecl": - var $nf = ClavaJoinPoints.field($vtchild.name, $vtchild.type); - $newClass.addField($nf); - break; - default: // AccessSpecDecl , InlineComment - var $vcopy = $vtchild.deepCopy(); - if ( $newClass.astNumChildren == 0 ) - $newClass.setFirstChild($vcopy); - else - $newClass.lastChild.insertAfter($vcopy); - } - } - return $newClass; -} - - - function duplicateMethod( $m, $newClass ) { - - function setNameConstructorDestructorMethod ($nm) { - if ($nm.astIsInstance("CXXConstructorDecl")) - $nm.setName($newClass.name); - else - if ($nm.astIsInstance("CXXDestructorDecl")) - $nm.setName("~" + $newClass.name); - } - - if ( ! $m.hasDefinition ) var $m = $m.definitionJp; - var $newMethod = $m.clone( $m.name, false) ; - setNameConstructorDestructorMethod($newMethod); - $newClass.addMethod($newMethod); - $newClass.insertAfter ($newMethod); -} - -function printLinksDeclarationDefinition($Class) { - var methods = $Class.methods; - // println( " class = " + $Class.name); - for (var $m of methods) { - println ( " =================================="); - println( " Declaration of the method = " + $m.code + " of the class " + $Class.name); - if ( $m.definitionJp !== undefined ) { - var $vdef = $m.definitionJp; - println( " Associated definition = " + $vdef.code); - println ( " The class of the record field is = " + $vdef.record.name); - } - } -} diff --git a/ClavaWeaver/resources/clava/test/bench/c/results/DspMatmul.lara.txt b/ClavaWeaver/resources/clava/test/bench/c/results/DspMatmul.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/c/results/DspMatmul.lara.txt rename to ClavaWeaver/resources/clava/test/bench/c/results/DspMatmul.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/c/results/HamidRegion.lara.txt b/ClavaWeaver/resources/clava/test/bench/c/results/HamidRegion.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/c/results/HamidRegion.lara.txt rename to ClavaWeaver/resources/clava/test/bench/c/results/HamidRegion.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/c/results/LSIssue1.lara.txt b/ClavaWeaver/resources/clava/test/bench/c/results/LSIssue1.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/c/results/LSIssue1.lara.txt rename to ClavaWeaver/resources/clava/test/bench/c/results/LSIssue1.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/cpp/results/CbMultios.lara.txt b/ClavaWeaver/resources/clava/test/bench/cpp/results/CbMultios.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/cpp/results/CbMultios.lara.txt rename to ClavaWeaver/resources/clava/test/bench/cpp/results/CbMultios.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/cpp/results/LSIssue2.lara.txt b/ClavaWeaver/resources/clava/test/bench/cpp/results/LSIssue2.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/cpp/results/LSIssue2.lara.txt rename to ClavaWeaver/resources/clava/test/bench/cpp/results/LSIssue2.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx1.lara.txt b/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx1.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx1.lara.txt rename to ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx1.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx2.lara b/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx2.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx2.lara rename to ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx2.js.txt diff --git a/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx3.lara.txt b/ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx3.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx3.lara.txt rename to ClavaWeaver/resources/clava/test/bench/cpp/results/LoicEx3.js.txt diff --git a/ClavaWeaver/resources/clava/test/issues/Issue168.js b/ClavaWeaver/resources/clava/test/issues/Issue168.js new file mode 100644 index 0000000000..a4105f8846 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/issues/Issue168.js @@ -0,0 +1,16 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import StatementDecomposer from "@specs-feup/clava/api/clava/code/StatementDecomposer.js"; +import NormalizeToSubset from "@specs-feup/clava/api/clava/opt/NormalizeToSubset.js"; +import { FunctionJp, Statement } from "@specs-feup/clava/api/Joinpoints.js"; + +for (const fun of Query.search(FunctionJp, { isImplementation: true })) { + const body = fun.body; + NormalizeToSubset(body, { simplifyLoops: { forToWhile: false } }); +} + +const decomp = new StatementDecomposer(); +for (const stmt of Query.search(Statement, { isInsideHeader: false })) { + decomp.decomposeAndReplace(stmt); +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/issues/Issue168.mjs b/ClavaWeaver/resources/clava/test/issues/Issue168.mjs deleted file mode 100644 index f5c9cf10fc..0000000000 --- a/ClavaWeaver/resources/clava/test/issues/Issue168.mjs +++ /dev/null @@ -1,19 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; - -//laraImport("weaver.Query"); -laraImport("Joinpoints"); -//import {FunctionJp, Statement} from "@specs-feup/clava/api/Joinpoints.js"; -laraImport("clava.code.StatementDecomposer"); -laraImport("clava.opt.NormalizeToSubset"); - -for (const fun of Query.search(FunctionJp, {"isImplementation": true})) { - const body = fun.body; - NormalizeToSubset(body, {simplifyLoops: {forToWhile: false}}); -} - -const decomp = new StatementDecomposer(); -for (var stmt of Query.search(Statement, {isInsideHeader: false})) { - decomp.decomposeAndReplace(stmt); -} - -println(Query.root().code); \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/issues/Issue187.mjs b/ClavaWeaver/resources/clava/test/issues/Issue187.mjs deleted file mode 100644 index 18d43b7c81..0000000000 --- a/ClavaWeaver/resources/clava/test/issues/Issue187.mjs +++ /dev/null @@ -1,21 +0,0 @@ -import Query from "@specs-feup/lara/api/weaver/Query.js"; -import {FunctionJp} from "@specs-feup/clava/api/Joinpoints.js"; -import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; - - -const functionJp = Query.search(FunctionJp).first(); - -const newParam1 = ClavaJoinPoints.param( - "b", - ClavaJoinPoints.builtinType("int") -); - -const newParam2 = ClavaJoinPoints.param( - "c", - ClavaJoinPoints.builtinType("int") -); - -functionJp.setParams([newParam1, newParam2]); - -const functionDecl = Query.search(FunctionJp, {name: "foo", isImplementation: false}).get()[0]; -console.log(functionDecl); \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/issues/Issue_aiq_1.mjs b/ClavaWeaver/resources/clava/test/issues/Issue_aiq_1.js similarity index 100% rename from ClavaWeaver/resources/clava/test/issues/Issue_aiq_1.mjs rename to ClavaWeaver/resources/clava/test/issues/Issue_aiq_1.js diff --git a/ClavaWeaver/resources/clava/test/issues/c/results/Issue168.mjs.txt b/ClavaWeaver/resources/clava/test/issues/c/results/Issue168.js.txt similarity index 90% rename from ClavaWeaver/resources/clava/test/issues/c/results/Issue168.mjs.txt rename to ClavaWeaver/resources/clava/test/issues/c/results/Issue168.js.txt index b3b6e44f50..b637ef700d 100644 --- a/ClavaWeaver/resources/clava/test/issues/c/results/Issue168.mjs.txt +++ b/ClavaWeaver/resources/clava/test/issues/c/results/Issue168.js.txt @@ -10,8 +10,8 @@ float buzz(int *A, double *B, char C[]) { decomp_0 = C[i] + 1; C[i] = decomp_0; for(int j = 0; j < 100; j++) { - int decomp_0; - int decomp_1; + bool decomp_0; + bool decomp_1; decomp_1 = C[i] > 0; decomp_0 = decomp_1; if(decomp_0) return 0.3; @@ -22,8 +22,8 @@ float buzz(int *A, double *B, char C[]) { int decomp_3; decomp_3 = C[k] + 3; C[k] = decomp_3; - int decomp_1; - int decomp_4; + bool decomp_1; + bool decomp_4; decomp_4 = C[k] > 0; decomp_1 = decomp_4; if(decomp_1) { diff --git a/ClavaWeaver/resources/clava/test/issues/c/results/Issue187.mjs.txt b/ClavaWeaver/resources/clava/test/issues/c/results/Issue187.mjs.txt deleted file mode 100644 index e10fafe2e5..0000000000 --- a/ClavaWeaver/resources/clava/test/issues/c/results/Issue187.mjs.txt +++ /dev/null @@ -1 +0,0 @@ -Joinpoint 'function' \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/issues/c/results/Issue_aiq_1.mjs.txt b/ClavaWeaver/resources/clava/test/issues/c/results/Issue_aiq_1.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/issues/c/results/Issue_aiq_1.mjs.txt rename to ClavaWeaver/resources/clava/test/issues/c/results/Issue_aiq_1.js.txt diff --git a/ClavaWeaver/resources/clava/test/issues/c/src/issue_187.c b/ClavaWeaver/resources/clava/test/issues/c/src/issue_187.c deleted file mode 100644 index f8934180ec..0000000000 --- a/ClavaWeaver/resources/clava/test/issues/c/src/issue_187.c +++ /dev/null @@ -1,2 +0,0 @@ -int foo(int a); -int foo(int a) {return 0;} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/loc/ClavaAspectsForLoc.lara b/ClavaWeaver/resources/clava/test/loc/ClavaAspectsForLoc.lara deleted file mode 100644 index 928c63be3b..0000000000 --- a/ClavaWeaver/resources/clava/test/loc/ClavaAspectsForLoc.lara +++ /dev/null @@ -1,93 +0,0 @@ -/** - * ASPECTS - */ -aspectdef Rebuild - select program end - apply - $program.exec rebuild(); - end -end - -aspectdef ClavaStandard - output standard end - - select program end - apply - standard = $program.standard; - return; - end -end - -aspectdef ClavaIsCxx - output isCxx end - - select program end - apply - isCxx = $program.isCxx; - return; - end -end - - -aspectdef ClavaBaseFolder - output baseFolder end - - select program end - apply - baseFolder = $program.baseFolder; - return; - end -end - -aspectdef ClavaAddFile - input $file end - - select program end - apply - $program.exec addFile($file); - end - -end - -aspectdef PushAst - select program end - apply - $program.exec push(); - end -end - -aspectdef PopAst - select program end - apply - $program.exec pop(); - end -end - -aspectdef ClavaWeavingFolder - output weavingFolder end - - select program end - apply - weavingFolder = $program.weavingFolder; - return; - end -end - -aspectdef GetProgram - output programJp end - - select program end - apply - programJp = $program; - end -end - - -function testFunction() { -} - -var UtilityFunctions = {}; - -UtilityFunctions.util = function() { - return "this is useful"; -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Actions.js b/ClavaWeaver/resources/clava/test/weaver/Actions.js new file mode 100644 index 0000000000..1fcf9b68cf --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Actions.js @@ -0,0 +1,15 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("function") + .search("statement") + .search("vardecl")) { + if ($vardecl.type.code === "double") { + $vardecl.setType(ClavaJoinPoints.builtinType("float")); + } else if ($vardecl.type.code === "int") { + $vardecl.setType(ClavaJoinPoints.builtinType("unsigned int")); + } +} + +console.log(Query.root().code); + diff --git a/ClavaWeaver/resources/clava/test/weaver/Actions.lara b/ClavaWeaver/resources/clava/test/weaver/Actions.lara deleted file mode 100644 index 947d04938b..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Actions.lara +++ /dev/null @@ -1,63 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef Actions - - select function.stmt.vardecl end - apply - if($vardecl.type.code === "double") { - $vardecl.exec setType(ClavaJoinPoints.builtinType("float")); - } else if($vardecl.type.code === "int") { - $vardecl.exec setType(ClavaJoinPoints.builtinType("unsigned int")); - } - end - - - select file end - apply - println($file.code); - end - /* - select function.decl end - apply - println("BEFORE:" + $decl.type.code); - def type = ClavaJoinPoints.builtinType("int"); - println("AFTER:" + $decl.type.code); - end - select file end - apply - println($file.code); - end - */ - - /* - var aStmt = undefined; - var $float = ClavaJoinPoints.builtinType("double"); - println("Float: " + $float.code); - select expr end - apply - - println("Equals of float :" + ($float == $float)); - println("String equals of float :" + ($float === $float)); - println("Equals of same object :" + ($expr.type == $expr.type)); - println("Strict equals of same object :" + ($expr.type === $expr.type)); - - println("Expr type:" + $expr.type.code); - println("==: " + ($float == $expr.type)); - println("===: " + ($float === $expr.type)); - println("equals: " + ($float.equals($expr.type))); - println("same: " + ($float.same($expr.type))); - - end - */ - - /* - if(aStmt === undefined) { - aStmt = $stmt; - } else { - println("Compare ==: " + (aStmt == $stmt)); - println("Compare ===: " + (aStmt === $stmt)); - break; - } - */ - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/AddArgTest.js b/ClavaWeaver/resources/clava/test/weaver/AddArgTest.js new file mode 100644 index 0000000000..1edb9ccbe2 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AddArgTest.js @@ -0,0 +1,31 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $function of Query.search("function", "foo")) { + if (!$function.isImplementation) { + continue; + } + + $function.addParam("char* str"); +} + +for (const $function of Query.search("function", "bar")) { + if ($function.isImplementation) { + continue; + } + + $function.addParam("int num"); +} + +for (const $call of Query.search("call", "bar")) { + $call.addArg("0", ClavaJoinPoints.builtinType("int")); +} + +for (const $call of Query.search("call", "foo")) { + const type = ClavaJoinPoints.pointerFromBuiltin("unsigned char"); + $call.addArg('"foo"', type); +} + + +console.log(Query.root().code); +console.log("---------------"); diff --git a/ClavaWeaver/resources/clava/test/weaver/AddArgTest.lara b/ClavaWeaver/resources/clava/test/weaver/AddArgTest.lara deleted file mode 100644 index 0b2c941d43..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AddArgTest.lara +++ /dev/null @@ -1,41 +0,0 @@ -import clava.ClavaJoinPoints; -import weaver.Query; - -aspectdef AddArgTest - - - select function{'foo'} end - apply - if(!$function.isImplementation) { - continue; - } - - $function.exec addParam("char* str"); - end - - select function{'bar'} end - apply - if($function.isImplementation) { - continue; - } - - $function.exec addParam("int num"); - end - - select call{'bar'} end - apply - $call.exec addArg("0", ClavaJoinPoints.builtinType("int")); - end - - select call{'foo'} end - apply - var type = ClavaJoinPoints.pointerFromBuiltin("unsigned char"); - $call.exec addArg('"foo"', type); - end - - select program end - apply - println($program.code); - println("---------------"); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/AddGlobal.js b/ClavaWeaver/resources/clava/test/weaver/AddGlobal.js new file mode 100644 index 0000000000..050c08d872 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AddGlobal.js @@ -0,0 +1,9 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $file of Query.search("file")) { + var type = ClavaJoinPoints.builtinType("int"); + $file.addGlobal("num_threads", type, "16"); + console.log($file.code); + console.log("---------------"); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/AddGlobal.lara b/ClavaWeaver/resources/clava/test/weaver/AddGlobal.lara deleted file mode 100644 index 35fde484f8..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AddGlobal.lara +++ /dev/null @@ -1,12 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef AddGlobal - - select file end - apply - var type = ClavaJoinPoints.builtinType("int"); - $file.exec addGlobal('num_threads', type, "16"); - println($file.code); - println("---------------"); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/AddParamTest.js b/ClavaWeaver/resources/clava/test/weaver/AddParamTest.js new file mode 100644 index 0000000000..ab56e9186c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AddParamTest.js @@ -0,0 +1,12 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $function of Query.search("function", "foo")) { + $function.addParam("char* str"); + console.log($function.code); +} + +for (const $function of Query.search("function", "bar")) { + $function.addParam("int num"); + console.log($function.code); + console.log("---------------"); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/AddParamTest.lara b/ClavaWeaver/resources/clava/test/weaver/AddParamTest.lara deleted file mode 100644 index f34c0d48c1..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AddParamTest.lara +++ /dev/null @@ -1,15 +0,0 @@ -aspectdef AddParamTest - - select function{'foo'} end - apply - $function.exec addParam("char* str"); - println($function.code); - end - - select function{'bar'} end - apply - $function.exec addParam("int num"); - println($function.code); - println("---------------"); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.js b/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.js new file mode 100644 index 0000000000..b592b2092a --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.js @@ -0,0 +1,6 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $arrayAccess of Query.search("arrayAccess")) { + console.log("Array var: " + $arrayAccess.arrayVar.name); + console.log($arrayAccess.code + "->" + $arrayAccess.use); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.lara b/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.lara deleted file mode 100644 index 7f0661eef9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ArrayAccess.lara +++ /dev/null @@ -1,23 +0,0 @@ -import weaver.Query; - -aspectdef ArrayAccess - -/* - select body.stmt end - apply - println("STMT:" + $stmt.code); - end - */ -/* - select stmt.arrayAccess end - apply - println("Array var: " + $arrayAccess.arrayVar.name); - println($arrayAccess.code + "->" + $arrayAccess.use); - end -*/ - for(var $arrayAccess of Query.search("arrayAccess")) { - println("Array var: " + $arrayAccess.arrayVar.name); - println($arrayAccess.code + "->" + $arrayAccess.use); - } - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/ArrayTest.js b/ClavaWeaver/resources/clava/test/weaver/ArrayTest.js new file mode 100644 index 0000000000..ae33fd2f5b --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ArrayTest.js @@ -0,0 +1,8 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("function", "constantArrays").search( + "vardecl" +)) { + console.log($vardecl.name + " dims: " + $vardecl.type.arrayDims); + console.log($vardecl.name + "array size: " + $vardecl.type.arraySize); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ArrayTest.lara b/ClavaWeaver/resources/clava/test/weaver/ArrayTest.lara deleted file mode 100644 index 0bdaf61278..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ArrayTest.lara +++ /dev/null @@ -1,10 +0,0 @@ -import weaver.Query; - -aspectdef ArrayTest - - for(var $vardecl of Query.search('function', 'constantArrays').search('vardecl')) { - println($vardecl.name + " dims: " + $vardecl.type.arrayDims); - println($vardecl.name + "array size: " + $vardecl.type.arraySize); - } - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/AstAttributes.js b/ClavaWeaver/resources/clava/test/weaver/AstAttributes.js new file mode 100644 index 0000000000..21ba788144 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AstAttributes.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("vardecl", "a")) { + console.log("Type kind:" + $vardecl.type.kind); + console.log("Is builtin? " + $vardecl.type.astIsInstance("BuiltinType")); + console.log("Is decl? " + $vardecl.astIsInstance("Decl")); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/AstAttributes.lara b/ClavaWeaver/resources/clava/test/weaver/AstAttributes.lara deleted file mode 100644 index be758af070..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AstAttributes.lara +++ /dev/null @@ -1,10 +0,0 @@ -aspectdef AstAttributes - - select vardecl{"a"} end - apply - println("Type kind:" + $vardecl.type.kind); - println("Is builtin? " + $vardecl.type.astIsInstance("BuiltinType")); - println("Is decl? " + $vardecl.astIsInstance("Decl")); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/AstNodes.js b/ClavaWeaver/resources/clava/test/weaver/AstNodes.js new file mode 100644 index 0000000000..dd96a13fdb --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AstNodes.js @@ -0,0 +1,25 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import Ast from "@specs-feup/lara/api/weaver/Ast.js"; + +for (const $if of Query.search("function", "testNodes").search("if")) { + console.log("astNumChildren = " + $if.astNumChildren); + console.log("astChildren = " + $if.astChildren); + console.log("astChild(0) = " + $if.getAstChild(0)); + console.log("numChildren = " + $if.numChildren); + console.log("children = " + $if.children); + console.log("child(0) = " + $if.getChild(0)); + console.log('astAncestor("Decl") = ' + $if.getAstAncestor("Decl").name); +} + +console.log("\n\nAst API:"); +for (const $if of Query.search("function", "testNodes").search("if")) { + const astNode = $if.node; + + console.log("astNumChildren = " + Ast.getNumChildren(astNode)); + console.log( + "astChildren = " + + Ast.getChildren(astNode).map((node) => + node.getClass().getSimpleName() + ) + ); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/AstNodes.lara b/ClavaWeaver/resources/clava/test/weaver/AstNodes.lara deleted file mode 100644 index 9625961f3d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AstNodes.lara +++ /dev/null @@ -1,27 +0,0 @@ -import weaver.Query; -import weaver.Ast; - -aspectdef AstNodes - - select function{"testNodes"}.if end - apply - println('astNumChildren = ' + $if.astNumChildren); - println('astChildren = ' + $if.astChildren); - println('astChild(0) = ' + $if.getAstChild(0)); - println('numChildren = ' + $if.numChildren); - println('children = ' + $if.children); - println('child(0) = ' + $if.getChild(0)); - println('astAncestor("Decl") = ' + $if.getAstAncestor('Decl').name); - end - - println("\n\nAst API:"); - for(var $if of Query.search("function", "testNodes").search("if")) { - var astNode = $if.node; - - println('astNumChildren = ' + Ast.getNumChildren(astNode)); - println('astChildren = ' + Ast.getChildren(astNode).map(node => node.getClass().getSimpleName())); - } - -end - - diff --git a/ClavaWeaver/resources/clava/test/weaver/AttributeUse.js b/ClavaWeaver/resources/clava/test/weaver/AttributeUse.js new file mode 100644 index 0000000000..426b2b6e2e --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/AttributeUse.js @@ -0,0 +1,11 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +console.log("VARREF:"); +for (const $varref of Query.search("varref")) { + console.log($varref.code + "->" + $varref.use); +} + +console.log("ARRAY ACCESS:"); +for (const $arrayAccess of Query.search("arrayAccess")) { + console.log($arrayAccess.code + "->" + $arrayAccess.use); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/AttributeUse.lara b/ClavaWeaver/resources/clava/test/weaver/AttributeUse.lara deleted file mode 100644 index bc1ba20e53..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/AttributeUse.lara +++ /dev/null @@ -1,14 +0,0 @@ -aspectdef AttributeUse - - println("VARREF:"); - select stmt.varref end - apply - println($varref.code + "->" + $varref.use); - end - - println("ARRAY ACCESS:"); - select stmt.arrayAccess end - apply - println($arrayAccess.code + "->" + $arrayAccess.use); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Break.js b/ClavaWeaver/resources/clava/test/weaver/Break.js index 6d43d5761c..66c3dfa766 100644 --- a/ClavaWeaver/resources/clava/test/weaver/Break.js +++ b/ClavaWeaver/resources/clava/test/weaver/Break.js @@ -1,8 +1,8 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; for (const $break of Query.search("function", "foo").search("break")) { const enclosingStmt = $break.enclosingStmt; - println( + console.log( "Break enclosing statement: " + enclosingStmt.joinPointType + "@" + diff --git a/ClavaWeaver/resources/clava/test/weaver/Call.js b/ClavaWeaver/resources/clava/test/weaver/Call.js new file mode 100644 index 0000000000..f15656d865 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Call.js @@ -0,0 +1,40 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +let $firstOp = undefined; +for (const $binaryOp of Query.search("binaryOp")) { + $firstOp = $binaryOp; +} + +for (const $call of Query.search("call", "foo")) { + console.log("foo original:" + $call.code); + var arg1 = $call.getArg(1); + $call.setArg(0, arg1); + console.log("foo new expr arg:" + $call.code); + $call.setArgFromString(1, "10"); + console.log("foo new string arg:" + $call.code); + $call.setArg(1, $firstOp); + console.log("foo op arg:" + $call.code); +} + +for (const $call of Query.search("call", "foo2")) { + // Member access + console.log("Decl:" + $call.declaration.line); + console.log("Def:" + $call.definition.line); +} + +const functionRegex = /function*/; +for (const $call of Query.search("call")) { + if (!functionRegex.test($call.name)) { + continue; + } + console.log( + "function decl of call is definition?: " + $call.function.hasDefinition + ); +} + +for (const $call of Query.search("function", "main").search("call", "printf")) { + console.log( + "printf call has function decl?: " + ($call.function !== undefined) + ); + break; +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Call.lara b/ClavaWeaver/resources/clava/test/weaver/Call.lara deleted file mode 100644 index f440593eb7..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Call.lara +++ /dev/null @@ -1,46 +0,0 @@ -aspectdef CallTest - - var $firstOp = undefined; - select binaryOp end - apply - $firstOp = $binaryOp; - end - - select call{"foo"} end - apply - println("foo original:" + $call.code); - var arg1 = $call.getArg(1); - $call.exec setArg(0, arg1); - println("foo new expr arg:" + $call.code); - $call.exec setArgFromString(1, '10'); - println("foo new string arg:" + $call.code); - $call.exec setArg(1, $firstOp); - println("foo op arg:" + $call.code); - end - - - // Member access - select call{"foo2"} end - apply - //println("Call: " + $call.code); - //println("Call name: " + $call.name); - println("Decl:" + $call.declaration.line); - println("Def:" + $call.definition.line); - end - - var functionRegex = /function*/; - select call end - apply - if(!functionRegex.test($call.name)) { - continue; - } - println("function decl of call is definition?: " + $call.function.hasDefinition); - end - - select function{"main"}.call{"printf"} end - apply - println("printf call has function decl?: " + ($call.function !== undefined)); - //println("function of printf call has definition?: " + $call.function.hasDefinition); - break; - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/CanonicalTest.js b/ClavaWeaver/resources/clava/test/weaver/CanonicalTest.js index 3793d982cf..c6617cdc14 100644 --- a/ClavaWeaver/resources/clava/test/weaver/CanonicalTest.js +++ b/ClavaWeaver/resources/clava/test/weaver/CanonicalTest.js @@ -1,6 +1,6 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; // Canonical functions for(const $function of Query.search("function", {isCanonical: true})) { - println("Canonical function " + $function.signature + " at line " + $function.line); + console.log("Canonical function " + $function.signature + " at line " + $function.line); } \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Cfg.js b/ClavaWeaver/resources/clava/test/weaver/Cfg.js new file mode 100644 index 0000000000..9e40d94165 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Cfg.js @@ -0,0 +1,13 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const chain of Query.search("function").search("call").chain()) { + const $function = chain["function"]; + const $call = chain["call"]; + + console.log($function.name + " -> " + $call.name); + console.log($function.location + " -> " + $call.location); + const location = $call.decl.location; + if (!location.includes(".h")) { + console.log(location); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Cfg.lara b/ClavaWeaver/resources/clava/test/weaver/Cfg.lara deleted file mode 100644 index 7a2c337e93..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Cfg.lara +++ /dev/null @@ -1,29 +0,0 @@ -import weaver.Query; - -aspectdef Test - - for(var chain of Query.search("function").search("call").chain()) { - var $function = chain["function"]; - var $call = chain["call"]; - - println($function.name + " -> " + $call.name); - println($function.location + " -> " + $call.location); - var location = $call.decl.location; - if(!location.includes(".h")) { - println(location); - } - -/* - for(var $function of Query.search("function")) { - - - try { - println($function.body.cfg); - } catch(e) { - println("Could not generate cfg for scope in location " + $scope.location); - println(e); - } -*/ - } - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Cilk.js b/ClavaWeaver/resources/clava/test/weaver/Cilk.js new file mode 100644 index 0000000000..e579c73b42 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Cilk.js @@ -0,0 +1,13 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $cilkFor of Query.search("cilkFor")) { + console.log("CilkFor: " + $cilkFor.location); +} + +for (const $cilkSpawn of Query.search("cilkSpawn")) { + console.log("CilkSpawn: " + $cilkSpawn.location); +} + +for (const $cilkSync of Query.search("cilkSync")) { + console.log("CilkSync: " + $cilkSync.location); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Cilk.lara b/ClavaWeaver/resources/clava/test/weaver/Cilk.lara deleted file mode 100644 index 8cba6567f7..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Cilk.lara +++ /dev/null @@ -1,18 +0,0 @@ -aspectdef CilkTest - - select cilkFor end - apply - println("CilkFor: " + $cilkFor.location); - end - - select cilkSpawn end - apply - println("CilkSpawn: " + $cilkSpawn.location); - end - - select cilkSync end - apply - println("CilkSync: " + $cilkSync.location); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Class.js b/ClavaWeaver/resources/clava/test/weaver/Class.js index 67b79e0247..d374015b0f 100644 --- a/ClavaWeaver/resources/clava/test/weaver/Class.js +++ b/ClavaWeaver/resources/clava/test/weaver/Class.js @@ -1,18 +1,18 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; for(let $class of Query.search("class")) { - println("Class: " + $class.name); - println("Is abstract: " + $class.isAbstract); - println("Is interface: " + $class.isInterface); + console.log("Class: " + $class.name); + console.log("Is abstract: " + $class.isAbstract); + console.log("Is interface: " + $class.isInterface); - println("All Bases:"); + console.log("All Bases:"); for(let $base of $class.allBases) { - println($base.name); + console.log($base.name); } - println("All methods:") + console.log("All methods:") for(let $function of $class.allMethods) { - println($function.signature); - //println("Is pure? " + $function.isPure); + console.log($function.signature); + //console.log("Is pure? " + $function.isPure); } } \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.js b/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.js new file mode 100644 index 0000000000..1176b873fd --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.js @@ -0,0 +1,70 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function testCopyMethodDeclaration() { + const $class = Query.search("class", "originalClass").first(); + + const $method = Query.searchFrom($class, "method", "foo").first(); + + const $newMethod = $method.clone("new_" + $method.name, false); + + const $newClass = ClavaJoinPoints.classDecl("newClass"); + $newClass.addMethod($newMethod); + + console.log("Test Copy Method Declaration"); + console.log("CLASS: " + $class.code); + console.log("NEW CLASS: " + $newClass.code); +} + +function testCopyMethodDefinition() { + const $class = Query.search("class", "originalClass2").first(); + + const $method = Query.search("method", { + name: "foo2", + hasDefinition: true, + }).first(); + + const $newMethod = $method.clone("new_" + $method.name, false); + + const $newClass = ClavaJoinPoints.classDecl("newClass2"); + $newClass.addMethod($newMethod); + + console.log("Test Copy Method Definition"); + console.log("CLASS: " + $class.code); + console.log("METHOD: " + $method.code); + console.log("NEW CLASS: " + $newClass.code); + console.log("NEW METHOD: " + $newMethod.code); + + // If $newMethod.declarationJp is called before adding $newClass to the program, + // it will returned undefined due to Clava caching queries to declarationJp/definitionJp + console.log("METHOD DECL BEFORE ADDING CLASS: " + $newMethod.declarationJp); + $class.getAncestor("file").insertAfter($newClass); + console.log("METHOD DECL AFTER ADDING CLASS: " + $newMethod.declarationJp); +} + +function testCopyTypedef() { + // This should trigger a case where a copy() override in TypeDecl needs to handle a case with a typedef + const $typedefCopy = Query.search("typedefDecl").first().deepCopy(); + console.log("Typedef: " + $typedefCopy.code); +} + +function testAddField() { + const $class = Query.search("class", "originalClass4").first(); + const $newField = ClavaJoinPoints.field( + "b", + ClavaJoinPoints.builtinType("double") + ); + $class.addField($newField); + console.log("CLASS WITH NEW FIELD: " + $class.code); +} + +function testBases() { + const pig = Query.search("class", "Pig").first(); + console.log("Pig bases: " + pig.bases[0].name); +} + +testCopyMethodDeclaration(); +testCopyMethodDefinition(); +testCopyTypedef(); +testAddField(); +testBases(); diff --git a/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.lara b/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.lara deleted file mode 100644 index 17dd57645f..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ClassManipulation.lara +++ /dev/null @@ -1,104 +0,0 @@ -import clava.ClavaJoinPoints; -import clava.Clava; -import weaver.Query; - -aspectdef ClassManipulation - - testCopyMethodDeclaration(); - testCopyMethodDefinition(); - testCopyTypedef(); - testAddField(); - testBases(); -end - - -function testCopyMethodDeclaration() { - - var $class = Query.search("class", "originalClass").first(); - - - var $method = Query.searchFrom($class, "method", "foo").first(); - - var $newMethod = $method.clone("new_" + $method.name, false); - - var $newClass = ClavaJoinPoints.classDecl("newClass"); - $newClass.addMethod($newMethod); - - println("Test Copy Method Declaration"); - println("CLASS: " + $class.code); - println("NEW CLASS: " + $newClass.code); - -} - -function testCopyMethodDefinition() { - - var $class = Query.search("class", "originalClass2").first(); - - - var $method = Query.search("method", {name: "foo2", hasDefinition: true}).first(); - - - - var $newMethod = $method.clone("new_" + $method.name, false); - - //var $newMethod = $method.deepCopy(); - var $newClass = ClavaJoinPoints.classDecl("newClass2"); - $newClass.addMethod($newMethod); - - - - println("Test Copy Method Definition"); - println("CLASS: " + $class.code); - println("METHOD: " + $method.code); - println("NEW CLASS: " + $newClass.code); - println("NEW METHOD: " + $newMethod.code); - - - // If $newMethod.declarationJp is called before adding $newClass to the program, - // it will returned undefined due to Clava caching queries to declarationJp/definitionJp - println("METHOD DECL BEFORE ADDING CLASS: " + $newMethod.declarationJp); - $class.getAncestor("file").insertAfter($newClass); - println("METHOD DECL AFTER ADDING CLASS: " + $newMethod.declarationJp); - - - - //$newMethod.name = "new_" + $newMethod.name; - -} - - -function testCopyTypedef() { - // This should trigger a case where a copy() override in TypeDecl needs to handle a case with a typedef - var $typedefCopy = Query.search("typedefDecl").first().deepCopy(); - println("Typedef: " + $typedefCopy.code); -/* - var $class = Query.search("class", "originalClass3").first(); - - - var $method = Query.searchFrom($class, "method", "foo3").first(); - - var $newMethod = $method.clone("new_" + $method.name, false); - - var $newClass = ClavaJoinPoints.classDecl("newClass3"); - $newClass.addMethod($newMethod); - - println("Test Copy Method With Typedef"); - println("CLASS: " + $class.code); - println("NEW CLASS: " + $newClass.code); -*/ -} - -function testAddField() { - var $class = Query.search("class", "originalClass4").first(); - var $newField = ClavaJoinPoints.field("b", ClavaJoinPoints.builtinType("double")); - $class.addField($newField); - println("CLASS WITH NEW FIELD: " + $class.code); -} - - -function testBases() { - - var pig = Query.search("class", "Pig").first(); - println("Pig bases: " + pig.bases[0].name); - -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Clone.js b/ClavaWeaver/resources/clava/test/weaver/Clone.js new file mode 100644 index 0000000000..611cec60de --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Clone.js @@ -0,0 +1,10 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import { FunctionJp, FileJp } from "@specs-feup/clava/api/Joinpoints.js"; + +for (const $function of Query.search(FunctionJp, { hasDefinition: true })) { + $function.clone("new_" + $function.name); +} + +for (const $file of Query.search(FileJp)) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Clone.lara b/ClavaWeaver/resources/clava/test/weaver/Clone.lara deleted file mode 100644 index bf7931ce01..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Clone.lara +++ /dev/null @@ -1,12 +0,0 @@ -aspectdef ClavaSandbox - - select function{hasDefinition === true} end - apply - $function.exec clone('new_' + $function.name); - end - - select file end - apply - println($file.code); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.js b/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.js new file mode 100644 index 0000000000..3add879ce1 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $foo = Query.search("function", "foo").first(); + +const $foo2 = $foo.cloneOnFile("foo2", "bar/newFile.cpp"); + +console.log($foo2.getAncestor("file").includes.map((inc) => inc.code)); diff --git a/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.lara b/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.lara deleted file mode 100644 index c383192bd7..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/CloneOnFile.lara +++ /dev/null @@ -1,12 +0,0 @@ -import clava.Clava; -import weaver.Query; - -aspectdef CloneOnFile - - var $foo = Query.search("function", "foo").first(); - - var $foo2 = $foo.cloneOnFile("foo2", "bar/newFile.cpp"); - - println($foo2.getAncestor("file").includes.map(inc => inc.code)); - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Cuda.js b/ClavaWeaver/resources/clava/test/weaver/Cuda.js new file mode 100644 index 0000000000..ef84cb9f94 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Cuda.js @@ -0,0 +1,39 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Test CUDA kernel call +for (const $call of Query.search("function", "main").search("cudaKernelCall")) { + console.log("kernel call before: " + $call.code); + //console.log("Original: " + $call.config.map(node => node.code)); + $call.setConfigFromStrings(["20", "2048"]); + //console.log("Modified: " + $call.config.map(node => node.code)); + console.log("kernel call after: " + $call.code); +} + +// Find CUDA kernel +const $cudaKernel = Query.search("function", { isCudaKernel: true }).first(); +console.log("CUDA kernel: " + $cudaKernel.name); + +// Print attributes +for (const $attr of $cudaKernel.attrs) { + console.log("Attr kind: " + $attr.kind); +} + +// Add parameter to CUDA kernel +$cudaKernel.addParam("bool inst0"); +console.log("After adding param: " + $cudaKernel.getDeclaration(false)); + +// Add argumento to call +const $cudaKernelCall = Query.search("function", "main") + .search("cudaKernelCall") + .first(); +$cudaKernelCall.addArg("false", ClavaJoinPoints.typeLiteral("bool")); +console.log("Call after adding arg: " + $cudaKernelCall.code); + +// Get properties +for (const $varref of Query.searchFrom($cudaKernel, "varref", { + hasProperty: true, +})) { + console.log("Varref: " + $varref.name); + console.log("Cuda index: " + $varref.property); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Cuda.lara b/ClavaWeaver/resources/clava/test/weaver/Cuda.lara deleted file mode 100644 index 93bb2f974d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Cuda.lara +++ /dev/null @@ -1,40 +0,0 @@ -import clava.ClavaJoinPoints; -import weaver.Query; - - -aspectdef Cuda - - // Test CUDA kernel call - for(var $call of Query.search("function", "main").search("cudaKernelCall")) { - println("kernel call before: " + $call.code); - //println("Original: " + $call.config.map(node => node.code)); - $call.setConfigFromStrings(["20", "2048"]); - //println("Modified: " + $call.config.map(node => node.code)); - println("kernel call after: " + $call.code); - } - - // Find CUDA kernel - var $cudaKernel = Query.search("function", {isCudaKernel: true}).first(); - println("CUDA kernel: " + $cudaKernel.name); - - // Print attributes - for(var $attr of $cudaKernel.attrs) { - println("Attr kind: " + $attr.kind); - } - - // Add parameter to CUDA kernel - $cudaKernel.addParam("bool inst0"); - println("After adding param: " + $cudaKernel.getDeclaration(false)); - - // Add argumento to call - var $cudaKernelCall = Query.search("function", "main").search("cudaKernelCall").first(); - $cudaKernelCall.addArg("false", ClavaJoinPoints.typeLiteral("bool")); - println("Call after adding arg: " + $cudaKernelCall.code); - - // Get properties - for(var $varref of Query.searchFrom($cudaKernel, "varref", {hasProperty: true})) { - println("Varref: " + $varref.name); - println("Cuda index: " + $varref.property); - } - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.js b/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.js new file mode 100644 index 0000000000..848b4d76aa --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.js @@ -0,0 +1,9 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $vardecl = Query.search("function", "multiMatrix") + .search("vardecl", "s_a") + .first(); +for (const $attr of $vardecl.attrs) { + console.log("Attr kind: " + $attr.kind); + console.log("Attr code: " + $attr.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.lara b/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.lara deleted file mode 100644 index 65bdca5165..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/CudaMatrixMul.lara +++ /dev/null @@ -1,14 +0,0 @@ -import clava.ClavaJoinPoints; -import weaver.Query; - - -aspectdef CudaMatrixMul - - var $vardecl = Query.search("function", "multiMatrix").search("vardecl", "s_a").first(); - for(var $attr of $vardecl.attrs) { - println("Attr kind: " + $attr.kind); - println("Attr code: " + $attr.code); - } - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/CudaQuery.js b/ClavaWeaver/resources/clava/test/weaver/CudaQuery.js new file mode 100644 index 0000000000..4a43609cfd --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/CudaQuery.js @@ -0,0 +1,5 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $jp of Query.search("arrayAccess")) { + console.log("arrayAccess var: " + $jp.name); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/CudaQuery.lara b/ClavaWeaver/resources/clava/test/weaver/CudaQuery.lara deleted file mode 100644 index 9cf8a4fb56..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/CudaQuery.lara +++ /dev/null @@ -1,13 +0,0 @@ -import weaver.Query; - -aspectdef CudaQuery - - for(var $jp of Query.search("arrayAccess")) { - println("arrayAccess var: " + $jp.name); - } -/* - for(var $jp of Query.search("varref")) { - println("code: " + $jp.code + " name: " + $jp.name); - } -*/ -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/DataClass.js b/ClavaWeaver/resources/clava/test/weaver/DataClass.js new file mode 100644 index 0000000000..e66bab17a8 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/DataClass.js @@ -0,0 +1,9 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $method of Query.search("method")) { + const tinits = $method.getValue("constructorInits"); + + for (const tinit of tinits) { + console.log("InitExpr class: " + tinit.getValue("initExpr").getClass()); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/DataClass.lara b/ClavaWeaver/resources/clava/test/weaver/DataClass.lara deleted file mode 100644 index bc05281431..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/DataClass.lara +++ /dev/null @@ -1,17 +0,0 @@ -aspectdef DataClass - - select method end - apply - var tinits = $method.getValue("constructorInits"); - //println("TINITS CLASS: " + tinits.getClass()); - for(var tinit of tinits) { - - //println("TINIT: " + typeof tinit); - //println("Class: " + tinit.getClass()); - //tinit.getRaw("anyMemberDecl"); - println("InitExpr class: " + tinit.getValue("initExpr").getClass()); - } - - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Detach.js b/ClavaWeaver/resources/clava/test/weaver/Detach.js new file mode 100644 index 0000000000..4afb366dad --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Detach.js @@ -0,0 +1,13 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $loop of Query.search("loop")) { + $loop.insertBefore("#pragma omp parallel for"); +} + +for (const $omp of Query.search("omp")) { + if ($omp.target.isInnermost) { + $omp.detach(); + } +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/Detach.lara b/ClavaWeaver/resources/clava/test/weaver/Detach.lara deleted file mode 100644 index ffb16cf9d8..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Detach.lara +++ /dev/null @@ -1,21 +0,0 @@ -aspectdef Detach - - select loop end - apply - $loop.insert before "#pragma omp parallel for"; - end - - - select omp end - apply - if($omp.target.isInnermost) { - $omp.detach(); - } - end - - select program end - apply - println($program.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Dijkstra.js b/ClavaWeaver/resources/clava/test/weaver/Dijkstra.js new file mode 100644 index 0000000000..6c82861163 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Dijkstra.js @@ -0,0 +1,19 @@ +import JavaTypes from "@specs-feup/lara/api/lara/util/JavaTypes.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const tic = JavaTypes.LaraI.getCurrentTime(); +let acc = 0; + +let toc; +for (const $function of Query.search("function", { name: "exact_rhs" })) { + for (const _ of Query.searchFrom($function.body, "varref")) { + toc = JavaTypes.LaraI.getCurrentTime(); + console.log("Time:" + (toc - tic)); + acc += 1; + } +} + +const toc2 = JavaTypes.LaraI.getCurrentTime(); +console.log("Time 2:" + (toc2 - toc)); + +console.log("Found " + acc + " variables"); diff --git a/ClavaWeaver/resources/clava/test/weaver/Dijkstra.lara b/ClavaWeaver/resources/clava/test/weaver/Dijkstra.lara deleted file mode 100644 index e4f20916c9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Dijkstra.lara +++ /dev/null @@ -1,19 +0,0 @@ -import lara.util.JavaTypes; - -aspectdef Dijkstra - - var tic = JavaTypes.LaraI.getThreadLocalLarai().getWeaver().currentTime(); - select function{"exact_rhs"}.body.childStmt.varref{"i"} end - var toc = JavaTypes.LaraI.getThreadLocalLarai().getWeaver().currentTime(); - println("Time:" + (toc-tic)); - var acc = 0; - apply - acc += 1; - //println("VARREF:" + $varref.name); - end - var toc2 = JavaTypes.LaraI.getThreadLocalLarai().getWeaver().currentTime(); - println("Time 2:" + (toc2-toc)); - - println("Found " + acc + " variables"); - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.js b/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.js new file mode 100644 index 0000000000..fbe066ed3f --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.js @@ -0,0 +1,153 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import Logger from "@specs-feup/clava/api/lara/code/Logger.js"; +import TupleId from "@specs-feup/lara/api/lara/util/TupleId.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +/** + * Inserts code for increments as a comma operator, + * as suggested by Pedro Silva (up201304961@fc.up.pt) + */ +const _DCG_USE_COMMA_OPERATOR_ = true; + +let graphFile; + +/** + * Instruments code in order to build a runtime call graph. + * + * If _DCG_USE_COMMA_OPERATOR_ is true, it will take into account execution + * when functions are called as part of a short-circuit operation, + * e.g., foo() || foo2(), when foo() returns true, the call to foo2() is not counted. + * However, if for any reason the comma operator cannot be used, + * set _DCG_USE_COMMA_OPERATOR_ to false (it is true by default), + * and an alternative method is used that will not take into account short-circuit operators. + */ + +const tupleId = new TupleId(); + +const dcgName = "clava_dcg_global"; + +/* Instrument function calls and increment the corresponding position */ +for (const chain of Query.search("function").search("call").chain()) { + const $function = chain["function"]; + const $call = chain["call"]; + + const id = tupleId.getId($function.name, $call.name); + + insertIncrement($call, dcgName + "[ " + id + " ]++"); +} + +// Get tuples and count them +const tuples = tupleId.getTuples(); +let total = 0; +for (const key in tuples) { + total++; +} + +/* Declare the array in each file */ +for (const chain of Query.search("file").search("function").chain()) { + const $file = chain["file"]; + const $function = chain["function"]; + + if ($file.hasMain) { + $function.insertBefore(`int ${dcgName}[ ${total} ] = {0};`); + } else { + $function.insertBefore(`extern int ${dcgName}[ ${total} ];`); + } + break; +} + +// Build function to print call graph +const callgraphFunctionName = "clava_call_graph"; +const $callgraph = ClavaJoinPoints.functionDecl( + callgraphFunctionName, + ClavaJoinPoints.builtinType("void") +); +$callgraph.setBody(ClavaJoinPoints.scope()); + +// Using a comment as a marker for log insertions +const $markerStmt = $callgraph.body.insertBegin( + ClavaJoinPoints.stmtLiteral("// MARKER") +); + +// Insert function before main + +for (const $function of Query.search("function", "main")) { + // Just before main declaration + if (!$function.hasDefinition) { + continue; + } + + $function.insertBefore($callgraph); + + // Insert only once + break; +} + +const graphLogger = new Logger(false, graphFile); +graphLogger.append("digraph dynamic_call_graph {").ln().ln().log($markerStmt); + +let $lastStmt = graphLogger.getAfterJp(); + +for (const id in tuples) { + const tuple = tuples[id]; + + const dcgCount = dcgName + "[" + id + "]"; + $lastStmt = $lastStmt.insertAfter( + ClavaJoinPoints.ifStmt(dcgCount + " != 0") + ); + + graphLogger + .append("\t" + tuple[0] + " -> " + tuple[1] + ' [label=\\"') + .int(dcgCount) + .append('\\"];') + .ln() + .logBefore($lastStmt.then); +} + +graphLogger.append("}").ln().log($lastStmt); + +// Remove marker stmt +$markerStmt.detach(); + +// Register function to be executed when program exits +Clava.getProgram().atexit($callgraph); + +console.log(Clava.getProgram().code); + +function insertIncrement($call, code) { + // Increments using comma operator + if (_DCG_USE_COMMA_OPERATOR_) { + // First, replace call with parenthesis + const $parenthesis = $call.replaceWith( + ClavaJoinPoints.parenthesis("/* DCG TEMP */") + ); + + // Create comma operator + const $commaOp = ClavaJoinPoints.binaryOp( + "comma", + code, + $call, + $call.type + ); + + // Replace parenthesis child + $parenthesis.firstChild = $commaOp; + + return; + } + + // Increments using statements, add ; + code += ";"; + + // If call is inside a loop header (e.g., for, while), + // insert increment at the beginning of the loop body + if ($call.isInsideLoopHeader) { + const $loop = $call.getAncestor("loop"); + checkDefined($loop); + $loop.body.insertBegin(code); + return; + } + + $call.insertBefore(code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.lara b/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.lara deleted file mode 100644 index b31ea5d83c..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/DynamicCallGraph.lara +++ /dev/null @@ -1,153 +0,0 @@ -import clava.ClavaJoinPoints; -import clava.Clava; -import lara.code.Logger; -import lara.util.TupleId; - - -/** -* Inserts code for increments as a comma operator, -* as suggested by Pedro Silva (up201304961@fc.up.pt) -*/ -var _DCG_USE_COMMA_OPERATOR_ = true; - - -/** - * Instruments code in order to build a runtime call graph. - * - * If _DCG_USE_COMMA_OPERATOR_ is true, it will take into account execution - * when functions are called as part of a short-circuit operation, - * e.g., foo() || foo2(), when foo() returns true, the call to foo2() is not counted. - * However, if for any reason the comma operator cannot be used, - * set _DCG_USE_COMMA_OPERATOR_ to false (it is true by default), - * and an alternative method is used that will not take into account short-circuit operators. - */ -aspectdef DynamicCallGraph - input graphFile end - - var tupleId = new TupleId(); - - var dcgName = "clava_dcg_global"; - - /* Instrument function calls and increment the corresponding position */ - select function.call end - apply - var id = tupleId.getId($function.name, $call.name); - var codeExpr = dcgName + '[ '+id+' ]++'; - //var codeStmt = codeExpr + ";"; - insertIncrement($call, dcgName + '[ '+id+' ]++'); - end - - // Get tuples and count them - var tuples = tupleId.getTuples(); - var total = 0; - for(var key in tuples) { - total++; - } - - /* Declare the array in each file */ - select file.function end - apply - if($file.hasMain) { - insert before 'int [[dcgName]][ [[total]] ] = {0};'; - } else { - insert before 'extern int [[dcgName]][ [[total]] ];'; - } - break; - end - - - // Build function to print call graph - var callgraphFunctionName = "clava_call_graph"; - var $callgraph = ClavaJoinPoints.functionDecl(callgraphFunctionName, ClavaJoinPoints.builtinType("void")); - $callgraph.setBody(ClavaJoinPoints.scope()); - - // Using a comment as a marker for log insertions - var $markerStmt = $callgraph.body.insertBegin(ClavaJoinPoints.stmtLiteral("// MARKER")); - - // Insert function before main - select program.function{"main"} end - apply - // Just before main declaration - if(!$function.hasDefinition) { - continue; - } - - $function.insertBefore($callgraph); - - // Insert only once - break; - end - - var graphLogger = new Logger(false, graphFile); - graphLogger.append("digraph dynamic_call_graph {") - .ln().ln().log($markerStmt); - - - var $lastStmt = graphLogger.getAfterJp(); - - for(var id in tuples) { - var tuple = tuples[id]; - - var dcgCount = dcgName+"["+id+"]"; - $lastStmt = $lastStmt.insertAfter(ClavaJoinPoints.ifStmt(dcgCount + " != 0")); - - graphLogger.append("\t"+tuple[0]+" -> "+tuple[1]+' [label=\\"') - .int(dcgCount) - .append('\\"];').ln() - .logBefore($lastStmt.then); - - } - - - graphLogger.append("}").ln().log($lastStmt); - - // Remove marker stmt - $markerStmt.detach(); - - // Register function to be executed when program exits - Clava.getProgram().atexit($callgraph); - - //println('\nDynamicCallGraph done!'); - println(Clava.getProgram().code); -end - - -function insertIncrement($call, code) { - // Increments using comma operator - if(_DCG_USE_COMMA_OPERATOR_) { - // First, replace call with parenthesis - var $parenthesis = $call.replaceWith(ClavaJoinPoints.parenthesis("/* DCG TEMP */")); - - // Create comma operator - var $commaOp = ClavaJoinPoints.binaryOp("comma", code, $call, $call.type); - - // Replace parenthesis child - $parenthesis.firstChild = $commaOp; - - return; - } - - // Increments using statements, add ; - code += ";"; - - // If call is inside a loop header (e.g., for, while), - // insert increment at the beginning of the loop body - if($call.isInsideLoopHeader) { - var $loop = $call.getAncestor('loop'); - checkDefined($loop); - $loop.body.insertBegin(code); - return; - } - -/* - // If inside return stmt, insert increment before - var $return = $call.getAncestor('return'); - if($return !== undefined) { - $return.insert before code; - return; - } -*/ - - $call.insert before code; -} - diff --git a/ClavaWeaver/resources/clava/test/weaver/EmptyStmt.js b/ClavaWeaver/resources/clava/test/weaver/EmptyStmt.js index 18062a2664..6cd068d63a 100644 --- a/ClavaWeaver/resources/clava/test/weaver/EmptyStmt.js +++ b/ClavaWeaver/resources/clava/test/weaver/EmptyStmt.js @@ -1,7 +1,7 @@ -laraImport("weaver.Query") +import Query from "@specs-feup/lara/api/weaver/Query.js"; -for(const $emptyStmt of Query.search("function", "main").search("emptyStmt")) { - println("EmptyStmt: " + $emptyStmt.line) +for (const $emptyStmt of Query.search("function", "main").search("emptyStmt")) { + console.log("EmptyStmt: " + $emptyStmt.line); } -println(Query.root().code) \ No newline at end of file +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/ExprStmt.js b/ClavaWeaver/resources/clava/test/weaver/ExprStmt.js index 17a8a9a98c..a8467a0ca9 100644 --- a/ClavaWeaver/resources/clava/test/weaver/ExprStmt.js +++ b/ClavaWeaver/resources/clava/test/weaver/ExprStmt.js @@ -1,8 +1,8 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; for (const $loop of Query.search("function", "loopExprStmt").search("loop")) { - println(`Loop ${$loop.line} cond: ${$loop.cond.code}`); + console.log(`Loop ${$loop.line} cond: ${$loop.cond.code}`); if ($loop.step !== undefined) { - println(`Loop ${$loop.line} step: ${$loop.step.code}`); + console.log(`Loop ${$loop.line} step: ${$loop.step.code}`); } } diff --git a/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.js b/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.js new file mode 100644 index 0000000000..67cf4b30bf --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.js @@ -0,0 +1,23 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function printExprDecl($expr) { + const $exprDecl = $expr.decl; + if ($exprDecl === undefined) { + return; + } + + console.log("Expr: " + $expr.node.getClass()); + console.log("Decl: " + $exprDecl.node.getClass()); +} + +for (const $expr of Query.search("function", "expressionDecls").search( + "expression" +)) { + printExprDecl($expr); +} + +for (const $expr of Query.search("function", "temporaryExpressionDecl").search( + "expression" +)) { + printExprDecl($expr); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.lara b/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.lara deleted file mode 100644 index 1b7236da04..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ExpressionDecls.lara +++ /dev/null @@ -1,24 +0,0 @@ -import weaver.Query; - -aspectdef ExpressionDecls - - for(var $expr of Query.search("function", "expressionDecls").search("expression")) { - printExprDecl($expr); - } - - for(var $expr of Query.search("function", "temporaryExpressionDecl").search("expression")) { - printExprDecl($expr); - } - -end - -function printExprDecl($expr) { - var $exprDecl = $expr.decl; - if($exprDecl === undefined) { - return; - } - - println("Expr: " + $expr.node.getClass()); - println("Decl: " + $exprDecl.node.getClass()); - -} diff --git a/ClavaWeaver/resources/clava/test/weaver/Expressions.js b/ClavaWeaver/resources/clava/test/weaver/Expressions.js new file mode 100644 index 0000000000..a8e1dad660 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Expressions.js @@ -0,0 +1,30 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// MemberAccess chains +for (const $memberAccess of Query.search("function", "analyse").search( + "memberAccess" +)) { + console.log( + "MemberChain Types:" + + $memberAccess.memberChain.map((m) => m.joinPointType) + ); + console.log("MemberChain Names:" + $memberAccess.memberChainNames); +} + +// Obtain corresponding declaration for each varref + +for (const $varref of Query.search("function", "analyse").search( + "varref" +)) { + const vardecl = $varref.vardecl; + console.log("varref:" + $varref.name); + console.log("has decl:" + (vardecl != undefined)); +} + +for (const $newExpr of Query.search("newExpr")) { + console.log("NewExpr: " + $newExpr.code); +} + +for (const $deleteExpr of Query.search("deleteExpr")) { + console.log("DeleteExpr: " + $deleteExpr.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Expressions.lara b/ClavaWeaver/resources/clava/test/weaver/Expressions.lara deleted file mode 100644 index 1f97165481..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Expressions.lara +++ /dev/null @@ -1,29 +0,0 @@ -aspectdef Expression - - // MemberAccess chains - select function{"analyse"}.memberAccess end - apply - println("MemberChain Types:" + $memberAccess.memberChain.map(m => m.joinPointType)); - println("MemberChain Names:" + $memberAccess.memberChainNames); - end - - // Obtain corresponding declaration for each varref - select function{"analyse"}.varref end - apply - //println("VARREF LOC:" + $varref.location); - var vardecl = $varref.vardecl; - println("varref:" + $varref.name); - println("has decl:" + (vardecl != undefined)); - end - - select newExpr end - apply - println("NewExpr: " + $newExpr.code); - end - - select deleteExpr end - apply - println("DeleteExpr: " + $deleteExpr.code); - end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Field.js b/ClavaWeaver/resources/clava/test/weaver/Field.js new file mode 100644 index 0000000000..fb3456a43e --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Field.js @@ -0,0 +1,14 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import { Field, RecordJp } from "@specs-feup/clava/api/Joinpoints.js"; + +console.log("AClass fields"); +for (const $field of Query.search(RecordJp, "AClass").search(Field)) { + console.log("Field: " + $field.name); + console.log("Is public: " + $field.isPublic); +} + +console.log("AStruct fields"); +for (const $field of Query.search(RecordJp, "AStruct").search(Field)) { + console.log("Field: " + $field.name); + console.log("Is public: " + $field.isPublic); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Field.lara b/ClavaWeaver/resources/clava/test/weaver/Field.lara deleted file mode 100644 index 17640aca9b..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Field.lara +++ /dev/null @@ -1,18 +0,0 @@ -aspectdef FieldTest - - println("AClass fields"); - select record{"AClass"}.field end - apply - println("Field: " + $field.name); - println("Is public: " + $field.isPublic); - end - - println("AStruct fields"); - select record{"AStruct"}.field end - apply - println("Field: " + $field.name); - println("Is public: " + $field.isPublic); - end - - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/FieldRef.js b/ClavaWeaver/resources/clava/test/weaver/FieldRef.js new file mode 100644 index 0000000000..70010bb232 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/FieldRef.js @@ -0,0 +1,10 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const cl = Query.search("class", "Foo3").first(); +console.log("CLASS: " + cl.ast); +console.log("Number of Fields:"); +console.log(Query.searchFrom(cl, "field").get().length); +console.log(Query.searchFromInclusive(cl, "field").get().length); +console.log("Number of Classes:"); +console.log(Query.searchFrom(cl, "class").get().length); +console.log(Query.searchFromInclusive(cl, "class").get().length); diff --git a/ClavaWeaver/resources/clava/test/weaver/FieldRef.lara b/ClavaWeaver/resources/clava/test/weaver/FieldRef.lara deleted file mode 100644 index 8256f2da69..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/FieldRef.lara +++ /dev/null @@ -1,14 +0,0 @@ -import weaver.Query; - -aspectdef FieldRef - - var cl = Query.search("class", "Foo3").first(); - println("CLASS: " + cl.ast); - println("Number of Fields:"); - println(Query.searchFrom(cl, "field").get().length); - println(Query.searchFromInclusive(cl, "field").get().length); - println("Number of Classes:"); - println(Query.searchFrom(cl, "class").get().length); - println(Query.searchFromInclusive(cl, "class").get().length); - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/File.js b/ClavaWeaver/resources/clava/test/weaver/File.js new file mode 100644 index 0000000000..d24b993351 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/File.js @@ -0,0 +1,16 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +const $file = Query.search("file").first(); + +const $program = Query.root(); +$program.addFile(ClavaJoinPoints.file("user_include.h")); +$program.addFile(ClavaJoinPoints.file("system_include.h")); +$program.addFile(ClavaJoinPoints.file("c_include.h")); + +// Includes +$file.addInclude("user_include.h"); +$file.addInclude("system_include.h", true); +$file.addCInclude("c_include.h"); + +console.log($file.code); diff --git a/ClavaWeaver/resources/clava/test/weaver/File.lara b/ClavaWeaver/resources/clava/test/weaver/File.lara deleted file mode 100644 index ef05501300..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/File.lara +++ /dev/null @@ -1,20 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; - -aspectdef FileTest - - var $file = Query.search('file').first(); - - var $program = Query.root(); - $program.addFile(ClavaJoinPoints.file("user_include.h")); - $program.addFile(ClavaJoinPoints.file("system_include.h")); - $program.addFile(ClavaJoinPoints.file("c_include.h")); - - // Includes - $file.addInclude("user_include.h"); - $file.addInclude("system_include.h", true); - $file.addCInclude("c_include.h"); - - println($file.code); -end - diff --git a/ClavaWeaver/resources/clava/test/weaver/FileRebuild.js b/ClavaWeaver/resources/clava/test/weaver/FileRebuild.js new file mode 100644 index 0000000000..8fc9711982 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/FileRebuild.js @@ -0,0 +1,21 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Add literal stmt +Query.search("file", "file_rebuild.h").first().insert("after", "void foo2();"); + +console.log("file_rebuild.h before:"); +for (const $function of Query.search("file", "file_rebuild.h").search( + "function" +)) { + console.log("Function: " + $function.signature); +} + +// Rebuild file +Query.search("file", "file_rebuild.h").first().rebuild(); + +console.log("file_rebuild.h after:"); +for (const $function of Query.search("file", "file_rebuild.h").search( + "function" +)) { + console.log("Function: " + $function.signature); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/FileRebuild.lara b/ClavaWeaver/resources/clava/test/weaver/FileRebuild.lara deleted file mode 100644 index 5c2b556ee9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/FileRebuild.lara +++ /dev/null @@ -1,29 +0,0 @@ -aspectdef FileRebuild - - - - // Add literal stmt - select file{"file_rebuild.h"} end - apply - $file.insert after "void foo2();"; - end - - println("file_rebuild.h before:"); - select file{"file_rebuild.h"}.function end - apply - println("Function: " + $function.signature); - end - - // Rebuild file - select file{"file_rebuild.h"} end - apply - $file.rebuild(); - end - - println("file_rebuild.h after:"); - select file{"file_rebuild.h"}.function end - apply - println("Function: " + $function.signature); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Function.js b/ClavaWeaver/resources/clava/test/weaver/Function.js new file mode 100644 index 0000000000..15fb4b3563 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Function.js @@ -0,0 +1,36 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $function of Query.search("function")) { + const fName = $function.name; + if (fName != "Max" && fName != "MaxNoInline") { + continue; + } + + console.log($function.name + " is inline: " + $function.isInline); +} + +// Set name +for (const $function of Query.search("file", "function.cpp").search( + "function" +)) { + const fName = $function.name; + if ( + fName != "defOnly" && + fName != "declOnly" && + fName != "declAndDef" && + fName != "notCalled" + ) { + continue; + } + + //console.log("FILE BEFORE SET:\n" + $file.code); + const newName = fName + "New"; + $function.name = newName; + //console.log("FILE AFTER SET:\n" + $file.code); + + console.log("Function new name: " + $function.name); +} + +for (const $function of Query.search("function", "caller")) { + console.log("Caller body: " + $function.body.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Function.lara b/ClavaWeaver/resources/clava/test/weaver/Function.lara deleted file mode 100644 index 9ebe62e227..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Function.lara +++ /dev/null @@ -1,36 +0,0 @@ -aspectdef FunctionTest - - select function end - apply - var fName = $function.name; - if(fName != "Max" && fName != "MaxNoInline") { - continue; - } - - println($function.name + " is inline: " + $function.isInline); - end - - // Set name - select file{"function.cpp"}.function end - apply - - var fName = $function.name; - if(fName != "defOnly" && fName != "declOnly" && fName != "declAndDef" && fName != "notCalled") { - continue; - } - - //println("FILE BEFORE SET:\n" + $file.code); - var newName = fName + "New"; - $function.name = newName; - //println("FILE AFTER SET:\n" + $file.code); - - println("Function new name: " + $function.name); - end - - select function{"caller"}.body end - apply - println("Caller body: " + $body.code); - end - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Function2.js b/ClavaWeaver/resources/clava/test/weaver/Function2.js new file mode 100644 index 0000000000..fce9bf06c0 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Function2.js @@ -0,0 +1,22 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import { FunctionJp } from "@specs-feup/clava/api/Joinpoints.js"; + +const $d = Query.search(FunctionJp, { isImplementation: true }).first(); +if (!$d) { + throw new Error("No function found"); +} + +const $fn = $d.clone($d.name + "_"); +$d.setReturnType(ClavaJoinPoints.typeLiteral("void")); + +$d.body.replaceWith(ClavaJoinPoints.scope()); + +$fn.addParam( + "ret", + ClavaJoinPoints.typeLiteral($fn.type.code + ($fn.type.isPointer ? "" : "*")) +); +console.log($d.params.map(($param) => $param.name)); +console.log($fn.params.map(($param) => $param.name)); + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/Function2.lara b/ClavaWeaver/resources/clava/test/weaver/Function2.lara deleted file mode 100644 index 16612c118d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Function2.lara +++ /dev/null @@ -1,17 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; - -aspectdef OCL_Experiments - var $d = Query.search("function", {isImplementation: true}).first(); - var $fn = $d.clone($d.name+"_"); - $d.setReturnType(ClavaJoinPoints.typeLiteral("void")); - //$fn.type = ClavaJoinPoints.typeLiteral("void"); - $d.body.replaceWith(ClavaJoinPoints.scope()); - - - $fn.addParam("ret", ClavaJoinPoints.typeLiteral($fn.type.code + ($fn.type.isPointer ? "" : "*"))); - println($d.params.map($param => $param.name)); - println($fn.params.map($param => $param.name)); - - println(Query.root().code); -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.js b/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.js new file mode 100644 index 0000000000..64557b4140 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.js @@ -0,0 +1,22 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("function", "main").search( + "vardecl", + "a" +)) { + console.log("- Testing keys, setValue, getValue -"); + const $type = $vardecl.type; + console.log("type keys: " + $type.keys); + console.log("type builtin kind: " + $type.getValue("builtinKind")); + $vardecl.type = $type.copy().setValue("builtinKind", "float"); + console.log("Changed vardecl: " + $vardecl.code); +} + +console.log("Inside header:"); +for (const $function of Query.search("function", "insideHeader")) { + for (const $jp of $function.descendants) { + if ($jp.isInsideHeader) { + console.log($jp.joinPointType + " -> " + $jp.code); + } + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.lara b/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.lara deleted file mode 100644 index 83aed23b1f..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/GlobalAttributes.lara +++ /dev/null @@ -1,28 +0,0 @@ -import weaver.Query; - -aspectdef GlobalAttributes - - select function{"main"}.vardecl{"a"} end - apply - println("- Testing keys, setValue, getValue -"); - var $type = $vardecl.type; - println("type keys: " + $type.keys); - println("type builtin kind: " + $type.getValue('builtinKind')); - $vardecl.type = $type.copy().setValue('builtinKind', 'float'); - println("Changed vardecl: " + $vardecl.code); - end - - - println("Inside header:"); - for(var $function of Query.search('function', 'insideHeader')) { - for(var $jp of $function.descendants) { - if($jp.isInsideHeader) { - println($jp.joinPointType + " -> " + $jp.code); - } - } - - } - - //println(Query.root().ast); - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/HamidCfg.js b/ClavaWeaver/resources/clava/test/weaver/HamidCfg.js new file mode 100644 index 0000000000..98d1e7793c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/HamidCfg.js @@ -0,0 +1,376 @@ +import Format from "@specs-feup/clava/api/clava/Format.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const Nodes = []; +let curr_node_ID = -1; + +const Edges = []; + +const level = []; +let curr_level_index = -1; + +let sub_graph = ""; +let sub_graph_index = -1; + +const function_list = []; + +function add_edges(src, dst) { + const edge = "ID" + src + "->ID" + dst; + Edges.push(edge); +} + +function increase_curr_level_index(type) { + type = typeof type !== "undefined" ? type : "not defined"; + curr_level_index++; + level.push({ Type: type, Nodes: [], firstNode: -1, lastNode: -1 }); + + if ( + level[curr_level_index].Type == "function" || + level[curr_level_index].Type == "ForStmt" || + level[curr_level_index].Type == "WhileStmt" + ) { + sub_graph_index++; + sub_graph += "\nsubgraph cluster_" + sub_graph_index + "{\n"; + } +} + +function decrease_curr_level_index() { + if ( + level[curr_level_index].Type == "function" || + level[curr_level_index].Type == "ForStmt" || + level[curr_level_index].Type == "WhileStmt" + ) { + sub_graph += "\n}\n"; + } + + level.pop(); + curr_level_index--; +} + +/************************************************************** + * + * MAIN + * + **************************************************************/ + +for (const $function of Query.search("file").search("function")) { + // Using same color to be able to generate the same code for the unit test + const str_color = "#AAAAAA"; + function_list.push({ Name: $function.name, node_ID: -1, color: str_color }); +} + +for (const $function of Query.search("function", "dijkstra")) { + add_funtion_to_graph($function); +} + +print_DOT(); + +/********************************************/ +function add_funtion_to_graph($func) { + increase_curr_level_index("function"); + + // add current $func + add_node("function", $func.name); + + // update node_ID for function in function_list + const obj = SearchStruct(function_list, "Name", $func.name); + obj[0]["node_ID"] = curr_node_ID; + + for (const $childStmt of $func.body.stmts) { + add_stmt_to_graph($childStmt); + } + + decrease_curr_level_index(); +} + +/********************************************/ +function add_stmt_to_graph($stmt) { + switch ($stmt.astName) { + case "ForStmt": + addNode_ForStmt($stmt); + break; + case "WhileStmt": + addNode_ForStmt($stmt); + break; + case "WrapperStmt": + // Do nothing ... it is a Comment + break; + case "DeclStmt": + addNode_DeclStmt($stmt); + break; + case "ExprStmt": + addNode_ExprStmt($stmt); // should be same as DeclStmt ??? + break; + case "IfStmt": + addNode_IfStmt($stmt); + break; + case "ReturnStmt": + addNode_ReturnStmt($stmt); + break; + + default: + console.log( + "ERROR : not defined . . . for stmt.astName = " + $stmt.astName + ); + } +} + +/********************************************/ +function addNode_IfStmt($stmt) { + const label = " then | IF #" + $stmt.line + "| else"; + add_node("IfStmt", label); + + // add then stmt + if ($stmt.then != null) { + increase_curr_level_index("IfStmtThen"); + + for (const $childStmt of $stmt.then.stmts) { + add_stmt_to_graph($childStmt); + } + + add_edges( + level[curr_level_index - 1].lastNode + ":then", + level[curr_level_index].firstNode + ); + add_edges( + level[curr_level_index].lastNode, + level[curr_level_index - 1].lastNode + ":then" + ); + decrease_curr_level_index(); + } + + // add else stmt + if ($stmt.else != null) { + increase_curr_level_index("IfStmtElse"); + + for (const $childStmt of $stmt.else.stmts) { + add_stmt_to_graph($childStmt); + } + + add_edges( + level[curr_level_index - 1].lastNode + ":else", + level[curr_level_index].firstNode + ); + add_edges( + level[curr_level_index].lastNode, + level[curr_level_index - 1].lastNode + ":else" + ); + decrease_curr_level_index(); + } +} + +/********************************************/ +function addNode_ReturnStmt($stmt) { + const label = "Return"; + add_node("ReturnStmt", label); +} + +/********************************************/ +function addNode_DeclStmt($stmt) { + const label = "{ " + $stmt.astName + " #" + $stmt.line + "}"; + add_node("DeclStmt", label); +} + +/********************************************/ +function addNode_ExprStmt($stmt) { + const funcCalls = checkforFuncCalls($stmt); + if (funcCalls.length > 0) { + let label = '<'; + for (const func_name of funcCalls) { + const find_obj = SearchStruct(function_list, "Name", func_name); + const color = find_obj[0]["color"]; + label += + '"; + } + label += "
' + func_name + "
>"; + add_node("FuncCall", label, funcCalls); + } else { + const label = "{ " + $stmt.astName + " #" + $stmt.line + "}"; + add_node("ExprStmt", label); + } +} + +/********************************************/ +function addNode_ForStmt($stmt) { + increase_curr_level_index($stmt.astName); + + const label = + " loop | " + + $stmt.kind + + " For #" + + $stmt.line + + "| else"; + + add_node($stmt.astName, $stmt.kind.toUpperCase() + " #" + $stmt.line); + + if (level[curr_level_index - 1].lastNode != -1) + add_edges(level[curr_level_index - 1].lastNode, curr_node_ID); + else level[curr_level_index - 1].firstNode = curr_node_ID; + + level[curr_level_index - 1].lastNode = curr_node_ID; + + for (const $childStmt of $stmt.body.stmts) { + add_stmt_to_graph($childStmt); + } + + add_edges( + level[curr_level_index].lastNode, + level[curr_level_index].firstNode + ); + decrease_curr_level_index(); +} + +/********************************************/ +function checkforFuncCalls($stmt) { + const calls = []; + + for (const $call of Query.searchFrom($stmt, "call")) { + if (SearchStruct(function_list, "Name", $call.name).length == 1) { + calls.push($call.name); + } + } + + return calls; +} + +/* >>>>>>>>>>>>>>>> Graph Functions <<<<<<<<<<<<<<<<<<<<<<*/ +function add_node(type, label, func_calls) { + func_calls = typeof func_calls !== "undefined" ? func_calls : []; + + const node_ID = ++curr_node_ID; + + const node_obj = { + Node_ID: node_ID, + Type: type, + Label: label, + Func_Calls: func_calls, + Shape: return_node_shape(type), + }; + Nodes.push(node_obj); + + sub_graph += "ID" + node_ID + " "; + + if (level[curr_level_index].firstNode == -1) { + level[curr_level_index].firstNode = curr_node_ID; + } else { + add_edges(level[curr_level_index].lastNode, curr_node_ID); + } + level[curr_level_index].lastNode = curr_node_ID; + level[curr_level_index].Nodes.push(curr_node_ID); +} + +function add_func_calls_dependency() { + for (const obj of Nodes) + for (const func_call_Name of obj["Func_Calls"]) { + const func_call_node = SearchStruct( + function_list, + "Name", + func_call_Name + ); + obj["Child_Node_ID"].push(func_call_node[0]["node_ID"]); + } +} + +function return_node_shape(type) { + switch (type) { + case "function": + return ",shape = Msquare "; + case "FuncCall": + return ",shape = Mrecord"; + case "ForStmt": + return ",shape = doubleoctagon"; + case "WhileStmt": + return ",shape = doubleoctagon"; + case "DeclStmt": + return ""; + case "ExprStmt": + return ""; + case "IfStmt": + return ",shape = Mrecord"; + case "ReturnStmt": + return ",shape = Msquare "; + default: + console.log( + "return_node_shape ERROR : type " + type + " not defined . . ." + ); + } +} + +function SearchStruct(structObj, filedName, value) { + return structObj.filter(function (obj) { + return obj[filedName] == value; + }); +} + +function update_node(node_ID, filedName, value) { + const obj = SearchStruct(Nodes, "Node_ID", node_ID); + if (obj.length == 1) { + if (filedName == "Child_Node_ID") obj[0][filedName].push(value); + else obj[0][filedName] = value; + } else if (obj.length > 1) + console.log( + "update_node func :ERROR . . . multiple node" + + " with same Node_ID = " + + node_ID + + " exist !!!" + ); + else + console.log( + "update_node func : ERROR . . . Node_ID = " + + node_ID + + " not exist !!!" + ); +} + +function return_node_attribute(node_ID, filedName) { + const obj = SearchStruct(Nodes, "Node_ID", node_ID); + if (obj.length == 1) { + return obj[0][filedName]; + } else if (obj.length > 1) + console.log( + "return_node_attribute func :ERROR . . . multiple node" + + " with same Node_ID = " + + node_ID + + " exist !!!" + ); + else + console.log( + "return_node_attribute func : ERROR . . . Node_ID = " + + node_ID + + " not exist !!!" + ); +} + +function print_DOT() { + console.log("digraph my_DOT{"); + // print nodes attributes + console.log("\t node [shape=record]"); + for (const obj of Nodes) { + let str = "\t\tID" + obj["Node_ID"]; + + if (obj["Type"] != "FuncCall") + str += ' [label="' + Format.escape(obj["Label"]) + '"'; + else str += " [label=" + obj["Label"]; + + str += obj["Shape"]; + + if (obj["Type"] == "function") { + const find_obj = SearchStruct(function_list, "Name", obj["Label"]); + str += ',style=filled, fillcolor="' + find_obj[0]["color"] + '"'; + } + + str += "]"; + console.log(str); + } + + console.log(); + + for (const edge of Edges) { + console.log("\t\t" + edge); + } + + console.log("\n"); + // classified nodes into subgraphs + console.log(sub_graph); + console.log("}"); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/HamidCfg.lara b/ClavaWeaver/resources/clava/test/weaver/HamidCfg.lara deleted file mode 100644 index 0f7f32a168..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/HamidCfg.lara +++ /dev/null @@ -1,449 +0,0 @@ -import clava.Format; - -var Nodes = []; -var curr_node_ID = -1; - -var Edges = []; - -var level = []; -var curr_level_index = -1; - -var sub_graph = ''; -var sub_graph_index = -1; - -var function_list = []; - -function add_edges(src,dst) -{ - var edge = 'ID' + src + '->ID' + dst; - Edges.push(edge); -} - -function increase_curr_level_index(type) -{ - type = (typeof type !== 'undefined') ? type : 'not defined'; - curr_level_index++; - level.push({Type:type, Nodes : [], firstNode:-1, lastNode: -1}); - - if (level[curr_level_index].Type == 'function' || - level[curr_level_index].Type == 'ForStmt' || - level[curr_level_index].Type == 'WhileStmt') - { - sub_graph_index ++; - sub_graph += '\nsubgraph cluster_' + sub_graph_index + '{\n'; - } - -} - -function decrease_curr_level_index() -{ - if (level[curr_level_index].Type == 'function' || - level[curr_level_index].Type == 'ForStmt' || - level[curr_level_index].Type == 'WhileStmt') - { - sub_graph += '\n}\n'; - } - - level.pop(); - curr_level_index--; -} - -/************************************************************** - * - * MAIN - * -**************************************************************/ -aspectdef my_test - - - select program end - apply - //$program.exec rebuild(); - end - - select program.file.function end - apply - //var str_color = '#'+(Math.random()*0xFFFFFF<<0).toString(16); - //var str_color = '#'+Math.floor(Math.random()*16777215).toString(16); - // Using same color to be able to generate the same code for the unit test - var str_color = '#AAAAAA'; - function_list.push({ Name:$function.name, node_ID:-1, color:str_color}); - //println($function.name); - end - - //select function end - select function{'dijkstra'} end - apply - call add_funtion_to_graph($function); - end - - //add_func_calls_dependency(); - print_DOT(); - -end - -/********************************************/ -aspectdef add_funtion_to_graph - input $func end - - increase_curr_level_index('function'); - - // add current $func - add_node('function',$func.name); - - - // update node_ID for function in function_list - var obj = SearchStruct(function_list,'Name',$func.name); - obj[0]['node_ID'] = curr_node_ID; - - - select $func.body.childStmt end - apply - call add_stmt_to_graph($childStmt); - //println($childStmt.astName); - end - - decrease_curr_level_index(); -end - -/********************************************/ -aspectdef add_stmt_to_graph - input $stmt end - - - - switch ($stmt.astName) - { - case 'ForStmt': - call addNode_ForStmt($stmt); - break; - case 'WhileStmt': - call addNode_ForStmt($stmt); - break; - case 'WrapperStmt': - // Do nothing ... it is a Comment - break; - case 'DeclStmt': - call addNode_DeclStmt($stmt); - break; - case 'ExprStmt': - call addNode_ExprStmt($stmt); // should be same as DeclStmt ??? - break; - case 'IfStmt': - call addNode_IfStmt($stmt); - break; - case 'ReturnStmt': - call addNode_ReturnStmt($stmt); - break; - - default: - println('ERROR : not defined . . . for stmt.astName = '+ $stmt.astName); - } - - -end - - -/********************************************/ -aspectdef addNode_IfStmt - input $stmt end - - var label = ' then | IF #'+ $stmt.line + '| else'; - add_node('IfStmt', label); - - // add then stmt - if ($stmt.then != null) - increase_curr_level_index('IfStmtThen'); - - select $stmt.then.childStmt end - apply - call add_stmt_to_graph($childStmt); - end - - if ($stmt.then != null) - { - add_edges(level[curr_level_index-1].lastNode + ':then', - level[curr_level_index].firstNode); - add_edges(level[curr_level_index].lastNode, - level[curr_level_index-1].lastNode + ':then'); - decrease_curr_level_index(); - } - - - // add else stmt - if ($stmt.else != null) - increase_curr_level_index('IfStmtElse'); - - - select $stmt.else.childStmt end - apply - call add_stmt_to_graph($childStmt); - end - - if ($stmt.else != null) - { - add_edges(level[curr_level_index-1].lastNode + ':else', - level[curr_level_index].firstNode); - add_edges(level[curr_level_index].lastNode, - level[curr_level_index-1].lastNode + ':else'); - decrease_curr_level_index(); - } - - -end -/********************************************/ -aspectdef addNode_ReturnStmt - input $stmt end - - var label = 'Return'; - add_node('ReturnStmt',label); -end - -/********************************************/ -aspectdef addNode_DeclStmt - input $stmt end - - var label = '{ '+ $stmt.astName + ' #'+ $stmt.line + '}'; - add_node('DeclStmt',label); - -end -/********************************************/ -aspectdef addNode_ExprStmt - input $stmt end - - call FuncCalls : checkforFuncCalls($stmt); - if(FuncCalls.calls.length > 0) - { - var label = '<'; - for (var func_name of FuncCalls.calls) - { - var find_obj = SearchStruct(function_list,'Name',func_name); - var color = find_obj[0]['color']; - label += ''; - } - label += '
'+ - func_name + '
>'; - add_node('FuncCall',label, FuncCalls.calls); - } - else - { - var label = '{ '+ $stmt.astName + ' #'+ $stmt.line + '}'; - add_node('ExprStmt',label); - } - -end -/********************************************/ -aspectdef addNode_ForStmt - input $stmt end - - increase_curr_level_index($stmt.astName); - - var label = ' loop | ' + $stmt.kind + - ' For #'+ $stmt.line + '| else'; - - add_node($stmt.astName,$stmt.kind.toUpperCase() + ' #' + $stmt.line ); - - if (level[curr_level_index-1].lastNode != -1) - add_edges(level[curr_level_index-1].lastNode, curr_node_ID); - else - level[curr_level_index-1].firstNode = curr_node_ID; - - level[curr_level_index-1].lastNode = curr_node_ID; - - select $stmt.body.childStmt end - apply - call add_stmt_to_graph($childStmt); - end - - add_edges(level[curr_level_index].lastNode, - level[curr_level_index].firstNode); - decrease_curr_level_index(); - -end - -/********************************************/ -aspectdef checkforFuncCalls - input $stmt end - output calls end - - this.calls = []; - select $stmt.call end - apply - if (SearchStruct(function_list,'Name',$call.name).length == 1) - { - this.calls.push($call.name); - } - end -end -/* >>>>>>>>>>>>>>>> Graph Functions <<<<<<<<<<<<<<<<<<<<<<*/ -function add_node(type,label,func_calls) -{ - func_calls = (typeof func_calls !== 'undefined') ? func_calls : []; - var add_edge_opt = (typeof add_edge_opt !== 'undefined') ? add_edge_opt : null; - - var node_ID = ++curr_node_ID; - - var node_obj = { - Node_ID : node_ID, - Type : type, - Label : label, - Func_Calls : func_calls, - Shape : return_node_shape(type), - }; - Nodes.push(node_obj); - - sub_graph += 'ID' + node_ID + ' '; - - if (level[curr_level_index].firstNode == -1) - { - level[curr_level_index].firstNode = curr_node_ID; - } - else - { - add_edges(level[curr_level_index].lastNode,curr_node_ID); - } - level[curr_level_index].lastNode = curr_node_ID; - level[curr_level_index].Nodes.push(curr_node_ID); -} - -function add_func_calls_dependency() -{ - for(var obj of Nodes) - for(var func_call_Name of obj['Func_Calls']) - { - var func_call_node = SearchStruct(function_list,'Name',func_call_Name); - obj['Child_Node_ID'].push(func_call_node[0]['node_ID']); - } - -} - -function return_node_shape(type) -{ - switch (type) - { - case 'function': - return ',shape = Msquare '; - case 'FuncCall': - return ',shape = Mrecord'; - case 'ForStmt': - return ',shape = doubleoctagon'; - case 'WhileStmt': - return ',shape = doubleoctagon'; - case 'DeclStmt': - return ''; - case 'ExprStmt': - return ''; - case 'IfStmt': - return ',shape = Mrecord'; - case 'ReturnStmt': - return ',shape = Msquare '; - default: - println('return_node_shape ERROR : type '+ type + - ' not defined . . .'); - } -} - -function SearchStruct(structObj, filedName, value ) -{ - return structObj.filter(function( obj ){return obj[filedName] ==value;}); -} - -function update_node(node_ID,filedName, value) -{ - var obj = SearchStruct(Nodes,'Node_ID',node_ID); - if (obj.length == 1) - { - if (filedName=='Child_Node_ID') - obj[0][filedName].push(value); - else - obj[0][filedName] = value; - } - else if (obj.length > 1) - println('update_node func :ERROR . . . multiple node' + - ' with same Node_ID = ' + node_ID + ' exist !!!'); - else - println('update_node func : ERROR . . . Node_ID = '+ - node_ID +' not exist !!!'); -} - -function return_node_attribute(node_ID,filedName) -{ - var obj = SearchStruct(Nodes,'Node_ID',node_ID); - if (obj.length == 1) - { - return obj[0][filedName]; - } - else if (obj.length > 1) - println('return_node_attribute func :ERROR . . . multiple node' + - ' with same Node_ID = ' + node_ID + ' exist !!!'); - else - println('return_node_attribute func : ERROR . . . Node_ID = '+ - node_ID +' not exist !!!'); - -} - - - - -function print_DOT() -{ - println('digraph my_DOT{'); - // print nodes attributes - //println('\t node [margin=0,width=0,height=0,shape=record]'); - println('\t node [shape=record]'); - for(var obj of Nodes) - { - var str = '\t\tID' + obj['Node_ID']; - - if (obj['Type'] != 'FuncCall') - str += ' [label=\"' + Format.escape(obj['Label']) + '\"'; - else - str += ' [label=' + obj['Label']; - - str += obj['Shape'] ; - - if (obj['Type'] == 'function') - { - var find_obj = SearchStruct(function_list,'Name',obj['Label']); - str += ',style=filled, fillcolor=\"'+ find_obj[0]['color']+'\"'; - } - - str += ']'; - println(str); - } - - println(); - // print data dependency between nodes - /* - for(var obj of Nodes) - { - var child_num = obj['Child_Node_ID'].length; - if (child_num> 0) - for( var child_id of obj['Child_Node_ID']) - { - var str = '\t\tID' + obj['Node_ID']; - str += '->ID' + child_id; - println(str); - } - } - */ - for(var edge of Edges) - { - println('\t\t' + edge); - } - - - println('\n'); - // classified nodes into subgraphs - println(sub_graph); - /* - for(var i=0;i<=sub_graph_index;i++ ) - { - println('\tsubgraph cluster_' + i + '{'); - println('\t\t' + sub_graph[i].toString() + ';'); - println('\t}'); - } - */ - - println('}'); -} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.js b/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.js new file mode 100644 index 0000000000..4f77827993 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.js @@ -0,0 +1,131 @@ +import Hdf5 from "@specs-feup/clava/api/clava/hdf5/Hdf5.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Format from "@specs-feup/clava/api/clava/Format.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +Launcher(); +Hdf5Types(undefined, undefined); + +function Launcher() { + let $records = []; + for (const $record of Query.search("record")) { + $records.push($record); + } + + const $hdf5LibFiles = Hdf5.toLibrary($records); + + // Output + for (const $file of $hdf5LibFiles) { + console.log($file.code); + + // Add files so that their syntax can be checked + Clava.getProgram().addFile($file); + } +} + +function Hdf5Types(srcFolder, namespace) { + // Folder for the generated files + const filepath = srcFolder + "/lara-generated"; + + // Create files for generated code + const $compTypeC = ClavaJoinPoints.file("CompType.cpp", filepath); + const $compTypeH = ClavaJoinPoints.file("CompType.h", filepath); + + // Add files to the program + + const $program = Clava.getProgram(); + $program.addFile($compTypeC); + $program.addFile($compTypeH); + + let hDeclarationsCode = ""; + + // Add include for CompTypes + $compTypeC.addInclude("CompType.h", false); + $compTypeC.addInclude("H5CompType.h", true); + + // For each record, create code + for (const $record of Query.search("file").search("record", { + kind: ["class", "struct"], + })) { + const className = $record.name + "Type"; + const typeName = "itype"; + + /* Generate code for .h file */ + + // Create declaration + hDeclarationsCode += HDeclaration($file.name, className); + + /* Generate code for .cpp file */ + + // Add include to the file where record is + $compTypeC.addIncludeJp($record); + + // Create code for translating C/C++ type to HDF5 type + + const result = RecordToHdf5($record, typeName); + const cxxFunction = CImplementation( + namespace, + className, + Format.addPrefix(result.code, " ") + ); + + $compTypeC.insertAfter(ClavaJoinPoints.declLiteral(cxxFunction)); + } + + /* Generate code for .h file */ + + // Add include to HDF5 CPP library + $compTypeH.addInclude("H5Cpp.h", true); + + // Create header code inside the target namespace + hDeclarationsCode = + "\nnamespace " + + namespace + + " {\n\n" + + Format.addPrefix(hDeclarationsCode, " ") + + "\n}\n"; + + // Insert code inside header file + $compTypeH.insertAfter(ClavaJoinPoints.declLiteral(hDeclarationsCode)); +} + +function HDeclaration(filename, className) { + return ` +// ${filename} +class ${className} { + public: + static H5::CompType GetCompType(); +}; + +`; +} + +function CImplementation(namespace, className, body) { + return ` +H5::CompType ${namespace}::${className}::GetCompType() { +${body} + + return itype; +} + +`; +} + +function RecordToHdf5($record, typeName) { + const recordName = $record.type.code; + let code = "H5::CompType " + typeName + "(sizeof(" + recordName + "));\n"; + + for (const $field of Query.search("record").search("field")) { + if ($field.type.constant) continue; // Ignore constant fields + if (!$field.isPublic) continue; // Ignore private fields + + fieldName = $field.name; + const HDF5Type = toHdf5($field.type); + if (HDF5Type === undefined) continue; // Warning message omitted for the example + const params = `"${fieldName}",offsetof(${recordName}, ${fieldName}), ${HDF5Type}`; + code += `${typeName}.insertMember(${params});` + "\n"; + } + + return code; +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.lara b/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.lara deleted file mode 100644 index 6858b574b3..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Hdf5Types.lara +++ /dev/null @@ -1,154 +0,0 @@ -import clava.hdf5.Hdf5; -import clava.Clava; -import clava.ClavaJoinPoints; -import clava.Format; - -aspectdef Launcher - - var $records = []; - select record end - apply - $records.push($record); - end - - var $hdf5LibFiles = Hdf5.toLibrary($records); - - - // Output - for(var $file of $hdf5LibFiles) { - println($file.code); - - // Add files so that their syntax can be checked - Clava.getProgram().addFile($file); - } - - // Example - //call Hdf5Types("./", "Routing"); -/* - // Output - select file{"CompType.h"} end - apply - println("Header File:"); - println($file.code); - end - - select file{"CompType.cpp"} end - apply - println("Implementation File:"); - println($file.code); - end -end -*/ -end - -aspectdef Hdf5Types - input - srcFolder, - namespace - end - - // Folder for the generated files - var filepath = srcFolder + "/lara-generated"; - - // Create files for generated code - var $compTypeC = ClavaJoinPoints.file("CompType.cpp", filepath); - var $compTypeH = ClavaJoinPoints.file("CompType.h", filepath); - - // Add files to the program - - select program end - apply - $program.exec addFile($compTypeC); - $program.exec addFile($compTypeH); - end - - - var hDeclarationsCode = ""; - - // Add include for CompTypes - $compTypeC.exec addInclude("CompType.h", false); - $compTypeC.exec addInclude("H5CompType.h", true); - - - // For each record, create code - //var recordCounter = 0; - select file.record{kind === "class", kind === "struct"} end - apply - //recordCounter++; - var className = $record.name + "Type"; - var typeName = "itype"; - - /* Generate code for .h file */ - - // Create declaration - hDeclarationsCode += HDeclaration($file.name, className); - - /* Generate code for .cpp file */ - - // Add include to the file where record is - $compTypeC.exec addIncludeJp($record); - - // Create code for translating C/C++ type to HDF5 type - - call result : RecordToHdf5($record, typeName); - var cxxFunction = CImplementation(namespace, className, Format.addPrefix(result.code, " ")); - - $compTypeC.exec insertAfter(ClavaJoinPoints.declLiteral(cxxFunction)); - end - - /* Generate code for .h file */ - - // Add include to HDF5 CPP library - $compTypeH.exec addInclude("H5Cpp.h", true); - - // Create header code inside the target namespace - hDeclarationsCode = '\nnamespace '+namespace +' {\n\n' + Format.addPrefix(hDeclarationsCode, " ") + "\n}\n"; - - // Insert code inside header file - $compTypeH.exec insertAfter(ClavaJoinPoints.declLiteral(hDeclarationsCode)); - -end - -codedef HDeclaration(filename, className) %{ -// [[filename]] -class [[className]] { - public: - static H5::CompType GetCompType(); -}; - -}% end - - -codedef CImplementation(namespace, className, body) %{ -H5::CompType [[namespace]]::[[className]]::GetCompType() { -[[body]] - - return itype; -} - -}% end - - -aspectdef RecordToHdf5 - input $record, typeName end - output code end - - var recordName = $record.type.code; - code = "H5::CompType "+ typeName +"(sizeof("+recordName+"));\n"; - - select $record.field end - apply - if($field.type.constant) continue; // Ignore constant fields - if(!$field.isPublic) continue; // Ignore private fields - - fieldName = $field.name; - var HDF5Type = toHdf5($field.type); - if(HDF5Type === undefined) continue; // Warning message omitted for the example - var params = %{"[[fieldName]]",offsetof([[recordName]], [[fieldName]]), [[HDF5Type]]}%; - code += %{[[typeName]].insertMember([[params]]);}% + "\n"; - end - -end - - - diff --git a/ClavaWeaver/resources/clava/test/weaver/If.js b/ClavaWeaver/resources/clava/test/weaver/If.js index 122803ddca..ebb266af5d 100644 --- a/ClavaWeaver/resources/clava/test/weaver/If.js +++ b/ClavaWeaver/resources/clava/test/weaver/If.js @@ -1,4 +1,4 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; for(const $if of Query.search("function", "scope_test").search("if")) { console.log("then", $if.then?.joinPointType); diff --git a/ClavaWeaver/resources/clava/test/weaver/IncludeLoc.js b/ClavaWeaver/resources/clava/test/weaver/IncludeLoc.js index b0730f6019..88a20f2ffb 100644 --- a/ClavaWeaver/resources/clava/test/weaver/IncludeLoc.js +++ b/ClavaWeaver/resources/clava/test/weaver/IncludeLoc.js @@ -1,5 +1,5 @@ -laraImport("weaver.Query") +import Query from "@specs-feup/lara/api/weaver/Query.js" for (const include of Query.search("include")) { - println(include.code + " -> " + include.line); -} \ No newline at end of file + console.log(include.code + " -> " + include.line); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Inline.js b/ClavaWeaver/resources/clava/test/weaver/Inline.js new file mode 100644 index 0000000000..fb6625eb91 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Inline.js @@ -0,0 +1,9 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $call of Query.search("function", "main").search("call")) { + $call.inline(); +} + +for (const $function of Query.search("function", "main")) { + console.log($function.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Inline.lara b/ClavaWeaver/resources/clava/test/weaver/Inline.lara deleted file mode 100644 index 8fa1183d3e..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Inline.lara +++ /dev/null @@ -1,18 +0,0 @@ -aspectdef Inline - - select function{"main"}.call end - apply - $call.exec inline; - end - - select function{"main"} end - apply - println($function.code); - end - /* - select function{"main"} end - apply - println($function.ast); - end - */ -end diff --git a/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.js b/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.js new file mode 100644 index 0000000000..0063d0fea9 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.js @@ -0,0 +1,5 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $call of Query.search("loop").search("call")) { + $call.inline(); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.lara b/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.lara deleted file mode 100644 index 9258e1e75e..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/InlineNasFt.lara +++ /dev/null @@ -1,10 +0,0 @@ -aspectdef InlineNasFt - - select loop.call end - apply - $call.inline(); - end - - -end - diff --git a/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.js b/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.js new file mode 100644 index 0000000000..0063d0fea9 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.js @@ -0,0 +1,5 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $call of Query.search("loop").search("call")) { + $call.inline(); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.lara b/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.lara deleted file mode 100644 index 9258e1e75e..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/InlineNasLu.lara +++ /dev/null @@ -1,10 +0,0 @@ -aspectdef InlineNasFt - - select loop.call end - apply - $call.inline(); - end - - -end - diff --git a/ClavaWeaver/resources/clava/test/weaver/InsertsJp.js b/ClavaWeaver/resources/clava/test/weaver/InsertsJp.js new file mode 100644 index 0000000000..ffd2256553 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/InsertsJp.js @@ -0,0 +1,81 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $bDecl = ClavaJoinPoints.varDecl("b", ClavaJoinPoints.integerLiteral(10)); +const $cDecl = ClavaJoinPoints.varDecl( + "c", + ClavaJoinPoints.integerLiteral("20") +); + +for (const $function of Query.search("function", "fooStmtBeforeAfter")) { + for (const $stmt of Query.searchFrom($function.body, "statement")) { + $stmt.insertBefore($bDecl); + $stmt.insertAfter($cDecl); + } +} + +for (const $function of Query.search("function", "fooStmtReplace")) { + for (const $stmt of Query.searchFrom($function.body, "statement")) { + $stmt.replaceWith($bDecl); + } +} + +for (const $function of Query.search("function", "fooBodyBeforeAfter")) { + $function.body.insertBegin($bDecl); + $function.body.insertEnd($cDecl); +} + +for (const $function of Query.search("function", "fooBodyReplace")) { + $function.body.replaceWith($bDecl); +} + +for (const $function of Query.search("function", "fooBodyEmptyBeforeAfter")) { + $function.body.insertBegin($bDecl); + $function.body.insertEnd($cDecl); +} + +for (const $function of Query.search("function", "fooBodyEmptyReplace")) { + $function.body.replaceWith($bDecl); +} + +for (const $function of Query.search("function", "fooCallBeforeAfter")) { + for (const $call of Query.searchFrom($function.body, "statement").search( + "call" + )) { + $call.insertBefore($bDecl); + $call.insertAfter($cDecl); + } +} + +const $double2 = ClavaJoinPoints.doubleLiteral(2.0); +const $double3 = ClavaJoinPoints.doubleLiteral("3.0"); +const $doubleType = ClavaJoinPoints.builtinType("double"); +const $powCall = ClavaJoinPoints.callFromName( + "pow", + $doubleType, + $double2, + $double3 +); + +for (const $function of Query.search("function", "fooCallReplace")) { + for (const $call of Query.searchFrom($function.body, "statement").search( + "call" + )) { + $call.replaceWith($powCall); + } +} + +for (const $function of Query.search("function", "fooBeforeAfter")) { + $function.insertBefore($bDecl); + $function.insertAfter($cDecl); +} + +const $dDecl = ClavaJoinPoints.varDecl("d", ClavaJoinPoints.integerLiteral(30)); +for (const $function of Query.search("function", "fooReplace")) { + $function.replaceWith($dDecl); +} + +// Output code +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/InsertsJp.lara b/ClavaWeaver/resources/clava/test/weaver/InsertsJp.lara deleted file mode 100644 index a7bc5eaecb..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/InsertsJp.lara +++ /dev/null @@ -1,78 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef InsertsJp - - - var $bDecl = ClavaJoinPoints.varDecl("b", ClavaJoinPoints.integerLiteral(10)); - var $cDecl = ClavaJoinPoints.varDecl("c", ClavaJoinPoints.integerLiteral("20")); - - select function{"fooStmtBeforeAfter"}.stmt end - apply - $stmt.exec insertBefore($bDecl); - $stmt.exec insertAfter($cDecl); - end - - select function{"fooStmtReplace"}.stmt end - apply - $stmt.exec replaceWith($bDecl); - end - - select function{"fooBodyBeforeAfter"}.body end - apply - $body.exec insertBegin($bDecl); - $body.exec insertEnd($cDecl); - end - - select function{"fooBodyReplace"}.body end - apply - $body.exec replaceWith($bDecl); - end - - select function{"fooBodyEmptyBeforeAfter"}.body end - apply - $body.exec insertBegin($bDecl); - $body.exec insertEnd($cDecl); - end - - select function{"fooBodyEmptyReplace"}.body end - apply - $body.exec replaceWith($bDecl); - end - - select function{"fooCallBeforeAfter"}.stmt.call end - apply - $call.exec insertBefore($bDecl); - $call.exec insertAfter($cDecl); - end - - - var $double2 = ClavaJoinPoints.doubleLiteral(2.0); - var $double3 = ClavaJoinPoints.doubleLiteral("3.0"); - var $doubleType = ClavaJoinPoints.builtinType("double"); - var $powCall = ClavaJoinPoints.callFromName("pow", $doubleType, $double2, $double3); - - select function{"fooCallReplace"}.stmt.call end - apply - $call.exec replaceWith($powCall); - end - - select function{"fooBeforeAfter"} end - apply - $function.exec insertBefore($bDecl); - $function.exec insertAfter($cDecl); - end - - var $dDecl = ClavaJoinPoints.varDecl("d", ClavaJoinPoints.integerLiteral(30)); - select function{"fooReplace"} end - apply - $function.exec replaceWith($dDecl); - end - - - - // Output code - select file end - apply - println($file.code); - end -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.js b/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.js new file mode 100644 index 0000000000..aced982b2f --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.js @@ -0,0 +1,71 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +for (const $function of Query.search("function", "fooStmtBeforeAfter")) { + for (const $stmt of Query.searchFrom($function.body, "statement")) { + $stmt.insertBefore("int b = 1;"); + $stmt.insertAfter("int c = a + b;"); + } +} + +for (const $function of Query.search("function", "fooStmtReplace")) { + for (const $stmt of Query.searchFrom($function.body, "statement")) { + $stmt.replaceWith(ClavaJoinPoints.stmtLiteral("int a = 100;")); + } +} + +for (const $function of Query.search("function", "fooBodyBeforeAfter")) { + $function.body.insert("before", "int b = 1;"); + $function.body.insert("after", "int c = a + b;"); +} + +for (const $function of Query.search("function", "fooBodyReplace")) { + $function.body.replaceWith(ClavaJoinPoints.scope(ClavaJoinPoints.stmtLiteral("int a = 100;"))); +} + +for (const $function of Query.search("function", "fooBodyEmptyBeforeAfter")) { + $function.body.insert("before", "int b = 1;"); + $function.body.insert("after", "int c = 2 + b;"); +} + +for (const $function of Query.search("function", "fooBodyEmptyReplace")) { + $function.body.replaceWith(ClavaJoinPoints.scope(ClavaJoinPoints.stmtLiteral("int a = 100;"))); +} + +for (const $function of Query.search("function", "fooCallBeforeAfter")) { + for (const $call of Query.searchFrom($function.body, "statement").search( + "call" + )) { + $call.insertBefore("int b = 1;"); + $call.insertAfter("int c = 2 + b;"); + } +} + +for (const $function of Query.search("function", "fooCallReplace")) { + for (const $call of Query.searchFrom($function.body, "statement").search( + "call" + )) { + $call.replaceWith("pow(2.0, 3.0)"); + } +} + +for (const $function of Query.search("function", "fooBeforeAfter")) { + $function.insertBefore("// A comment"); + $function.insertAfter("int GLOBAL = 10;"); +} + +for (const $function of Query.search("function", "fooReplace")) { + $function.replaceWith(`void fooReplaced() { +int a = 0; +}`); +} + +for (const $call of Query.search("function", "callsInsideFor").search("call")) { + $call.insertAfter("// After call"); + $call.insertAfter("// After call"); +} + +// Output code +for (const $file of Query.search("file")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.lara b/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.lara deleted file mode 100644 index fa8c75c3ef..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/InsertsLiteral.lara +++ /dev/null @@ -1,73 +0,0 @@ -aspectdef InsertsLiteral - - select function{"fooStmtBeforeAfter"}.stmt end - apply - $stmt.insert before "int b = 1;"; - $stmt.insert after "int c = a + b;"; - end - - select function{"fooStmtReplace"}.stmt end - apply - $stmt.insert replace "int a = 100;"; - end - - select function{"fooBodyBeforeAfter"}.body end - apply - $body.insert before "int b = 1;"; - $body.insert after "int c = a + b;"; - end - - select function{"fooBodyReplace"}.body end - apply - $body.insert replace "int a = 100;"; - end - - select function{"fooBodyEmptyBeforeAfter"}.body end - apply - $body.insert before "int b = 1;"; - $body.insert after "int c = 2 + b;"; - end - - select function{"fooBodyEmptyReplace"}.body end - apply - $body.insert replace "int a = 100;"; - end - - select function{"fooCallBeforeAfter"}.stmt.call end - apply - $call.insert before "int b = 1;"; - $call.insert after "int c = 2 + b;"; - end - - select function{"fooCallReplace"}.stmt.call end - apply - $call.insert replace "pow(2.0, 3.0)"; - end - - select function{"fooBeforeAfter"} end - apply - $function.insert before "// A comment"; - $function.insert after "int GLOBAL = 10;"; - end - - select function{"fooReplace"} end - apply - $function.insert replace %{void fooReplaced() { - int a = 0; -}}%; - end - - select function{"callsInsideFor"}.call end - apply - $call.insert after "// After call"; - $call.insertAfter("// After call"); - end - - - // Output code - select file end - apply - println($file.code); - end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/LaraGetter.js b/ClavaWeaver/resources/clava/test/weaver/LaraGetter.js new file mode 100644 index 0000000000..3981450e20 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/LaraGetter.js @@ -0,0 +1,24 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +const descendants = Clava.getProgram().descendants; +// descendants() does not work in newer versions of GraalVM +// For some reason, laraGetter is not being used in that case +//var descendants2 = Clava.getProgram().getDescendants('vardecl'); + +const filename = Clava.isCxx() ? "dummy.cpp" : "dummy.c"; + +const $app = Clava.getProgram(); +const $file = ClavaJoinPoints.file(filename, "lib"); +$file.insertBefore("// Hello"); + +$app.addFile($file); + +$app.firstChild.relativeFolderpath = $app.firstChild.relativeFolderpath; +$app.firstChild.getFirstJp("comment").text = "hello 2"; + +const obj = { i: 10 }; +obj.i++; +obj.i--; + +console.log($app.code); diff --git a/ClavaWeaver/resources/clava/test/weaver/LaraGetter.lara b/ClavaWeaver/resources/clava/test/weaver/LaraGetter.lara deleted file mode 100644 index e5bf9c6097..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/LaraGetter.lara +++ /dev/null @@ -1,29 +0,0 @@ -import weaver.Weaver; -import clava.Clava; -import clava.ClavaJoinPoints; - -aspectdef LaraGetterTest - - var descendants = Clava.getProgram().descendants; - // descendants() does not work in newer versions of GraalVM - // For some reason, laraGetter is not being used in that case - //var descendants2 = Clava.getProgram().getDescendants('vardecl'); - - var filename = Clava.isCxx() ? "dummy.cpp" : "dummy.c"; - - var $app = Clava.getProgram(); - var $file = ClavaJoinPoints.file(filename, "lib"); - //$file.insertBefore("// Hello"); - $file.insert before "// Hello"; - - $app.addFile($file); - - $app.firstChild.relativeFolderpath = $app.firstChild.relativeFolderpath; - $app.firstChild.getFirstJp('comment').text = "hello 2"; - - var obj = {i: 10}; - obj.i++; - obj.i--; - - println($app.code); -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Loop.js b/ClavaWeaver/resources/clava/test/weaver/Loop.js new file mode 100644 index 0000000000..b9d95dbcc3 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Loop.js @@ -0,0 +1,70 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +for (const $loop of Query.search("function", "main").search("loop")) { + console.log("loop control var: " + $loop.controlVar); + console.log("is innermost? " + $loop.isInnermost); + console.log("is outermost? " + $loop.isOutermost); + console.log("nested level: " + $loop.nestedLevel + "\n"); + console.log("rank: " + $loop.rank + "\n"); +} + +// Test iterationsExpr +for (const $loop of Query.search("function", "iterationsExpr").search("loop")) { + if ($loop.iterationsExpr === undefined) { + console.log("iterations expr: undefined"); + continue; + } + console.log("iterations expr: " + $loop.iterationsExpr.code); + console.log("iterations: " + $loop.iterations); +} + +// Test insertion in for header +const $headerInsert1 = Query.search("function", "headerInsert1") + .search("loop") + .first(); +if ($headerInsert1) { + testHeaderInsert($headerInsert1, true); +} + +const $headerInsert2 = Query.search("function", "headerInsert2") + .search("loop") + .first(); +if ($headerInsert2) { + testHeaderInsert($headerInsert2, false); +} + +function testHeaderInsert($loop, isDeclaration) { + const newVarName1 = "newVar1"; + const newVarName2 = "newVar2"; + + // Declare new variable + const $varDecl1 = ClavaJoinPoints.varDeclNoInit( + newVarName1, + ClavaJoinPoints.builtinType("int") + ); + const $varDecl2 = ClavaJoinPoints.varDeclNoInit( + newVarName2, + ClavaJoinPoints.builtinType("int") + ); + + $loop.insertBefore($varDecl1); + $loop.insertBefore($varDecl2); + + const initCodePrefix1 = isDeclaration ? "int " + newVarName1 : newVarName1; + const initCodePrefix2 = isDeclaration ? "int " + newVarName2 : newVarName2; + + // Add inserts + $loop.init.insertBefore(initCodePrefix1 + " = 10"); + $loop.init.insertAfter(initCodePrefix2 + " = 20"); + + //console.log($loop.cond); + $loop.cond.insertBefore(newVarName1 + "< 100"); + $loop.cond.insertAfter(newVarName2 + "< 200"); + //$loop.cond.replaceWith("i < 1000;"); + + $loop.step.insertBefore(newVarName1 + "++"); + $loop.step.insertAfter(newVarName2 + "--"); + + console.log("After header insert: " + $loop.parent.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Loop.lara b/ClavaWeaver/resources/clava/test/weaver/Loop.lara deleted file mode 100644 index 4f5a0e224b..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Loop.lara +++ /dev/null @@ -1,107 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; - -aspectdef Loop - - select function{"main"}.loop end - apply - println("loop control var: " + $loop.controlVar); - println("is innermost? " + $loop.isInnermost); - println("is outermost? " + $loop.isOutermost); - println("nested level: " + $loop.nestedLevel + "\n"); - println("rank: " + $loop.rank + "\n"); - //println("Loop inc:" + $loop.incrementValue); - end - - - // Test iterationsExpr - select function{"iterationsExpr"}.loop end - apply - if($loop.iterationsExpr === undefined) { - println("iterations expr: undefined"); - continue; - } - println("iterations expr: " + $loop.iterationsExpr.code); - println("iterations: " + $loop.iterations); - end - - // Test insertion in for header - var $headerInsert1 = Query.search("function", "headerInsert1").search("loop").first(); - testHeaderInsert($headerInsert1, true); - - var $headerInsert2 = Query.search("function", "headerInsert2").search("loop").first(); - testHeaderInsert($headerInsert2, false); - -/* - // interchange all pairs of innermost loops and their parent loop - select ($l1=loop).($l2=loop) end - apply - $l1.interchange($l2); - end - condition - $l2.isInnermost - end - - // interchange all pairs of innermost loops and their parent loop - // but test if interchangeable first - select ($l1=loop).($l2=loop) end - apply - $l1.interchange($l2); - end - condition - $l2.isInnermost && - $l2.isInterchangeable($1) - end - - // try to interchange two loops which are not in the same nest - select loop end - apply - var $loop1 = $loop; - end - condition rank == '1' end - - select loop end - apply - var $loop2 = $loop; - end - condition rank == '2' end - - $loop1.interchange($loop2); - /**/ -end - - -function testHeaderInsert($loop, isDeclaration) { - - var newVarName1 = "newVar1"; - var newVarName2 = "newVar2"; - - // Declare new variable - var $varDecl1 = ClavaJoinPoints.varDeclNoInit(newVarName1, ClavaJoinPoints.builtinType("int")); - var $varDecl2 = ClavaJoinPoints.varDeclNoInit(newVarName2, ClavaJoinPoints.builtinType("int")); - - $loop.insertBefore($varDecl1); - $loop.insertBefore($varDecl2); - - var initCodePrefix1 = isDeclaration ? "int " + newVarName1 : newVarName1; - var initCodePrefix2 = isDeclaration ? "int " + newVarName2 : newVarName2; - - //println("Insert1: " + initCodePrefix1 + " = 10"); - //println("Insert2: " + initCodePrefix2 + " = 20"); - - - // Add inserts - $loop.init.insertBefore(initCodePrefix1 + " = 10"); - $loop.init.insertAfter(initCodePrefix2 + " = 20"); - - //println($loop.cond); - $loop.cond.insertBefore(newVarName1 + "< 100"); - $loop.cond.insertAfter(newVarName2 + "< 200"); - //$loop.cond.replaceWith("i < 1000;"); - - $loop.step.insertBefore(newVarName1 + "++"); - $loop.step.insertAfter(newVarName2 + "--"); - - println("After header insert: " + $loop.parent.code); - -} diff --git a/ClavaWeaver/resources/clava/test/weaver/Macros.js b/ClavaWeaver/resources/clava/test/weaver/Macros.js new file mode 100644 index 0000000000..8d0412a82d --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Macros.js @@ -0,0 +1,3 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +console.log("Code:\n" + Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/Macros.lara b/ClavaWeaver/resources/clava/test/weaver/Macros.lara deleted file mode 100644 index 2a3f6c5891..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Macros.lara +++ /dev/null @@ -1,10 +0,0 @@ -aspectdef Macros - - select program end - apply - println("Code:\n" + $program.code); - //println("AST:\n" + $program.ast); - end - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Member.js b/ClavaWeaver/resources/clava/test/weaver/Member.js new file mode 100644 index 0000000000..ff38c2f8ca --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Member.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $memberAccess = Query.search("memberAccess").first(); +console.log("Member: " + $memberAccess.name); +console.log( + "Member decl type: " + $memberAccess.getValue("memberDecl").joinPointType +); diff --git a/ClavaWeaver/resources/clava/test/weaver/Member.lara b/ClavaWeaver/resources/clava/test/weaver/Member.lara deleted file mode 100644 index 231bd6d76d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Member.lara +++ /dev/null @@ -1,9 +0,0 @@ -import weaver.Query; - -aspectdef MemberTest - - var $memberAccess = Query.search("memberAccess").first(); - println("Member: " + $memberAccess.name); - println("Member decl type: " + $memberAccess.getValue("memberDecl").joinPointType); - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/MultiFile.js b/ClavaWeaver/resources/clava/test/weaver/MultiFile.js new file mode 100644 index 0000000000..6f0b61d49a --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/MultiFile.js @@ -0,0 +1,18 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Rename record in a header, change should propagate +Query.search("record", "A").first().name = "A_renamed"; + +Query.search("function", "template_foo").first().name = "template_foo_renamed"; + +for (const $call of Query.search("call", "template_foo_2")) { + $call.definition.name = "template_foo_2_renamed"; + break; +} + +for (const $call of Query.search("call", "template_foo_3")) { + $call.declaration.name = "template_foo_3_renamed"; + break; +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/MultiFile.lara b/ClavaWeaver/resources/clava/test/weaver/MultiFile.lara deleted file mode 100644 index f56f596026..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/MultiFile.lara +++ /dev/null @@ -1,49 +0,0 @@ -aspectdef MultiFileTest - - // Rename record in a header, change should propagate - select record{"A"} end - apply - $record.name = "A_renamed"; - //println("JP: " + $struct.kind); - //println("Node: " + $struct.astName); - //println("Struct name: " + $struct.name); - end - - select function{"template_foo"} end - apply - $function.name = "template_foo_renamed"; - end -/* - select program.call{"template_foo_2"} end - apply - - var $functionDef = $call.definition; - var $functionDecl = $call.declaration; - - // If renaming is done without saving first a reference to definition and declaration, - // it will not be able to find the declaration of the call under the new renamed definition - //$functionDef.name = "template_foo_2_renamed"; - $functionDecl.name = "template_foo_2_renamed"; - - break #program; - end - */ - - select program.call{"template_foo_2"} end - apply - $call.definition.name = "template_foo_2_renamed"; - break #program; - end - - select program.call{"template_foo_3"} end - apply - $call.declaration.name = "template_foo_3_renamed"; - break #program; - end - - select program end - apply - println($program.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/NoParsing.js b/ClavaWeaver/resources/clava/test/weaver/NoParsing.js new file mode 100644 index 0000000000..932ec2daf2 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/NoParsing.js @@ -0,0 +1,10 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +// Add file +const $file = ClavaJoinPoints.file("no_parsing.cpp"); +$file.insert("after", "int main() { return 0;}"); + +Query.root().addFile($file); + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/NoParsing.lara b/ClavaWeaver/resources/clava/test/weaver/NoParsing.lara deleted file mode 100644 index 192772267d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/NoParsing.lara +++ /dev/null @@ -1,13 +0,0 @@ -import clava.Clava; -import clava.ClavaJoinPoints; - -aspectdef NoParsing - - // Add file - var $file = ClavaJoinPoints.file("no_parsing.cpp"); - $file.insert after "int main() { return 0;}"; - - Clava.getProgram().addFile($file); - - println(Clava.getProgram().code); -end diff --git a/ClavaWeaver/resources/clava/test/weaver/NullNodes.js b/ClavaWeaver/resources/clava/test/weaver/NullNodes.js new file mode 100644 index 0000000000..93511185d4 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/NullNodes.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $main = Query.search("function", "main").first(); + +for (const JP of Query.searchFrom($main.body, "statement")) { + console.log("code : " + JP.code + " jpType : " + JP.joinPointType); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/NullNodes.lara b/ClavaWeaver/resources/clava/test/weaver/NullNodes.lara deleted file mode 100644 index af248add6b..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/NullNodes.lara +++ /dev/null @@ -1,7 +0,0 @@ -aspectdef NullNodes - select function.body.stmt end - apply - var JP = $stmt; - println('\t\t\t code : ' + JP.code + '\t astName : ' + JP.astName); - end -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Omp.js b/ClavaWeaver/resources/clava/test/weaver/Omp.js new file mode 100644 index 0000000000..b68610a1bb --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Omp.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $omp of Query.search("omp")) { + console.log("OMP:" + $omp.name); + console.log("OMP CONTENT:" + $omp.content); + console.log("OMP TARGET:" + $omp.target.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Omp.lara b/ClavaWeaver/resources/clava/test/weaver/Omp.lara deleted file mode 100644 index d07ef40372..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Omp.lara +++ /dev/null @@ -1,10 +0,0 @@ -aspectdef test - - select omp end - apply - println("OMP:" + $omp.name); - println("OMP CONTENT:" + $omp.content); - println("OMP TARGET:" + $omp.target.code); - end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.js b/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.js new file mode 100644 index 0000000000..da7db0264d --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.js @@ -0,0 +1,31 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $omp of Query.search("omp")) { + console.log("kind: " + $omp.kind); + console.log("clause kinds:" + $omp.clauseKinds); + console.log("has shared:" + $omp.hasClause("shared")); + console.log("nowait legal:" + $omp.isClauseLegal("nowait")); + console.log("num_threads:" + $omp.numThreads); + console.log("proc_bind:" + $omp.procBind); + console.log("private:" + $omp.private); + console.log("reduction +:" + $omp.getReduction("+")); + console.log("reduction max:" + $omp.getReduction("MAX")); + console.log("reduction kinds:" + $omp.reductionKinds); + console.log("firstprivate:" + $omp.firstprivate); + console.log("lastprivate:" + $omp.lastprivate); + console.log("shared:" + $omp.shared); + console.log("copyin:" + $omp.copyin); + console.log("schedule kind:" + $omp.scheduleKind); + console.log("schedule chunk size:" + $omp.scheduleChunkSize); + console.log("schedule modifiers:" + $omp.scheduleModifiers); + console.log("collapse:" + $omp.collapse); + console.log("ordered:" + $omp.hasClause("ordered")); + console.log("ordered value:" + $omp.ordered); +} + +for (const $omp of Query.search("omp", "for")) { + $omp.insertAfter(ClavaJoinPoints.omp("master")); + $omp.target.insertAfter(ClavaJoinPoints.omp("barrier")); + console.log($omp.getAncestor("function").body.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.lara b/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.lara deleted file mode 100644 index ce8b7ef52d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/OmpAttributes.lara +++ /dev/null @@ -1,43 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef test - - select omp end - apply - println("kind: " + $omp.kind); - println("clause kinds:" + $omp.clauseKinds); - println("has shared:" + $omp.hasClause("shared")); - println("nowait legal:" + $omp.isClauseLegal("nowait")); - println("num_threads:" + $omp.numThreads); - println("proc_bind:" + $omp.procBind); - println("private:" + $omp.private); - println("reduction +:" + $omp.getReduction('+')); - println("reduction max:" + $omp.getReduction('MAX')); - println("reduction kinds:" + $omp.reductionKinds); - println("firstprivate:" + $omp.firstprivate); - println("lastprivate:" + $omp.lastprivate); - println("shared:" + $omp.shared); - println("copyin:" + $omp.copyin); - println("schedule kind:" + $omp.scheduleKind); - println("schedule chunk size:" + $omp.scheduleChunkSize); - println("schedule modifiers:" + $omp.scheduleModifiers); - println("collapse:" + $omp.collapse); - println("ordered:" + $omp.hasClause('ordered')); - println("ordered value:" + $omp.ordered); - end - - select omp{'for'} end - apply - $omp.insertAfter(ClavaJoinPoints.omp('master')); - $omp.target.insertAfter(ClavaJoinPoints.omp('barrier')); - println($omp.getAncestor('function').body.code); - end -/* - select program end - apply - println($program.ast); - println("----------"); - println($program.code); - end -*/ -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.js b/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.js new file mode 100644 index 0000000000..494f999d24 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.js @@ -0,0 +1,86 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// has previous value +SetNumThreads("parallel", "42"); + +// no previous value +SetNumThreads("parallel for", "var"); + +// can't set 'num_threads' value on a 'for' directive. +SetNumThreads("for", "xxx"); + +console.log("-----------------------------------"); + +// has previous value +SetProcBind("parallel", "spread"); + +// no previous value +SetProcBind("parallel for", "close"); + +// can't set +// update: disabled wrong values, now throws exception +//call SetProcBind('for', 'xxx'); + +// test setters of directive parallel +SetParallelAttributes(); +// test setters of directive for +SetForAttributes(); + +// set whole omp pragma to custom value. Custom content is not compatible with setting attributes, done after attribute set testing +SetCustomContent("parallel", "parallel private(i)"); + +function SetNumThreads(kind, num) { + console.log(kind); + + for (const $omp of Query.search("omp", { kind: kind })) { + console.log("num_threads:" + $omp.numThreads); + $omp.setNumThreads(num); + console.log("num_threads:" + $omp.numThreads); + } +} + +function SetProcBind(kind, proc) { + console.log(kind); + + for (const $omp of Query.search("omp", { kind: kind })) { + console.log("proc_bind:" + $omp.procBind); + $omp.setProcBind(proc); + console.log("proc_bind:" + $omp.procBind); + } +} + +function SetCustomContent(kind, content) { + console.log(kind); + + for (const $omp of Query.search("omp", { kind: kind })) { + console.log("content:" + $omp.content); + $omp.content = content; + console.log("content:" + $omp.content); + } +} + +function SetParallelAttributes() { + for (const $omp of Query.search("omp", "parallel")) { + console.log("parallel content before:" + $omp.content); + const sumReduction = $omp.getReduction("+"); + sumReduction.push("b"); + $omp.setReduction("+", sumReduction); + $omp.firstprivate = ["first_a", "first_b"]; + $omp.shared = ["shared_a", "shared_b"]; + $omp.copyin = ["copyin_a", "copyin_b"]; + console.log("parallel content after:" + $omp.content); + } +} + +function SetForAttributes() { + for (const $omp of Query.search("omp", "for")) { + console.log("for content before:" + $omp.content); + $omp.lastprivate = ["last_a", "last_b"]; + $omp.scheduleKind = "static"; + $omp.scheduleChunkSize = 4; + $omp.scheduleModifiers = ["monotonic"]; + $omp.collapse = 2; + $omp.setOrdered(); + console.log("for content after:" + $omp.content); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.lara b/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.lara deleted file mode 100644 index d21dd18800..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/OmpSetAttributes.lara +++ /dev/null @@ -1,102 +0,0 @@ -aspectdef test - - // has previous value - call SetNumThreads('parallel', '42'); - - // no previous value - call SetNumThreads('parallel for', 'var'); - - // can't set 'num_threads' value on a 'for' directive. - call SetNumThreads('for', 'xxx'); - - - println('-----------------------------------'); - - // has previous value - call SetProcBind('parallel', 'spread'); - - // no previous value - call SetProcBind('parallel for', 'close'); - - // can't set - // update: disabled wrong values, now throws exception - //call SetProcBind('for', 'xxx'); - - // test setters of directive parallel - call SetParallelAttributes(); - // test setters of directive for - call SetForAttributes(); - - - // set whole omp pragma to custom value. Custom content is not compatible with setting attributes, done after attribute set testing - call SetCustomContent('parallel', 'parallel private(i)'); - -end - -aspectdef SetNumThreads - input kind, num end - - println(kind); - - select omp{kind} end - apply - println("num_threads:" + $omp.numThreads); - $omp.exec setNumThreads(num); - println("num_threads:" + $omp.numThreads); - end -end - -aspectdef SetProcBind - input kind, proc end - - println(kind); - - select omp{kind} end - apply - println("proc_bind:" + $omp.procBind); - $omp.exec setProcBind(proc); - println("proc_bind:" + $omp.procBind); - end -end - -aspectdef SetCustomContent - input kind, content end - - println(kind); - - select omp{kind} end - apply - println("content:" + $omp.content); - $omp.content = content; - println("content:" + $omp.content); - end -end - -aspectdef SetParallelAttributes - - select omp{'parallel'} end - apply - println("parallel content before:" + $omp.content); - var sumReduction = $omp.getReduction('+'); - sumReduction.push('b'); - $omp.exec setReduction('+', sumReduction); - $omp.firstprivate = ['first_a', 'first_b']; - $omp.shared = ['shared_a', 'shared_b']; - $omp.copyin = ['copyin_a', 'copyin_b']; - println("parallel content after:" + $omp.content); - end -end -aspectdef SetForAttributes - - select omp{'for'} end - apply - println("for content before:" + $omp.content); - $omp.lastprivate = ['last_a', 'last_b']; - $omp.scheduleKind = 'static'; - $omp.scheduleChunkSize = 4; - $omp.scheduleModifiers = ['monotonic']; - $omp.collapse = 2; - $omp.exec setOrdered(); - println("for content after:" + $omp.content); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.js b/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.js new file mode 100644 index 0000000000..ad0610e6e8 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.js @@ -0,0 +1,103 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +// Instrument code +OmpThreadsExplore("loop1", ["a"], 1, 3, 1); + +const $file = Query.search("file", "omp_threads_explore.cpp").first(); +if ($file) { + console.log("File omp_threads_explore.cpp"); + console.log($file.code); +} + +function OmpThreadsExplore( + markerName, // Name of the LARA marker + variables, // Array with name of variables to report + threadStart = 1, // Starting #threads + threadEnd = 8, // Final #threads + threadInterval = 1 // #threads increment +) { + const ompThreadMeasure = "omp_thread_measure_" + markerName; + + let commaSeparatedVariables = ""; + for (const variable of variables) { + commaSeparatedVariables = commaSeparatedVariables + "," + variable; + } + + for (const chain of Query.search("file") + .search("marker", { + id: markerName, + }) + .chain()) { + const $file = chain["file"]; + const $marker = chain["marker"]; + const $scope = $marker.contents; + + // Necessary includes + $file.addInclude("omp.h", true); + $file.addInclude("vector", true); + $file.addInclude("fstream", true); + $file.addInclude("iostream", true); + + // Before the pragma + $marker.insertBefore( + beforeMarker( + ompThreadMeasure, + commaSeparatedVariables, + threadStart, + threadEnd, + threadInterval + ) + ); + + // At the beginning of the scope + $scope.insertBegin(scopeEntry(ompThreadMeasure)); + + // At the end of the scope + $scope.insertEnd(scopeExit(ompThreadMeasure, variables)); + + // After the scope + $scope.insertAfter(afterScope(ompThreadMeasure)); + } +} + +function scopeEntry(ompThreadMeasure) { + return ` +std::cout << "[OpenMP_Measure] Setting number of threads to " << omp_thread_measure << std::endl; +omp_set_num_threads(omp_thread_measure); +${ompThreadMeasure} << omp_thread_measure; + `; +} + +function scopeExit(ompThreadMeasure, variables) { + let streamCode = ""; + for (const variable of variables) { + streamCode = streamCode + '<< "," << ' + variable; + } + + return ` +${ompThreadMeasure} ${streamCode}; +${ompThreadMeasure} << std::endl; + `; +} + +function beforeMarker( + ompThreadMeasure, + commaSeparateVariables, + threadStart, + threadEnd, + threadInterval +) { + return ` + std::ofstream ${ompThreadMeasure}; + ${ompThreadMeasure}.open("${ompThreadMeasure}.txt", std::ofstream::out | std::fstream::trunc); + ${ompThreadMeasure} << "threads${commaSeparateVariables}" << std::endl; + for(int omp_thread_measure = ${threadStart}; omp_thread_measure <= ${threadEnd}; omp_thread_measure+=${threadInterval}) +`; +} + +function afterScope(ompThreadMeasure) { + return ` + ${ompThreadMeasure}.close(); + std::cout << "[OpenMP_Measure] File '${ompThreadMeasure}.txt' written" << std::endl; +`; +} diff --git a/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.lara b/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.lara deleted file mode 100644 index a79ba252b4..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/OmpThreadsExplore.lara +++ /dev/null @@ -1,97 +0,0 @@ -aspectdef Launcher - - // Instrument code - call OmpThreadsExplore("loop1", ["a"], 1, 3, 1); - - select file{"omp_threads_explore.cpp"} end - apply - println("File omp_threads_explore.cpp"); - println($file.code); - end - -end - -aspectdef OmpThreadsExplore - input - markerName, // Name of the LARA marker - variables, // Array with name of variables to report - threadStart=1, // Starting #threads - threadEnd=8, // Final #threads - threadInterval=1 // #threads increment - end - - var ompThreadMeasure = "omp_thread_measure_" + markerName; - - var commaSeparatedVariables = ""; - for(variable of variables) { - commaSeparatedVariables = commaSeparatedVariables + "," + variable; - } - - - select file.marker{id == markerName} end - apply - var $scope = $marker.contents; - - // Necessary includes - $file.addInclude("omp.h", true); - $file.addInclude("vector", true); - $file.addInclude("fstream", true); - $file.addInclude("iostream", true); - - // Before the pragma - $marker.insert before beforeMarker(ompThreadMeasure, commaSeparatedVariables, - threadStart,threadEnd,threadInterval); - - // At the beginning of the scope - $scope.exec insertBegin(OmpThreadsExploreCode.scopeEntry(ompThreadMeasure)); - - // At the end of the scope - $scope.exec insertEnd(OmpThreadsExploreCode.scopeExit(ompThreadMeasure, variables)); - - // After the scope - $scope.insert after afterScope(ompThreadMeasure); - end - -end - -aspectdef OmpThreadsExploreCode - - static - - function scopeEntry(ompThreadMeasure){return %{ -std::cout << "[OpenMP_Measure] Setting number of threads to " << omp_thread_measure << std::endl; -omp_set_num_threads(omp_thread_measure); -[[ompThreadMeasure]] << omp_thread_measure; - }%;} - - function scopeExit(ompThreadMeasure, variables){ - - var streamCode = ""; - for (variable of variables) { - streamCode = streamCode + '<< "," << ' + variable; - } - - return %{ -[[ompThreadMeasure]] [[streamCode]]; -[[ompThreadMeasure]] << std::endl; - }%;} - - end - -end - - -codedef beforeMarker(ompThreadMeasure, commaSeparateVariables, threadStart, threadEnd, threadInterval) %{ - std::ofstream [[ompThreadMeasure]]; - [[ompThreadMeasure]].open("[[ompThreadMeasure]].txt", std::ofstream::out | std::fstream::trunc); - [[ompThreadMeasure]] << "threads[[commaSeparateVariables]]" << std::endl; - for(int omp_thread_measure = [[threadStart]]; omp_thread_measure <= [[threadEnd]]; omp_thread_measure+=[[threadInterval]]) -}% end - -codedef afterScope(ompThreadMeasure) %{ - [[ompThreadMeasure]].close(); - std::cout << "[OpenMP_Measure] File '[[ompThreadMeasure]].txt' written" << std::endl; -}% end - - - diff --git a/ClavaWeaver/resources/clava/test/weaver/OpenCLType.js b/ClavaWeaver/resources/clava/test/weaver/OpenCLType.js new file mode 100644 index 0000000000..3d4152f3f0 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/OpenCLType.js @@ -0,0 +1,7 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $decl of Query.search("decl")) { + console.log($decl.type.ast); +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/OpenCLType.lara b/ClavaWeaver/resources/clava/test/weaver/OpenCLType.lara deleted file mode 100644 index 70ceddcc80..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/OpenCLType.lara +++ /dev/null @@ -1,11 +0,0 @@ -aspectdef OpenCLType - select decl end - apply - println($decl.type.ast); - end - - select program end - apply - println($program.code); - end -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/ParamType.js b/ClavaWeaver/resources/clava/test/weaver/ParamType.js new file mode 100644 index 0000000000..c0ca37dea8 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ParamType.js @@ -0,0 +1,10 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $varref of Query.search("function", "error_norm") + .search("loop") + .search("varref", (varref) => varref.name != "m")) { + console.log("varref_name : " + $varref.name + " #" + $varref.line); + console.log("\t\tisArray = " + $varref.vardecl.type.isArray); + console.log("\t\tisArray = " + $varref.type.isArray); + console.log($varref.ast); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ParamType.lara b/ClavaWeaver/resources/clava/test/weaver/ParamType.lara deleted file mode 100644 index 423bb34c07..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ParamType.lara +++ /dev/null @@ -1,12 +0,0 @@ -aspectdef ParamType - - select function{'error_norm'}.body.loop.varref end - apply - println('varref_name : ' + $varref.name + ' #' + $varref.line); - println('\t\tisArray = ' + $varref.vardecl.type.isArray); - println('\t\tisArray = ' + $varref.type.isArray); - println($varref.ast); - end - condition $varref.name!= 'm' end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/ParentRegion.js b/ClavaWeaver/resources/clava/test/weaver/ParentRegion.js new file mode 100644 index 0000000000..148692213f --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ParentRegion.js @@ -0,0 +1,40 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("vardecl")) { + printMessage($vardecl); +} + +for (const $varref of Query.search("varref")) { + printMessage($varref); +} + +for (const $function of Query.search("function")) { + printMessage($function); +} + +function printMessage($jp) { + const $currentRegion = $jp.currentRegion; + const $parentRegion = $jp.parentRegion; + + const initMessage = + $jp.joinPointType + + " '" + + $jp.name + + "' is in region '" + + $currentRegion.joinPointType + + "' at line " + + $jp.line; + + if ($parentRegion === undefined) { + console.log(initMessage + " and does not have a parentRegion"); + return; + } + + console.log( + initMessage + + ", parentRegion is a '" + + $parentRegion.joinPointType + + "' at line " + + $parentRegion.line + ); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ParentRegion.lara b/ClavaWeaver/resources/clava/test/weaver/ParentRegion.lara deleted file mode 100644 index 7aa13bc5b3..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ParentRegion.lara +++ /dev/null @@ -1,39 +0,0 @@ -aspectdef ParentRegion - - select vardecl end - apply - var $currentRegion = $vardecl.currentRegion; - var $parentRegion = $vardecl.parentRegion; - - printMessage($vardecl, $currentRegion, $parentRegion); - end - - select varref end - apply - var $currentRegion = $varref.currentRegion; - var $parentRegion = $varref.parentRegion; - - printMessage($varref, $currentRegion, $parentRegion); - end - - - select function end - apply - var $currentRegion = $function.currentRegion; - var $parentRegion = $function.parentRegion; - - printMessage($function, $currentRegion, $parentRegion); - end - -end - -var printMessage = function($jp, $currentRegion, $parentRegion) { - var initMessage = $jp.joinPointType + " '"+$jp.name+"' is in region '" + $currentRegion.joinPointType + "' at line " + $jp.line; - - if($parentRegion === undefined) { - println(initMessage +" and does not have a parentRegion"); - return; - } - - println(initMessage +", parentRegion is a '" + $parentRegion.joinPointType + "' at line " + $parentRegion.line); -}; \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Pragma2.js b/ClavaWeaver/resources/clava/test/weaver/Pragma2.js index 416e71e0e2..faec3b6d98 100644 --- a/ClavaWeaver/resources/clava/test/weaver/Pragma2.js +++ b/ClavaWeaver/resources/clava/test/weaver/Pragma2.js @@ -1,10 +1,21 @@ -laraImport("weaver.Query") +import Query from "@specs-feup/lara/api/weaver/Query.js"; -const $pragmaStartEnd = Query.search("function", "targetNodesStartEnd").search("pragma").first() -$pragmaStartEnd.getTargetNodes("end").forEach(node => println(node.line)) +const $pragmaStartEnd = Query.search("function", "targetNodesStartEnd") + .search("pragma") + .first(); +$pragmaStartEnd.getTargetNodes("end").forEach((node) => console.log(node.line)); -const $pragmaStart = Query.search("function", "targetNodesStart").search("pragma").first() -$pragmaStart.getTargetNodes().forEach(node => println(node.line)) +const $pragmaStart = Query.search("function", "targetNodesStart") + .search("pragma") + .first(); +$pragmaStart.getTargetNodes().forEach((node) => console.log(node.line)); -const $pragmaStartEndWithoutEnd = Query.search("function", "targetNodesStartEndWithoutEnd").search("pragma").first() -$pragmaStartEndWithoutEnd.getTargetNodes("end").forEach(node => println(node.line)) \ No newline at end of file +const $pragmaStartEndWithoutEnd = Query.search( + "function", + "targetNodesStartEndWithoutEnd" +) + .search("pragma") + .first(); +$pragmaStartEndWithoutEnd + .getTargetNodes("end") + .forEach((node) => console.log(node.line)); diff --git a/ClavaWeaver/resources/clava/test/weaver/PragmaAttribute.lara b/ClavaWeaver/resources/clava/test/weaver/PragmaAttribute.lara deleted file mode 100644 index d5a8cc69cc..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/PragmaAttribute.lara +++ /dev/null @@ -1,9 +0,0 @@ -aspectdef PragmaAttribute - - select program end - apply - println($program.code); - end - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/PragmaData.js b/ClavaWeaver/resources/clava/test/weaver/PragmaData.js new file mode 100644 index 0000000000..450404fec6 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/PragmaData.js @@ -0,0 +1,107 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import Clava from "@specs-feup/clava/api/clava/Clava.js"; +import { printObject, printlnObject } from "@specs-feup/lara/api/core/output.js"; + +for (const $loop of Query.search("function", "foo").search("loop")) { + console.log("Data:"); + printObject($loop.data); + console.log(""); +} + +for (const $loop of Query.search("function", "noData").search("loop")) { + console.log("Empty Object:"); + printlnObject($loop.data); +} + +// Insert preserves pragma +const $loopWithPragma = Query.search("function", "insertPreservesPragma") + .search("loop") + .first(); +console.log("Data before insert: " + $loopWithPragma.data.a); +$loopWithPragma.insertBefore("int a;"); +console.log("Data after insert: " + $loopWithPragma.data.a); + +// ...also before functions +const $loopWithPragma2 = Query.search( + "function", + "insertPreservesPragma2" +).first(); +console.log("Data before insert: " + $loopWithPragma2.data.a); +$loopWithPragma2.insertBefore("int global_a;"); +console.log("Data after insert: " + $loopWithPragma2.data.a); + +// Setting data without pragma creates a pragma +const $loopWithoutPragma = Query.search( + "function", + "insertWithoutPragma" +).first(); +let obj = $loopWithoutPragma.data; +obj.a = 42; +obj.b = 43; +$loopWithoutPragma.setData(obj); +console.log( + "Loop without pragma after setting data: " + + $loopWithoutPragma.pragmas.map((p) => p.code) +); + +// Setting already existing data updates pragma +const $loopWithUpdatedPragma = Query.search("function", "updatePragma").first(); +obj = $loopWithUpdatedPragma.data; +obj.a = 200; +$loopWithUpdatedPragma.setData(obj); +console.log( + "Loop with updated pragma: " + + $loopWithUpdatedPragma.pragmas.map((p) => p.code) +); + +// Information persists after rebuilds +const $loopBeforeRebuild = Query.search("function", "rebuild").first(); +console.log( + "Is parallel before set and rebuild: " + $loopBeforeRebuild.data.isParallel +); +obj = $loopBeforeRebuild.data; +obj.isParallel = true; +$loopBeforeRebuild.setData(obj); + +const $loopAfterRebuild = Query.search("function", "rebuild").first(); +console.log("Is parallel after rebuild: " + $loopAfterRebuild.data.isParallel); + +// Data on expression nodes +const $op = Query.search("function", "dataInExpressions") + .search("binaryOp") + .first(); +obj = $op.data; +obj.a = 1000; +obj.b = 2000; +$op.setData(obj); +console.log("ExprData before push"); +printlnObject($op.data); +Clava.pushAst(); +const $opAfterPush = Query.search("function", "dataInExpressions") + .search("binaryOp") + .first(); +obj = $opAfterPush.data; +obj.c = 3000; +$opAfterPush.setData(obj); +Clava.popAst(); +const $opAfterPop = Query.search("function", "dataInExpressions") + .search("binaryOp") + .first(); +console.log("ExprData after pop"); +printlnObject($op.data); + +const $fileRebuildOp = Query.search("function", "fileRebuild") + .search("binaryOp") + .first(); +obj = $fileRebuildOp.data; +obj.opRebuild = true; +$fileRebuildOp.setData(obj); + +const $fileRebuildLoop = Query.search("function", "fileRebuild2") + .search("loop") + .first(); +obj = $fileRebuildLoop.data; +obj.loopRebuild = true; +$fileRebuildLoop.setData(obj); + +//from nothing adds pragma; changes reflected in pragma; push/pop preserve; rebuild preserves for ones with pragma diff --git a/ClavaWeaver/resources/clava/test/weaver/PragmaData.lara b/ClavaWeaver/resources/clava/test/weaver/PragmaData.lara deleted file mode 100644 index 81d9c039af..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/PragmaData.lara +++ /dev/null @@ -1,96 +0,0 @@ -import weaver.Query; -import clava.Clava; - -aspectdef PragmaData - - select function{"foo"}.loop end - apply - println("Data:"); - printObject($loop.data); - println(""); - end - - select function{"noData"}.loop end - apply - println("Empty Object:"); - printlnObject($loop.data); - end - - // Insert preserves pragma - var $loopWithPragma = Query.search("function", "insertPreservesPragma").search("loop").first(); - println("Data before insert: " + $loopWithPragma.data.a); - $loopWithPragma.insertBefore("int a;"); - println("Data after insert: " + $loopWithPragma.data.a); - - // ...also before functions - var $loopWithPragma2 = Query.search("function", "insertPreservesPragma2").first(); - println("Data before insert: " + $loopWithPragma2.data.a); - $loopWithPragma2.insertBefore("int global_a;"); - println("Data after insert: " + $loopWithPragma2.data.a); - - // Setting data without pragma creates a pragma - var $loopWithoutPragma = Query.search("function", "insertWithoutPragma").first(); - var obj = $loopWithoutPragma.data; - obj.a = 42; - obj.b = 43; - $loopWithoutPragma.setData(obj); - println("Loop without pragma after setting data: " + $loopWithoutPragma.pragmas.map(p => p.code)); - - // Setting already existing data updates pragma - var $loopWithUpdatedPragma = Query.search("function", "updatePragma").first(); - obj = $loopWithUpdatedPragma.data; - obj.a = 200; - $loopWithUpdatedPragma.setData(obj); - println("Loop with updated pragma: " + $loopWithUpdatedPragma.pragmas.map(p => p.code)); - - // Information persists after rebuilds - var $loopBeforeRebuild = Query.search("function", "rebuild").first(); - println("Is parallel before set and rebuild: " + $loopBeforeRebuild.data.isParallel); - obj = $loopBeforeRebuild.data; - obj.isParallel = true; - $loopBeforeRebuild.setData(obj); - -/* - var $op = Query.search("function", "dataInExpressions").search("binaryOp").first(); - $op.data.a = 1000; - $op.data.b = 2000; - println("Cache before:"); - printlnObject(_CLAVA_DATA_CACHE); - Clava.rebuild(); - println("Cache after:"); - printlnObject(_CLAVA_DATA_CACHE); -*/ - - var $loopAfterRebuild = Query.search("function", "rebuild").first(); - println("Is parallel after rebuild: " + $loopAfterRebuild.data.isParallel); - - // Data on expression nodes - var $op = Query.search("function", "dataInExpressions").search("binaryOp").first(); - obj = $op.data; - obj.a = 1000; - obj.b = 2000; - $op.setData(obj); - println("ExprData before push"); - printlnObject($op.data); - Clava.pushAst(); - var $opAfterPush = Query.search("function", "dataInExpressions").search("binaryOp").first(); - obj = $opAfterPush.data; - obj.c = 3000; - $opAfterPush.setData(obj); - Clava.popAst(); - var $opAfterPop = Query.search("function", "dataInExpressions").search("binaryOp").first(); - println("ExprData after pop"); - printlnObject($op.data); - - var $fileRebuildOp = Query.search("function", "fileRebuild").search("binaryOp").first(); - obj = $fileRebuildOp.data; - obj.opRebuild = true; - $fileRebuildOp.setData(obj); - - var $fileRebuildLoop = Query.search("function", "fileRebuild2").search("loop").first(); - obj = $fileRebuildLoop.data; - obj.loopRebuild = true; - $fileRebuildLoop.setData(obj); - -//from nothing adds pragma; changes reflected in pragma; push/pop preserve; rebuild preserves for ones with pragma -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Pragmas.js b/ClavaWeaver/resources/clava/test/weaver/Pragmas.js new file mode 100644 index 0000000000..26abd93c35 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Pragmas.js @@ -0,0 +1,19 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $marker of Query.search("marker")) { + const $scope = $marker.contents; + $scope.insertBefore(`// Before scope - ${$marker.id}`); + $scope.insertAfter(`// After scope - ${$marker.id}`); + + $scope.insertBegin("// Scope start - " + $marker.id); + $scope.insertEnd("// Scope end - " + $marker.id); +} + +for (const $file of Query.search("file")) { + console.log($file.code); +} + +for (const $marker of Query.search("marker", "foo")) { + console.log('default marker attribute "id" is working: ' + $marker.id); + console.log("marker contents: " + $marker.contents.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Pragmas.lara b/ClavaWeaver/resources/clava/test/weaver/Pragmas.lara deleted file mode 100644 index df61683b90..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Pragmas.lara +++ /dev/null @@ -1,32 +0,0 @@ -aspectdef Pragmas - -/* - select function{"fooCallBeforeAfter"} end - apply - println("AST:"+$function.ast); - end -*/ - select marker end - apply - var $scope = $marker.contents; - $scope.insert before '// Before scope - [[$marker.id]]'; - $scope.insert after '// After scope - [[$marker.id]]'; - - $scope.exec insertBegin("// Scope start - " + $marker.id); - $scope.exec insertEnd("// Scope end - " + $marker.id); - end - //println("name:"+$pragma.name); - //println("target:"+$pragma.target.joinPointType); - - select file end - apply - println("Code:\n" + $file.code); - end - - select marker{'foo'} end - apply - println('default marker attribute "id" is working: ' + $marker.id); - println('marker contents: ' + $marker.contents.code); - end - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.js b/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.js new file mode 100644 index 0000000000..96d93c6acc --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.js @@ -0,0 +1,16 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +//select file end +for (const $include of Query.search("include")) { + if ($include.name === "remove_include_1.h") { + $include.detach(); + } +} + +for (const $file of Query.search("file")) { + $file.addInclude("remove_include_2.h"); +} + +for (const $file of Query.search("file", "remove_include.c")) { + console.log($file.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.lara b/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.lara deleted file mode 100644 index a75f086671..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/RemoveInclude.lara +++ /dev/null @@ -1,21 +0,0 @@ -aspectdef RemoveInclude - - //select file end - select include end - apply - if($include.name === "remove_include_1.h" ) { - $include.detach(); - } - end - - select file end - apply - $file.addInclude("remove_include_2.h"); - end - - - select file{"remove_include.c"} end - apply - println($file.code); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.js b/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.js new file mode 100644 index 0000000000..86ad959172 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.js @@ -0,0 +1,16 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $main = Query.search("function", "main").first(); +for (const chain of Query.searchFrom($main.body, "statement") + .search("call").chain()) { + + const $call = chain["call"]; + const $stmt = chain["statement"]; + + const varName = $call.name + "Result"; + const $varDecl = ClavaJoinPoints.varDecl(varName, $call); + $stmt.replaceWith($varDecl); +} + +console.log(Query.search("function", "main").first().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.lara b/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.lara deleted file mode 100644 index 76bae967b9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ReplaceCallWithStmt.lara +++ /dev/null @@ -1,23 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef ReplaceCallWithStmt - - select function{"main"}.stmt.stmtCall end - apply - var varName = $stmtCall.name + "Result"; - - var $varDecl = ClavaJoinPoints.varDecl(varName, $stmtCall); - $stmt.exec replaceWith($varDecl); - end - - - //Clava.rebuild(); - - select function{"main"} end - apply - print($function.code); - end - - - -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.js b/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.js new file mode 100644 index 0000000000..f79eeec244 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.js @@ -0,0 +1,4 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const cl = Query.search("class", "json_reverse_iterator").first(); +console.log("Bases: " + cl.bases.map((base) => base.name)); diff --git a/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.lara b/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.lara deleted file mode 100644 index c0945aace1..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ReverseIterator.lara +++ /dev/null @@ -1,10 +0,0 @@ -import weaver.Query; - -aspectdef ReverseIterator - - var cl = Query.search("class","json_reverse_iterator").first(); - println("Bases: " + cl.bases.map(base => base.name)); - - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Scope.js b/ClavaWeaver/resources/clava/test/weaver/Scope.js index ec5f95db1f..e18b428352 100644 --- a/ClavaWeaver/resources/clava/test/weaver/Scope.js +++ b/ClavaWeaver/resources/clava/test/weaver/Scope.js @@ -1,6 +1,6 @@ -laraImport("weaver.Query"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; // Count statements const $body = Query.search("function", "numStatements").first().body; -println("numStatements (depth): " + $body.getNumStatements()); -println("numStatements (flat): " + $body.getNumStatements(true)); +console.log("numStatements (depth): " + $body.getNumStatements()); +console.log("numStatements (flat): " + $body.getNumStatements(true)); diff --git a/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.js b/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.js new file mode 100644 index 0000000000..90d9008d55 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.js @@ -0,0 +1,20 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import { FunctionJp, Statement, Expression } from "@specs-feup/clava/api/Joinpoints.js"; + +for (const $expr of Query.search(FunctionJp, "main") + .search(Statement, {line: 4}) + .search(Expression)) { + console.log("#" + $expr.line + " expr -> " + $expr.code); + + console.log("\tIn exractExprVardecl expr : " + $expr); + console.log( + "\tIn exractExprVardecl expr.joinPointType : " + $expr.joinPointType + ); + console.log("\tIn exractExprVardecl expr.vardecl : " + $expr.vardecl); + + if ($expr.vardecl) { + console.log("\t>>>> vardecl#" + $expr.line + " " + $expr.vardecl.code); + } + + console.log(); +} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.lara b/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.lara deleted file mode 100644 index 0f7f9026f3..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/SelectVardecl.lara +++ /dev/null @@ -1,26 +0,0 @@ -aspectdef Test - - select function{'main'}.body.childStmt.expr end - apply - println('#' + $expr.line + '\texpr -> ' + $expr.code ); - call exractExprVardecl($expr); - - end - condition $childStmt.line === 4 end - -end - -aspectdef exractExprVardecl - input $expr end - println('\tIn exractExprVardecl expr : ' + $expr); - println('\tIn exractExprVardecl expr.joinPointType : ' + $expr.joinPointType); - println('\tIn exractExprVardecl expr.selects : ' + $expr.selects); - println('\tIn exractExprVardecl expr.vardecl : ' + $expr.vardecl); - - select $expr.vardecl end - apply - println('\t>>>> vardecl#' + $expr.line + '\t' + $vardecl.code); - end - - println(); -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Selects.js b/ClavaWeaver/resources/clava/test/weaver/Selects.js new file mode 100644 index 0000000000..a37c38f124 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Selects.js @@ -0,0 +1,18 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $function of Query.search("function")) { + console.log("Select function " + $function.name); +} + +for (const _ of Query.search("function", "foo")) { + console.log("Select function foo"); +} + +for (const _ of Query.search("function", {line: 1})) { + console.log("Select function at line 1"); +} + +for (const _ of Query.search("function").search("call")) { + console.log("Select calls"); +} + diff --git a/ClavaWeaver/resources/clava/test/weaver/Selects.lara b/ClavaWeaver/resources/clava/test/weaver/Selects.lara deleted file mode 100644 index 6632372951..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Selects.lara +++ /dev/null @@ -1,23 +0,0 @@ -aspectdef Selects - - select function end - apply - println("Select function " + $function.name); - end - - select function{"foo"} end - apply - println("Select function foo"); - end - - select function{line === 1} end - apply - println("Select function at line 1"); - end - - select function.call end - apply - println("Select calls"); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/SetType.js b/ClavaWeaver/resources/clava/test/weaver/SetType.js new file mode 100644 index 0000000000..455f5af40c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/SetType.js @@ -0,0 +1,24 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const doubleType = ClavaJoinPoints.builtinType("double"); +for (const $function of Query.search("file").search("function", "fooType")) { + $function.type = doubleType; +} + +// Deep Copy test for types +for (const $vardecl of Query.search("function", "deepCopyTest").search( + "vardecl" +)) { + // Deep copy on first vardecl + const typeCopy = $vardecl.type.deepCopy(); + $vardecl.type = typeCopy; + + // Change element type + typeCopy.elementType.elementType.setValue("elementType", doubleType); + + // Stop + break; +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/SetType.lara b/ClavaWeaver/resources/clava/test/weaver/SetType.lara deleted file mode 100644 index 721b7463a6..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/SetType.lara +++ /dev/null @@ -1,31 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef Launcher - - var doubleType = ClavaJoinPoints.builtinType("double"); - select file.function{"fooType"} end - apply - $function.type = doubleType; - end - - - // Deep Copy test for types - select function{"deepCopyTest"}.vardecl end - apply - // Deep copy on first vardecl - var typeCopy = $vardecl.type.deepCopy(); - $vardecl.type = typeCopy; - - // Change element type - typeCopy.elementType.elementType.setValue("elementType", doubleType); - - // Stop - break; - end - - select program end - apply - println($program.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.js b/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.js new file mode 100644 index 0000000000..ec3eb9c447 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.js @@ -0,0 +1,25 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + + +const $floatType = ClavaJoinPoints.builtinType("float"); + +for (const $expr of Query.search("function", "cstyle_cast").search("expression")) { + if($expr.astName === "CStyleCastExpr") { + $expr.setType($floatType); + } +} + +for (const $expr of Query.search("function", "static_cast_foo").search("expression")) { + if($expr.astName === "CXXStaticCastExpr") { + $expr.setType($floatType); + } +} + +for (const $typedefDecl of Query.search("typedefDecl")) { + $typedefDecl.type = $floatType; + $typedefDecl.name = "x_float"; +} + +console.log(Query.root().code); + diff --git a/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.lara b/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.lara deleted file mode 100644 index ad1d489763..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/SetTypeCxx.lara +++ /dev/null @@ -1,32 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef Launcher - - var $floatType = ClavaJoinPoints.builtinType("float"); - - select function{"cstyle_cast"}.expr end - apply - if($expr.astName === "CStyleCastExpr") { - $expr.setType($floatType); - } - end - - select function{"static_cast_foo"}.expr end - apply - if($expr.astName === "CXXStaticCastExpr") { - $expr.setType($floatType); - } - end - - select typedefDecl end - apply - $typedefDecl.type = $floatType; - $typedefDecl.name = "x_float"; - end - - select program end - apply - println($program.code); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Setters.js b/ClavaWeaver/resources/clava/test/weaver/Setters.js new file mode 100644 index 0000000000..f0bf189cd3 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Setters.js @@ -0,0 +1,31 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $call of Query.search("function", "testSetQualifiedName").search( + "call", + "now" +)) { + console.log("Original qualified name: " + $call.declaration.qualifiedName); + $call.declaration.qualifiedName = "now"; + console.log("Changed qualified name 1: " + $call.declaration.qualifiedName); + $call.declaration.qualifiedName = "std::now"; + console.log("Changed qualified name 2: " + $call.declaration.qualifiedName); + $call.declaration.qualifiedPrefix = "std::chrono::_V2::system_clock"; + console.log("Changed qualified name 3: " + $call.declaration.qualifiedName); +} + +for (const $if of Query.search("function", "testIf").search("if")) { + $if.then = ClavaJoinPoints.stmtLiteral("a = 3;"); + console.log("Changed then:\n" + $if.code); + $if.else = ClavaJoinPoints.stmtLiteral("a = 4;"); + console.log("Changed else:\n" + $if.code); + $if.cond = ClavaJoinPoints.exprLiteral("a == 3"); + console.log("Changed condition:\n" + $if.code); +} + +for (const $function of Query.search("function", "testFunctionType")) { + $function.returnType = ClavaJoinPoints.builtinType("double"); + $function.setParamType(0, ClavaJoinPoints.builtinType("int")); + console.log("Changed Function:\n" + $function.code); + console.log("Changed FunctionType:\n" + $function.functionType.code); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Setters.lara b/ClavaWeaver/resources/clava/test/weaver/Setters.lara deleted file mode 100644 index afbf6974d0..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Setters.lara +++ /dev/null @@ -1,35 +0,0 @@ -import clava.ClavaJoinPoints; - -aspectdef Setters - - select function{"testSetQualifiedName"}.call{"now"} end - apply - println("Original qualified name: " + $call.declaration.qualifiedName); - $call.declaration.qualifiedName = "now"; - println("Changed qualified name 1: " + $call.declaration.qualifiedName); - $call.declaration.qualifiedName = "std::now"; - println("Changed qualified name 2: " + $call.declaration.qualifiedName); - $call.declaration.qualifiedPrefix = "std::chrono::_V2::system_clock"; - println("Changed qualified name 3: " + $call.declaration.qualifiedName); - end - - - select function{"testIf"}.if end - apply - $if.then = ClavaJoinPoints.stmtLiteral("a = 3;"); - println("Changed then:\n" + $if.code); - $if.else = ClavaJoinPoints.stmtLiteral("a = 4;"); - println("Changed else:\n" + $if.code); - $if.cond = ClavaJoinPoints.exprLiteral("a == 3"); - println("Changed condition:\n" + $if.code); - end - - - select function{"testFunctionType"} end - apply - $function.returnType = ClavaJoinPoints.builtinType("double"); - $function.setParamType(0, ClavaJoinPoints.builtinType("int")); - println("Changed Function:\n"+$function.code); - println("Changed FunctionType:\n"+$function.functionType.code); - end -end diff --git a/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.js b/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.js new file mode 100644 index 0000000000..9b88d37a4d --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.js @@ -0,0 +1,8 @@ +import Clava from "@specs-feup/clava/api/clava/Clava.js"; + +// Perform a rebuilds, when the code has headers that are not being parsed +Clava.rebuild(); +Clava.rebuild(); +Clava.rebuild(); + +console.log(Clava.getProgram().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.lara b/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.lara deleted file mode 100644 index aa90bbd173..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/SkipParsingHeaders.lara +++ /dev/null @@ -1,11 +0,0 @@ -import clava.Clava; - -aspectdef SkipParsingHeaders - - // Perform a rebuilds, when the code has headers that are not being parsed - Clava.rebuild(); - Clava.rebuild(); - Clava.rebuild(); - - println(Clava.getProgram().code); -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Statement.js b/ClavaWeaver/resources/clava/test/weaver/Statement.js new file mode 100644 index 0000000000..7a7166376e --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Statement.js @@ -0,0 +1,11 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $loop of Query.search("loop")) { + for (const $childExpr of Query.searchFrom($loop.cond, "expression")) { + if ($childExpr.joinPointType !== "binaryOp") { + continue; + } + + console.log("Condition Kind:" + $childExpr.kind); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Statement.lara b/ClavaWeaver/resources/clava/test/weaver/Statement.lara deleted file mode 100644 index 361de5d88b..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Statement.lara +++ /dev/null @@ -1,13 +0,0 @@ -aspectdef Statement - - select loop.cond.childExpr end - apply - - if($childExpr.joinPointType !== "binaryOp") { - continue; - } - - println("Condition Kind:" + $childExpr.kind); - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/SwitchTest.js b/ClavaWeaver/resources/clava/test/weaver/SwitchTest.js new file mode 100644 index 0000000000..d57858baf9 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/SwitchTest.js @@ -0,0 +1,39 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +function testSwitch($switch) { + console.log("hasDefaultCase: " + $switch.hasDefaultCase); + console.log("getDefaultCase: " + $switch.getDefaultCase); + console.log("condition: " + $switch.condition.code); + for (const $caseStmt of $switch.cases) { + console.log("case is default: " + $caseStmt.isDefault); + console.log("case is empty: " + $caseStmt.isEmpty); + console.log("values: " + $caseStmt.values.map((v) => v.code)); + console.log( + "next case: " + + ($caseStmt.nextCase !== undefined + ? $caseStmt.nextCase.code + : "undefined") + ); + console.log("case next instruction: " + $caseStmt.nextInstruction.code); + console.log("case instructions:"); + for (const $caseInst of $caseStmt.instructions) { + console.log($caseInst.code); + } + } +} + +console.log("Test foo1"); +for (const chain of Query.search("function", "foo1") + .search("switch") + .search("case") + .chain()) { + console.log("Switch line: " + chain["switch"].line); + console.log("Case line: " + chain["case"].line); +} + +// Switch attributes +console.log("foo1"); +testSwitch(Query.search("function", "foo1").search("switch").first()); + +console.log("foo2"); +testSwitch(Query.search("function", "foo2").search("switch").first()); diff --git a/ClavaWeaver/resources/clava/test/weaver/SwitchTest.lara b/ClavaWeaver/resources/clava/test/weaver/SwitchTest.lara deleted file mode 100644 index 367d51f3b1..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/SwitchTest.lara +++ /dev/null @@ -1,64 +0,0 @@ -import weaver.Query; - -aspectdef SwitchTest - - println("Test foo1"); - for(var chain of Query.search("function", "foo1").search("switch").search("case").chain()) { - println("Switch line: " + chain["switch"].line); - println("Case line: " + chain["case"].line); - } - - // Switch attributes - println("foo1"); - testSwitch(Query.search("function", "foo1").search("switch").first()); -/* - for(var $switch of Query.search("function", "foo1").search("switch")) { - println("hasDefaultCase: " + $switch.hasDefaultCase); - println("getDefaultCase: " + $switch.getDefaultCase); - for(var $caseStmt of $switch.cases) { - println("case is default: " + $caseStmt.isDefault); - println("case is empty: " + $caseStmt.isEmpty); - println("case next instruction: " + $caseStmt.nextInstruction.code); - println("case instructions:"); - for(var $caseInst of $case.instructions) { - println($caseInst.code); - } - } - } -*/ - - println("foo2"); - testSwitch(Query.search("function", "foo2").search("switch").first()); -/* - for(var $switch of Query.search("function", "foo2").search("switch")) { - println("hasDefaultCase: " + $switch.hasDefaultCase); - println("getDefaultCase: " + $switch.getDefaultCase); - for(var $caseStmt of $switch.cases) { - println("case is default: " + $caseStmt.isDefault); - println("case is empty: " + $caseStmt.isEmpty); - println("case next instruction: " + $caseStmt.nextInstruction.code); - println("case instructions:"); - for(var $caseInst of $case.instructions) { - println($caseInst.code); - } - } - } -*/ -end - -function testSwitch($switch) { - println("hasDefaultCase: " + $switch.hasDefaultCase); - println("getDefaultCase: " + $switch.getDefaultCase); - println("condition: " + $switch.condition.code); - for(var $caseStmt of $switch.cases) { - println("case is default: " + $caseStmt.isDefault); - println("case is empty: " + $caseStmt.isEmpty); - println("values: " + $caseStmt.values.map(v => v.code)); - println("next case: " + ($caseStmt.nextCase !== undefined ? $caseStmt.nextCase.code : "undefined")); - println("case next instruction: " + $caseStmt.nextInstruction.code); - println("case instructions:"); - for(var $caseInst of $caseStmt.instructions) { - println($caseInst.code); - } - } -} diff --git a/ClavaWeaver/resources/clava/test/weaver/TagDecl.js b/ClavaWeaver/resources/clava/test/weaver/TagDecl.js new file mode 100644 index 0000000000..f9481fa046 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/TagDecl.js @@ -0,0 +1,31 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; + +for (const $vardecl of Query.search("function", "structTest").search( + "vardecl" +)) { + console.log("Struct: " + $vardecl.type.desugarAll.decl.name); +} + +// Test copying struct +for (const $vardecl of Query.search("vardecl", "struct_decl")) { + const $elaboratedType = $vardecl.type; // Obtain elaborated type + + // Elaborated type can be other things besides structs (e.g., class A, enum B) + // You can test the type of the elaborated type by using .keyword + // Obtain the struct itself. + const $struct = $elaboratedType.desugarAll.decl; + + const $newStruct = $struct.copy(); // Copy struct + $newStruct.name = "new_struct"; // Change name + $struct.insertAfter($newStruct); // Insert new struct in the code + + // Create type for new structure, returns an elaboratedType + const $newStructType = ClavaJoinPoints.structType($newStruct); + // Create typedef for new structure + const $typedef = ClavaJoinPoints.typedefDecl($newStructType, "new_typedef"); + // Insert typedef after vardecl + $vardecl.insertAfter($typedef); +} + +console.log("Code:\n" + Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/TagDecl.lara b/ClavaWeaver/resources/clava/test/weaver/TagDecl.lara deleted file mode 100644 index 52660a1bb9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/TagDecl.lara +++ /dev/null @@ -1,35 +0,0 @@ -import weaver.Query; -import clava.ClavaJoinPoints; - -aspectdef TagDecl - - select function{"structTest"}.vardecl end - apply - println("Struct: " + $vardecl.type.desugarAll.decl.name); - end - - - // Test copying struct - select vardecl{"struct_decl"} end - apply - var $elaboratedType = $vardecl.type; // Obtain elaborated type - - // Elaborated type can be other things besides structs (e.g., class A, enum B) - // You can test the type of the elaborated type by using .keyword - // Obtain the struct itself. - var $struct = $elaboratedType.desugarAll.decl; - - var $newStruct = $struct.copy(); // Copy struct - $newStruct.name = "new_struct"; // Change name - $struct.insertAfter($newStruct); // Insert new struct in the code - - // Create type for new structure, returns an elaboratedType - var $newStructType = ClavaJoinPoints.structType($newStruct); - // Create typedef for new structure - var $typedef = ClavaJoinPoints.typedefDecl($newStructType, "new_typedef"); - // Insert typedef after vardecl - $vardecl.insertAfter($typedef); - end - - println("Code:\n" + Query.root().code); -end diff --git a/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.js b/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.js new file mode 100644 index 0000000000..f5595cd648 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.js @@ -0,0 +1,9 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $class of Query.search("class")) { + console.log("Class: " + $class.name); + + for (const $base of $class.bases) { + console.log("- " + $base.name); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.lara b/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.lara deleted file mode 100644 index f35ef32772..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/TemplateSpecializationType.lara +++ /dev/null @@ -1,14 +0,0 @@ -import weaver.Query; - -aspectdef TemplateSpecializationType - - for(var $class of Query.search("class")) { - println("Class: " + $class.name); - - for(var $base of $class.bases) { - println("- " + $base.name); - } - - } - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/ThisTest.js b/ClavaWeaver/resources/clava/test/weaver/ThisTest.js new file mode 100644 index 0000000000..c081b8fa90 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/ThisTest.js @@ -0,0 +1,8 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +console.log("This decl"); +for (const $memberAccess of Query.search("function", "getVolume").search( + "memberAccess" +)) { + console.log($memberAccess.base.decl.name); +} diff --git a/ClavaWeaver/resources/clava/test/weaver/ThisTest.lara b/ClavaWeaver/resources/clava/test/weaver/ThisTest.lara deleted file mode 100644 index d6c99fbfcf..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/ThisTest.lara +++ /dev/null @@ -1,11 +0,0 @@ -import weaver.Query; - -aspectdef ThisTest - - println("This decl"); - for(var $memberAccess of Query.search("function", "getVolume").search("memberAccess")) { - println($memberAccess.base.decl.name); - } - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Traversal.js b/ClavaWeaver/resources/clava/test/weaver/Traversal.js index 07c4ac7bea..0b986a1259 100644 --- a/ClavaWeaver/resources/clava/test/weaver/Traversal.js +++ b/ClavaWeaver/resources/clava/test/weaver/Traversal.js @@ -1,11 +1,10 @@ -laraImport("weaver.Query"); -laraImport("weaver.TraversalType"); +import Query from "@specs-feup/lara/api/weaver/Query.js"; +import TraversalType from "@specs-feup/lara/api/weaver/TraversalType.js"; -println("Postorder traversal"); for (const $jp of Query.search("function", "foo").search( undefined, undefined, TraversalType.POSTORDER )) { - println($jp); + console.log($jp); } diff --git a/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.js b/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.js new file mode 100644 index 0000000000..18e0335caf --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.js @@ -0,0 +1,24 @@ +import ClavaType from "@specs-feup/clava/api/clava/ClavaType.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const $fn = Query.search("function", "inputInCast").first(); + +for (const $vardecl of Query.searchFrom($fn.body, "vardecl")) { + const varrefs = []; + + const $typeCopy = ClavaType.getVarrefsInTypeCopy($vardecl.type, varrefs); + + for (const $varref of varrefs) { + const $vdecl = $varref.declaration; + if ($vdecl.name.endsWith("_renamed")) { + continue; + } + + $vdecl.name = $vdecl.name + "_renamed"; + } + + console.log("Original type: " + $vardecl.type.code); + $vardecl.type = $typeCopy; +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.lara b/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.lara deleted file mode 100644 index 0b5ab0613e..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/TypeRenamer.lara +++ /dev/null @@ -1,135 +0,0 @@ -import clava.ClavaType; -//import lara.util.StringSet; - -aspectdef TypeRenamer - - select function{"inputInCast"}.vardecl end - apply - var varrefs = []; - - var $typeCopy = ClavaType.getVarrefsInTypeCopy($vardecl.type, varrefs); - - for(var $varref of varrefs) { - //println("Varref name: " + $varref.name); - //println("Vardecl name: " + $varref.declaration.name); - //println("Vardecl loc: " + $varref.declaration.location); - - //$varref.name = $varref.name + "_renamed"; - var $vdecl = $varref.declaration; - if($vdecl.name.endsWith("_renamed")) { - continue; - } - - $vdecl.name = $vdecl.name + "_renamed"; - } - - println("Original type: " + $vardecl.type.code); - $vardecl.type = $typeCopy; - end - - select program end - apply - println($program.code); - end - -end - -// println("Original type:" + $vardecl.type.code); -// println("Renamed type:" + $typeCopy.code); - - //var renameMap = {'ldmx' : 'ldmx_renamed'}; - //var $originalType = $vardecl.type; - // var $renamedType = renameType($vardecl.type, renameMap); - //$vardecl.type = $renamedType; - - -/* -// Visit $expr in type -function renameType($type, renameMap) { - println("Type:" + $type.astName); - - if($type.instanceOf("pointerType")) { - //if($type.astName === "PointerType") { - var $typeCopy = $type.deepCopy(); - //$typeCopy.setValue('pointeeType', renameType($typeCopy.getValue('pointeeType'), renameMap)); - $typeCopy.pointee = renameType($typeCopy.pointee, renameMap); - return $typeCopy; - } - - if($type.instanceOf("parenType")) { - // if ($type.astName === "ParenType") { - var $typeCopy = $type.deepCopy(); - $typeCopy.desugar = renameType($typeCopy.desugar, renameMap); - return $typeCopy; - } - - if($type.instanceOf("variableArrayType")) { - //if ($type.astName === "VariableArrayType") { - var $typeCopy = $type.deepCopy(); - renameVarrefs($typeCopy.sizeExpr, renameMap); - return $typeCopy; - } - - return $type; -} - -function renameVarrefs($expr, renameMap) { - for(var $varref of $expr.getDescendantsAndSelf("varref")) { - var newName = renameMap[$varref.name]; - - if(newName === undefined) { - continue; - } - - $varref.name = newName; - } -} -*/ - -/* -function visitExprInTypeCopy($type, exprFunction) { - - if($type.instanceOf("pointerType")) { - var $typeCopy = $type.deepCopy(); - $typeCopy.pointee = visitExprInTypeCopy($typeCopy.pointee, exprFunction); - return $typeCopy; - } - - if($type.instanceOf("parenType")) { - var $typeCopy = $type.deepCopy(); - $typeCopy.desugar = visitExprInTypeCopy($typeCopy.desugar, exprFunction); - return $typeCopy; - } - - if($type.instanceOf("variableArrayType")) { - var $typeCopy = $type.deepCopy(); - exprFunction($typeCopy.sizeExpr); - return $typeCopy; - } - - return $type; -} -*/ - -/** - * @param type a type join point that will be visited looking for $expr join points. Any visited nodes in the type (e.g., desugar) will be copied, so that the returned varrefs can be safely modified. - * - * @param varrefs an array (possibly empty) where the $varref join points found in the given type will be stored - * - * @return a copy of the given $type, to which the varrefs refer to - */ - /* -function getVarrefsInTypeCopy($type, varrefs) { - - //var varrefs = []; - - var exprFunction = function($expr) { - - for(var $varref of $expr.getDescendantsAndSelf("varref")) { - varrefs.push($varref); - } - }; - - return visitExprInTypeCopy($type, exprFunction); -} -*/ diff --git a/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.js b/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.js new file mode 100644 index 0000000000..14f1947d46 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.js @@ -0,0 +1,87 @@ +import ClavaJoinPoints from "@specs-feup/clava/api/clava/ClavaJoinPoints.js"; +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +const floatType = ClavaJoinPoints.builtinType("float"); +const intType = ClavaJoinPoints.builtinType("int"); +const doubleType = ClavaJoinPoints.builtinType("double"); + +//// Vector + +// Get template argument types +for (const $vardecl of Query.search("file").search("vardecl", "W")) { + console.log("Original template args: " + $vardecl.type.templateArgsStrings); + + const typesStrings = []; + for (const $type of $vardecl.type.templateArgsTypes) { + typesStrings.push($type.code); + } + console.log("Original template args types: " + typesStrings.join(", ")); +} + +// Set a single template argument +for (const $vardecl of Query.search("file").search("vardecl", "W")) { + $vardecl.type.setTemplateArgType(0, floatType); + console.log("After setting float: " + $vardecl.type.templateArgsStrings); +} + +// Set all template arguments +for (const $vardecl of Query.search("file").search("vardecl", "W")) { + $vardecl.type.templateArgsTypes = [intType]; + console.log( + "After setting int with array: " + $vardecl.type.templateArgsStrings + ); +} + +//// Map + +// Get template argument types +for (const $vardecl of Query.search("file").search("vardecl", "map")) { + console.log("Original template args: " + $vardecl.type.templateArgsStrings); +} + +// Set a single template argument +for (const $vardecl of Query.search("file").search("vardecl", "map")) { + $vardecl.type.setTemplateArgType(1, doubleType); + console.log( + "After second arg to double: " + $vardecl.type.templateArgsStrings + ); +} + +// Set all template arguments +for (const $vardecl of Query.search("file").search("vardecl", "map")) { + $vardecl.type.templateArgsTypes = [doubleType, intType]; + console.log( + "After setting with array [double, int]: " + + $vardecl.type.templateArgsStrings + ); +} + +// Change typedef declaration +for (const $typedefDecl of Query.search("typedefDecl", "typedef_to_change")) { + $typedefDecl.type.templateArgsTypes = [floatType]; + console.log("After setting typedef_to_change: " + $typedefDecl.type.code); +} + +// Change type of vardecl which is a typedef +for (const $vardecl of Query.search("vardecl", "changed_typedef_type")) { + $vardecl.type.templateArgsTypes = [intType]; + + if($vardecl.type.kind === "ElaboratedType") { + $vardecl.type = $vardecl.type.desugar; + } + + if ($vardecl.type.kind === "TypedefType") { + $vardecl.type = $vardecl.type.desugar; + } + + console.log("After setting changed_typedef_type: " + $vardecl.type.code); +} + +// Def on arrays +for (const $vardecl of Query.search("function", "type_params").search( + "vardecl", + "intVector" +)) { + const arrayType = ClavaJoinPoints.constArrayType("float", 1, 2); + $vardecl.type.templateArgsTypes = [doubleType, arrayType]; +} diff --git a/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.lara b/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.lara deleted file mode 100644 index bc81367abe..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/TypeTemplate.lara +++ /dev/null @@ -1,106 +0,0 @@ -import clava.ClavaJoinPoints; -/* -aspectdef Test2 - - - select function{"foo_no_std"}.vardecl{"W"} end - apply - println("TYPE:" + $vardecl.type.templateArgsTypes[0].code); - end - -end -*/ -aspectdef Test - - var floatType = ClavaJoinPoints.builtinType("float"); - var intType = ClavaJoinPoints.builtinType("int"); - var doubleType = ClavaJoinPoints.builtinType("double"); - - - //// Vector - - // Get template argument types - select file.vardecl{"W"} end - apply - println("Original template args: " + $vardecl.type.templateArgsStrings); - - var typesStrings = []; - for(var $type of $vardecl.type.templateArgsTypes) { - typesStrings.push($type.code); - } - println("Original template args types: " + typesStrings.join(", ")); - end - - // Set a single template argument - select file.vardecl{"W"} end - apply - $vardecl.type.setTemplateArgType(0, floatType); - println("After setting float: " + $vardecl.type.templateArgsStrings); - end - - // Set all template arguments - select file.vardecl{"W"} end - apply - $vardecl.type.templateArgsTypes = [intType]; - println("After setting int with array: " + $vardecl.type.templateArgsStrings); - end - - - - //// Map - - // Get template argument types - select file.vardecl{"map"} end - apply - println("Original template args: " + $vardecl.type.templateArgsStrings); - end - - // Set a single template argument - select file.vardecl{"map"} end - apply - $vardecl.type.setTemplateArgType(1, doubleType); - println("After second arg to double: " + $vardecl.type.templateArgsStrings); - end - - // Set all template arguments - select file.vardecl{"map"} end - apply - $vardecl.type.templateArgsTypes = [doubleType, intType]; - println("After setting with array [double, int]: " + $vardecl.type.templateArgsStrings); - end - - - // Change typedef declaration - select typedefDecl{"typedef_to_change"} end - apply - $typedefDecl.type.templateArgsTypes = [floatType]; - println("After setting typedef_to_change: " + $typedefDecl.type.code); - end - - // Change type of vardecl which is a typedef - select vardecl{"changed_typedef_type"} end - apply - $vardecl.type.templateArgsTypes = [intType]; - - if($vardecl.type.kind === "ElaboratedType") { - $vardecl.type = $vardecl.type.desugar; - } - - if($vardecl.type.kind === "TypedefType") { - $vardecl.type = $vardecl.type.desugar; - } - - println("After setting changed_typedef_type: " + $vardecl.type.code); - end - - - - - // Def on arrays - select function{"type_params"}.vardecl{"intVector"} end - apply - var arrayType = ClavaJoinPoints.constArrayType("float", 1, 2); - $vardecl.type.def templateArgsTypes = [doubleType, arrayType]; - end - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/Vardecl.js b/ClavaWeaver/resources/clava/test/weaver/Vardecl.js new file mode 100644 index 0000000000..cda8c06e94 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Vardecl.js @@ -0,0 +1,20 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $vardecl of Query.search("vardecl")) { + console.log("vardecl " + $vardecl.name); + console.log("is param? " + $vardecl.isParam); +} + +for (const $call of Query.search("call")) { + if ($call.declaration !== undefined) { + console.log( + "Call '" + $call.name + "' declaration:" + $call.declaration.line + ); + } + + if ($call.definition !== undefined) { + console.log( + "Call '" + $call.name + "' definition:" + $call.definition.line + ); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/Vardecl.lara b/ClavaWeaver/resources/clava/test/weaver/Vardecl.lara deleted file mode 100644 index 74a479c392..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Vardecl.lara +++ /dev/null @@ -1,22 +0,0 @@ -aspectdef Vardecl - - select vardecl end - apply - println("vardecl " + $vardecl.name); - println("is param? " + $vardecl.isParam); - end - - select call end - apply - if($call.declaration !== undefined) { - println("Call '" + $call.name + "' declaration:" + $call.declaration.line); - } - - if($call.definition !== undefined) { - println("Call '" + $call.name + "' definition:" + $call.definition.line); - } - - end - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/VardeclV2.js b/ClavaWeaver/resources/clava/test/weaver/VardeclV2.js new file mode 100644 index 0000000000..9b758c841c --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/VardeclV2.js @@ -0,0 +1,22 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const chain of Query.search("function", "removeInit").search( + "vardecl", + "array1" +).chain()) { + const $function = chain["function"]; + const $vardecl = chain["vardecl"]; + + $vardecl.removeInit(); + console.log("After removing init:\n" + $function.code); +} + +const globalRef = Query.search("function", "externalVar") + .search("varref") + .first(); +console.log(globalRef.decl.definition.location); + +const $vardeclToVarref = Query.search("function", "varref") + .search("vardecl") + .first(); +console.log("Is varref: " + $vardeclToVarref.varref().instanceOf("varref")); diff --git a/ClavaWeaver/resources/clava/test/weaver/VardeclV2.lara b/ClavaWeaver/resources/clava/test/weaver/VardeclV2.lara deleted file mode 100644 index e09d191883..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/VardeclV2.lara +++ /dev/null @@ -1,60 +0,0 @@ -import weaver.Query; - -aspectdef VardeclV2Test - - select function{"removeInit"}.vardecl{"array1"} end - apply - $vardecl.removeInit(); - println("After removing init:\n" + $function.code); - end - - - var globalRef = Query.search("function", "externalVar").search("varref").first(); - println(globalRef.decl.definition.location); - - var $vardeclToVarref = Query.search("function", "varref").search("vardecl").first(); - println("Is varref: " + $vardeclToVarref.varref().instanceOf("varref")); -/* - for(var $vardecl of Query.search("vardecl", "GRAD_FILTER")) { - println($vardecl.node); - } -*/ -/* - for(var $vardecl of Query.search("vardecl")) { - println("Vardecl: " + $vardecl.node.getNodeSignature()); - var global = getGlobalDecl($vardecl); - if(global !== undefined) { - println("global location: " + global.location); - } - } - */ - -end - -/* -function getGlobalDecl($vardecl) { - if(!$vardecl.isGlobal) { - debug("$vardecl.globalDecl: vardecl '"+$vardecl.name+"' is not global"); - return undefined; - } - - var storageClass = $vardecl.storageClass; - - // Is global and storageClass is 'none', this is the global declaration - if(storageClass === "none") { - return $vardecl; - } - - if(storageClass === "extern") { - // Search for the vardecl with storageClass none - for(var $vardecl of Query.search("vardecl", $vardecl.name)) { - if($vardecl.storageClass === "none") { - return $vardecl; - } - } - - } - - println("storage class not implemented: " + $vardecl.storageClass); -} -*/ \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.js b/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.js new file mode 100644 index 0000000000..3bfd76909d --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.js @@ -0,0 +1,14 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +for (const $loop of Query.search("loop", "while")) { + const $cond = $loop.cond; + console.log("while line#" + $loop.line); + console.log("while cond.code = " + $cond.code); +} + +for (const $loop of Query.search("loop", "while")) { + const $cond = $loop.cond; + for (const $varref of Query.searchFrom($cond, "varref")) { + console.log($varref.name); + } +} diff --git a/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.lara b/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.lara deleted file mode 100644 index 2120a1f16d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/VarrefInWhile.lara +++ /dev/null @@ -1,12 +0,0 @@ -aspectdef VarrefInWhile - select loop{'while'}.cond end - apply - println('while line#' + $loop.line); - println('while cond.code = ' + $cond.code); - end - - select loop{'while'}.cond.varref end - apply - println($varref.name); - end -end \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/Wrap.js b/ClavaWeaver/resources/clava/test/weaver/Wrap.js new file mode 100644 index 0000000000..937624e202 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/Wrap.js @@ -0,0 +1,15 @@ +import Query from "@specs-feup/lara/api/weaver/Query.js"; + +let lastWrapped = undefined; + +for (const $call of Query.search("call")) { + $call.wrap("wrap_" + $call.name); + // At this point, the call joinpoint changed and became the wrapped call + lastWrapped = $call.name; +} + +for (const $call of Query.search("function", lastWrapped).search("call")) { + $call.insertBefore("// Before call"); +} + +console.log(Query.root().code); diff --git a/ClavaWeaver/resources/clava/test/weaver/Wrap.lara b/ClavaWeaver/resources/clava/test/weaver/Wrap.lara deleted file mode 100644 index 06cba19b43..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/Wrap.lara +++ /dev/null @@ -1,23 +0,0 @@ - -aspectdef Wrap - - var lastWrapped = undefined; - select call end - apply - $call.exec wrap("wrap_" + $call.name); - // At this point, the call joinpoint changed and became the wrapped call - lastWrapped = $call.name; - end - - select function{lastWrapped}.call end - apply - $call.insert before "// Before call"; - end - - select program end - apply - println($program.code); - end - - -end diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/AddArgTest.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/AddArgTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/AddArgTest.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/AddArgTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/AddGlobal.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/AddGlobal.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/AddGlobal.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/AddGlobal.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/AddParamTest.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/AddParamTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/AddParamTest.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/AddParamTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.lara b/ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.lara rename to ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.lara.txt deleted file mode 100644 index e90ddadb8d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/c/results/ArrayTest.lara.txt +++ /dev/null @@ -1,6 +0,0 @@ -oneDim dims: 10 -oneDimarray size: 10 -twoDims dims: 2,3 -twoDimsarray size: 6 -threeDims dims: 2,3,4 -threeDimsarray size: 24 \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/AstNodes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/AstNodes.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/AstNodes.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/AstNodes.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Cfg.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Cfg.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Cfg.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Cfg.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Cilk.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Cilk.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Cilk.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Cilk.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Clone.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Clone.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Clone.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Clone.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Detach.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Detach.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Detach.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Detach.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Dijkstra.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Dijkstra.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Dijkstra.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Dijkstra.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/DynamicCallGraph.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/DynamicCallGraph.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/DynamicCallGraph.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/DynamicCallGraph.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Expressions.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Expressions.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Expressions.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Expressions.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/File.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/File.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/File.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/File.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Inline.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Inline.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Inline.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Inline.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/InsertsJp.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/InsertsJp.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/InsertsJp.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/InsertsJp.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/InsertsLiteral.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/InsertsLiteral.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/InsertsLiteral.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/InsertsLiteral.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Loop.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Loop.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Loop.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Loop.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.js.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.js.txt new file mode 100644 index 0000000000..7bb3314a79 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.js.txt @@ -0,0 +1,22 @@ +code : int i; jpType : declStmt +code : int A[100]; jpType : declStmt +code : for(i = 0; i < 100; i++) { + if(i > 10) A[i] = i; +} + jpType : loop +code : i = 0; jpType : exprStmt +code : i < 100; jpType : exprStmt +code : i++; jpType : exprStmt +code : { + if(i > 10) A[i] = i; +} + jpType : body +code : if(i > 10) A[i] = i; + jpType : if +code : + A[i] = i; + jpType : body +code : A[i] = i; jpType : exprStmt +code : +return 0; + jpType : returnStmt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.lara.txt deleted file mode 100644 index 5cbb0cdb7a..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/c/results/NullNodes.lara.txt +++ /dev/null @@ -1,9 +0,0 @@ - code : int i; astName : DeclStmt - code : int A[100]; astName : DeclStmt - code : i = 0; astName : ExprStmt - code : i < 100; astName : ExprStmt - code : i++; astName : ExprStmt - code : A[i] = i; astName : ExprStmt - code : -return 0; - astName : ReturnStmt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/RemoveInclude.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/RemoveInclude.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/RemoveInclude.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/RemoveInclude.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/ReplaceCallWithStmt.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/ReplaceCallWithStmt.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/ReplaceCallWithStmt.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/ReplaceCallWithStmt.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Selects.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Selects.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Selects.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Selects.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/SetType.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/SetType.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/SetType.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/SetType.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/SwitchTest.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/SwitchTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/SwitchTest.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/SwitchTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/TagDecl.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/TagDecl.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/TagDecl.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/TagDecl.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Traversal.js.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Traversal.js.txt index 3b891e739b..8b8a6e4f0e 100644 --- a/ClavaWeaver/resources/clava/test/weaver/c/results/Traversal.js.txt +++ b/ClavaWeaver/resources/clava/test/weaver/c/results/Traversal.js.txt @@ -1,12 +1,33 @@ -Postorder traversal -Joinpoint 'vardecl' -Joinpoint 'declStmt' -Joinpoint 'varref' -Joinpoint 'intLiteral' -Joinpoint 'intLiteral' -Joinpoint 'intLiteral' -Joinpoint 'binaryOp' -Joinpoint 'binaryOp' -Joinpoint 'binaryOp' -Joinpoint 'exprStmt' -Joinpoint 'body' \ No newline at end of file +Vardecl { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxVardecl {} +} +DeclStmt { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxDeclStmt {} +} +Varref { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxVarref {} +} +IntLiteral { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxIntLiteral {} +} +IntLiteral { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxIntLiteral {} +} +IntLiteral { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxIntLiteral {} +} +BinaryOp { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxBinaryOp {} +} +BinaryOp { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxBinaryOp {} +} +BinaryOp { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxBinaryOp {} +} +ExprStmt { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxExprStmt {} +} +Body { +_javaObject: nodeJava_pt_up_fe_specs_clava_weaver_joinpoints_CxxBody {} +} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/TypeRenamer.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/TypeRenamer.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/TypeRenamer.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/TypeRenamer.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/VarrefInWhile.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/VarrefInWhile.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/VarrefInWhile.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/VarrefInWhile.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.js.macos.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.js.macos.txt new file mode 100644 index 0000000000..60b25452ac --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.js.macos.txt @@ -0,0 +1,111 @@ +/**** File 'wrap.c' ****/ + +#include "wrap.h" +#include +#include "clava_wrappers/clava_weaver_wrappers.h" + +void voidFooFileDecl(int *a); +void wrap_voidFooFileDecl(int *a); + +int foo(int a) { + + return a + 1; +} + +int wrap_fooNoDecl(int a); + + +int fooNoDecl(int a) { + + return a + 10; +} + + +int wrap_fooNoDecl(int a) { + int result; + result = fooNoDecl(a); + + return result; +} + +void voidFoo(int *a) { + (*a)++; +} + +void voidFooFileDecl(int *a) { + (*a)++; +} + +void wrap_voidFooFileDecl(int *a) { + voidFooFileDecl(a); +} + +int main() { + wrap_foo(10); + wrap_fooNoDecl(20); + int a = 100; + wrap_voidFoo(&a); + wrap_voidFooFileDecl(&a); + wrap_printf("Hello"); +} + +/**** End File ****/ + +/**** File 'wrap.h' ****/ + +#ifndef _WRAP_H_ +#define _WRAP_H_ + + +int foo(int a); + +void voidFoo(int *a); +#endif + +/**** End File ****/ + + +/**** File 'clava_wrappers/clava_weaver_wrappers.h' ****/ + +#ifndef _CLAVA_WEAVER_WRAPPERS_H_ +#define _CLAVA_WEAVER_WRAPPERS_H_ + + +int wrap_foo(int a); + +void wrap_voidFoo(int *a); + +int wrap_printf(char const * restrict A, ...); +#endif + +/**** End File ****/ + +/**** File 'clava_wrappers/clava_weaver_wrappers.c' ****/ + +#include "wrap.h" +#include +#include "clava_wrappers/clava_weaver_wrappers.h" + +int wrap_foo(int a) { + int result; + result = foo(a); + + return result; +} + + +void wrap_voidFoo(int *a) { + voidFoo(a); +} + + +int wrap_printf(char const * restrict A, ...) { + int result; + // Before call + result = printf(A); + + return result; +} + +/**** End File ****/ + diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/c/results/Wrap.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/c/results/loop.lara.txt b/ClavaWeaver/resources/clava/test/weaver/c/results/loop.lara.txt deleted file mode 100644 index 1bb002d67e..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/c/results/loop.lara.txt +++ /dev/null @@ -1,45 +0,0 @@ -loop control var: a -is innermost? false -is outermost? true -nested level: 0 -rank: 1 -loop control var: b -is innermost? false -is outermost? false -nested level: 1 -rank: 1,1 -loop control var: c -is innermost? true -is outermost? false -nested level: 2 -rank: 1,1,1 -loop control var: undefined -is innermost? true -is outermost? true -nested level: 0 -rank: 2 -loop control var: i -is innermost? true -is outermost? true -nested level: 0 -rank: 3 -loop control var: j -is innermost? true -is outermost? true -nested level: 0 -rank: 4 -loop control var: i -is innermost? true -is outermost? true -nested level: 0 -rank: 5 -loop control var: i -is innermost? true -is outermost? true -nested level: 0 -rank: 6 -loop control var: undefined -is innermost? true -is outermost? true -nested level: 0 -rank: 7 \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/c/src/loop.c b/ClavaWeaver/resources/clava/test/weaver/c/src/loop.c index 64c20126e3..e66acd724c 100644 --- a/ClavaWeaver/resources/clava/test/weaver/c/src/loop.c +++ b/ClavaWeaver/resources/clava/test/weaver/c/src/loop.c @@ -1,45 +1,118 @@ +void iterationsExpr() { + + // 10 + for (int a = 0; a < 10; a++) { + } + + // 11 + for (int a = 0; a <= 10; a++) { + } + + // 9 + for (int a = 1; a < 10; a++) { + } + + // 11 + for (int a = 10; a >= 0; a--) { + } + + // 10 + for (int a = 0; 10 > a; a++) { + } + + // 11 + for (int a = 0; 10 >= a; a++) { + } + + // 10 + for (int a = 0; (a) < 10; a++) { + } + + // 6 + for (float a = 0.0; a < 10.0; a += 1.5) { + } + + // 5 + for (int a = 1; a < 11; a += 2) { + } + + // 6 + for (int a = 1; a <= 11; a += 2) { + } + + // ((end - 1) - start + 1) / 1 + int start; + int end; + for (int a = end - 1; a >= start; a--) { + } + + // 10 + int a1; + for (a1 = 0; a1 < 10; a1++) { + } +} + +void headerInsert1() { + for (int i = 0; i < 10; i++) + ; +} + +void headerInsert2() { + int i; + for (i = 0; i < 10; i++) + ; +} + int main() { - for(int a=0; a<10; a++) { - for(int b=0; b<10; b++) { - for(int c=0; c<10; c++) { - - } - } - } - - - - for(;;){ - - } - - double a = 0.5; - int i; - - for(i=0; i<10; i++) { - a += 0.1; - } - - for(int j=0; j<10; j++) { - a += 0.1; - } - - i = 0; - for(; i<10; i++) { - a += 0.1; - } - - for(; ; i++) { - a += 0.1; - } - - i = 20; - while(i > 10) { - i--; - } - - - - return 0; + for (int a = 0; a < 10; a++) { + for (int b = 0; b < 10; b++) { + for (int c = 0; c < 10; c++) { + } + } + } + + for (;;) { + } + + double a = 0.5; + int i; + + for (i = 0; i < 10; i++) { + a += 0.1; + } + + for (int j = 0; j < 10; j++) { + a += 0.1; + } + + i = 0; + for (; i < 10; i++) { + a += 0.1; + } + + for (;; i++) { + a += 0.1; + } + + i = 20; + while (i > 10) { + i--; + } + + if (i > 10) { + for (int a = 0; a < 10; a++) { + for (int b = 0; b < 10; b++) { + } + } + } else { + for (int a = 0; a < 10; a++) { + if (i < 5) { + for (int b = 0; b < 10; b++) { + } + } + } + } + + return 0; } \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.js.txt similarity index 61% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.js.txt index 3f4926a152..c48cb12651 100644 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.lara.txt +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Actions.js.txt @@ -1,6 +1,8 @@ +/**** File 'actions.cpp' ****/ int main() { float aDouble = 0.0; unsigned int anInt = 0; return 0; } +/**** End File ****/ diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/AddGlobal.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/AddGlobal.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/AddGlobal.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/AddGlobal.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ArrayAccess.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ArrayAccess.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ArrayAccess.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ArrayAccess.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/AstAttributes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/AstAttributes.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/AstAttributes.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/AstAttributes.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/AttributeUse.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/AttributeUse.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/AttributeUse.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/AttributeUse.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Call.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Call.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Call.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Call.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ClassManipulation.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ClassManipulation.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ClassManipulation.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ClassManipulation.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Clone.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Clone.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Clone.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Clone.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.js.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.js.txt new file mode 100644 index 0000000000..f3a1677f45 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.js.txt @@ -0,0 +1 @@ +[ '#include "../clone_on_file.h"' ] diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.lara.txt deleted file mode 100644 index e82850cbb9..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/CloneOnFile.lara.txt +++ /dev/null @@ -1 +0,0 @@ -#include "../clone_on_file.h" diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/DataClass.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/DataClass.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/DataClass.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/DataClass.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ExpressionDecls.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ExpressionDecls.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ExpressionDecls.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ExpressionDecls.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Expressions.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Expressions.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Expressions.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Expressions.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.js.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.js.txt new file mode 100644 index 0000000000..a6c068dbe6 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.js.txt @@ -0,0 +1,10 @@ +AClass fields +Field: anInt +Is public: false +Field: aFloat +Is public: false +AStruct fields +Field: anInt +Is public: true +Field: aFloat +Is public: true \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.lara.txt deleted file mode 100644 index ce1366157d..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Field.lara.txt +++ /dev/null @@ -1,2 +0,0 @@ -AClass fields -AStruct fields \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/File.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/File.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/File.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/File.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/FileRebuild.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/FileRebuild.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/FileRebuild.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/FileRebuild.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Function.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Function.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.js.txt similarity index 89% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.js.txt index db3056669e..16e16344ae 100644 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.lara.txt +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Function2.js.txt @@ -1,5 +1,5 @@ -g,h -g,h,ret +[ 'g', 'h' ] +[ 'g', 'h', 'ret' ] /**** File 'function2.cpp' ****/ void test4(char g[], int *h); int * test4_(char g[], int *h, int * ret); diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/GlobalAttributes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/GlobalAttributes.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/GlobalAttributes.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/GlobalAttributes.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/HamidCfg.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/HamidCfg.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/HamidCfg.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/HamidCfg.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Hdf5Types.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Hdf5Types.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Hdf5Types.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Hdf5Types.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsJp.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsJp.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsJp.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsJp.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsLiteral.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsLiteral.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsLiteral.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/InsertsLiteral.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/LaraGetter.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/LaraGetter.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/LaraGetter.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/LaraGetter.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Loop.js.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Loop.js.txt new file mode 100644 index 0000000000..b07b3e7530 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Loop.js.txt @@ -0,0 +1,100 @@ +loop control var: a +is innermost? false +is outermost? true +nested level: 0 +rank: 1 +loop control var: b +is innermost? false +is outermost? false +nested level: 1 +rank: 1,1 +loop control var: c +is innermost? true +is outermost? false +nested level: 2 +rank: 1,1,1 +loop control var: undefined +is innermost? true +is outermost? true +nested level: 0 +rank: 2 +loop control var: i +is innermost? true +is outermost? true +nested level: 0 +rank: 3 +loop control var: j +is innermost? true +is outermost? true +nested level: 0 +rank: 4 +loop control var: i +is innermost? true +is outermost? true +nested level: 0 +rank: 5 +loop control var: i +is innermost? true +is outermost? true +nested level: 0 +rank: 6 +loop control var: undefined +is innermost? true +is outermost? true +nested level: 0 +rank: 7 +loop control var: a +is innermost? false +is outermost? true +nested level: 0 +rank: 8 +loop control var: b +is innermost? true +is outermost? false +nested level: 1 +rank: 8,1 +loop control var: a +is innermost? false +is outermost? true +nested level: 0 +rank: 9 +loop control var: b +is innermost? true +is outermost? false +nested level: 1 +rank: 9,1 +iterations expr: 10 +iterations: 10 +iterations expr: 10 + 1 +iterations: 11 +iterations expr: 10 - 1 +iterations: 9 +iterations expr: 10 + 1 +iterations: 11 +iterations expr: 10 +iterations: 10 +iterations expr: 10 + 1 +iterations: 11 +iterations expr: 10 +iterations: 10 +iterations expr: (10.0 - 0.0) / 1.5 +iterations: 6 +iterations expr: (11 - 1) / 2 +iterations: 5 +iterations expr: (11 - 1 + 2) / 2 +iterations: 6 +iterations expr: (end - 1) - (start) + 1 +iterations: undefined +iterations expr: 10 +iterations: 10 +After header insert: { +int newVar1; +int newVar2; +for(int newVar1 = 10, i = 0, newVar2 = 20; newVar1< 100 , i < 10 , newVar2< 200; newVar1++ , i++ , newVar2--); +} +After header insert: { +int i; +int newVar1; +int newVar2; +for(newVar1 = 10 , i = 0 , newVar2 = 20; newVar1< 100 , i < 10 , newVar2< 200; newVar1++ , i++ , newVar2--); +} \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Macros.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Macros.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Macros.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Macros.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Member.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Member.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Member.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Member.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/MultiFile.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/MultiFile.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/MultiFile.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/MultiFile.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/NoParsing.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/NoParsing.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/NoParsing.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/NoParsing.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Omp.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Omp.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Omp.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Omp.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpAttributes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpAttributes.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpAttributes.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpAttributes.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpSetAttributes.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpSetAttributes.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpSetAttributes.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpSetAttributes.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpThreadsExplore.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpThreadsExplore.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpThreadsExplore.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/OmpThreadsExplore.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.js.txt similarity index 82% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.js.txt index 21ad2f5dfc..7feccb4103 100644 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.lara.txt +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ParentRegion.js.txt @@ -6,9 +6,12 @@ vardecl 'insideScope' is in region 'scope' at line 20, parentRegion is a 'loop' varref 'i' is in region 'loop' at line 10, parentRegion is a 'function' at line 7 varref 'i' is in region 'loop' at line 10, parentRegion is a 'function' at line 7 varref 'a' is in region 'loop' at line 11, parentRegion is a 'function' at line 7 +varref 'bar' is in region 'loop' at line 11, parentRegion is a 'function' at line 7 +varref 'a' is in region 'if' at line 13, parentRegion is a 'loop' at line 10 varref 'a' is in region 'if' at line 14, parentRegion is a 'loop' at line 10 varref 'a' is in region 'if' at line 16, parentRegion is a 'loop' at line 10 varref 'a' is in region 'function' at line 24, parentRegion is a 'file' at line 1 +varref 'foo' is in region 'function' at line 29, parentRegion is a 'file' at line 1 function 'bar' is in region 'file' at line 3 and does not have a parentRegion function 'foo' is in region 'file' at line 7 and does not have a parentRegion function 'main' is in region 'file' at line 27 and does not have a parentRegion \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaAttribute.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaAttribute.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaAttribute.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaAttribute.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaData.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaData.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaData.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/PragmaData.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.js.txt similarity index 99% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.js.txt index 9581c1a504..7b312fd99b 100644 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.lara.txt +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Pragmas.js.txt @@ -1,4 +1,3 @@ -Code: #pragma functionPragma int main() { @@ -25,6 +24,7 @@ int main() { } // After scope - foo } + default marker attribute "id" is working: foo marker contents: { // Scope start - foo @@ -37,4 +37,4 @@ marker contents: { } // After scope - bar // Scope end - foo -} \ No newline at end of file +} diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ReplaceCallWithStmt.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ReplaceCallWithStmt.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ReplaceCallWithStmt.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ReplaceCallWithStmt.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ReverseIterator.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ReverseIterator.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ReverseIterator.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ReverseIterator.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.js.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.js.txt new file mode 100644 index 0000000000..20a06695ce --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.js.txt @@ -0,0 +1,27 @@ +#4 expr -> i = j + m + In exractExprVardecl expr : Joinpoint 'binaryOp' + In exractExprVardecl expr.joinPointType : binaryOp + In exractExprVardecl expr.vardecl : undefined + +#4 expr -> i + In exractExprVardecl expr : Joinpoint 'varref' + In exractExprVardecl expr.joinPointType : varref + In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' + >>>> vardecl#4 int i + +#4 expr -> j + m + In exractExprVardecl expr : Joinpoint 'binaryOp' + In exractExprVardecl expr.joinPointType : binaryOp + In exractExprVardecl expr.vardecl : undefined + +#4 expr -> j + In exractExprVardecl expr : Joinpoint 'varref' + In exractExprVardecl expr.joinPointType : varref + In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' + >>>> vardecl#4 int j + +#4 expr -> m + In exractExprVardecl expr : Joinpoint 'varref' + In exractExprVardecl expr.joinPointType : varref + In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' + >>>> vardecl#4 int m diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.lara.txt deleted file mode 100644 index 7f3634d56c..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/results/SelectVardecl.lara.txt +++ /dev/null @@ -1,35 +0,0 @@ -#4 expr -> i = j + m - In exractExprVardecl expr : Joinpoint 'binaryOp' - In exractExprVardecl expr.joinPointType : binaryOp - In exractExprVardecl expr.selects : left,right,vardecl - In exractExprVardecl expr.vardecl : undefined - -#4 expr -> i - In exractExprVardecl expr : Joinpoint 'varref' - In exractExprVardecl expr.joinPointType : varref - In exractExprVardecl expr.selects : vardecl - In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' - >>>> vardecl#4 int i - -#4 expr -> j + m - In exractExprVardecl expr : Joinpoint 'binaryOp' - In exractExprVardecl expr.joinPointType : binaryOp - In exractExprVardecl expr.selects : left,right,vardecl - In exractExprVardecl expr.vardecl : undefined - -#4 expr -> j - In exractExprVardecl expr : Joinpoint 'varref' - In exractExprVardecl expr.joinPointType : varref - In exractExprVardecl expr.selects : vardecl - In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' - >>>> vardecl#4 int j - - -#4 expr -> m - In exractExprVardecl expr : Joinpoint 'varref' - In exractExprVardecl expr.joinPointType : varref - In exractExprVardecl expr.selects : vardecl - In exractExprVardecl expr.vardecl : Joinpoint 'vardecl' - >>>> vardecl#4 int m - - diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/SetTypeCxx.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/SetTypeCxx.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/SetTypeCxx.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/SetTypeCxx.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.macos.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.macos.txt new file mode 100644 index 0000000000..85feaca2fd --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.macos.txt @@ -0,0 +1,34 @@ +Original qualified name: std::chrono::steady_clock::now +Changed qualified name 1: now +Changed qualified name 2: std::now +Changed qualified name 3: std::chrono::_V2::system_clock::now +Changed then: +if(a == 0) { + a = 3; +} +else { + a = 2; +} + +Changed else: +if(a == 0) { + a = 3; +} +else { + a = 4; +} + +Changed condition: +if(a == 3) { + a = 3; +} +else { + a = 4; +} +Changed Function: +double testFunctionType(int a) { + + return 0; +} +Changed FunctionType: +double (int) \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Setters.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/SkipParsingHeaders.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/SkipParsingHeaders.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/SkipParsingHeaders.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/SkipParsingHeaders.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Statement.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Statement.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Statement.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Statement.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/TemplateSpecializationType.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/TemplateSpecializationType.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/TemplateSpecializationType.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/TemplateSpecializationType.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/ThisTest.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/ThisTest.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/ThisTest.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/ThisTest.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/TypeTemplate.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/TypeTemplate.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/TypeTemplate.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/TypeTemplate.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Vardecl.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Vardecl.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Vardecl.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Vardecl.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/VardeclV2.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/VardeclV2.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/VardeclV2.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/VardeclV2.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.js.macos.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.js.macos.txt new file mode 100644 index 0000000000..1ad911e662 --- /dev/null +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.js.macos.txt @@ -0,0 +1,110 @@ + +/**** File 'wrap.cpp' ****/ + +#include "wrap.h" +#include +#include "clava_wrappers/clava_weaver_wrappers.h" + +void voidFooFileDecl(int *a); + +void wrap_voidFooFileDecl(int *a); + +int foo(int a) { + return a + 1; +} + +int wrap_fooNoDecl(int a); + +int fooNoDecl(int a) { + return a + 10; +} + +int wrap_fooNoDecl(int a) { + int result; + result = fooNoDecl(a); + return result; +} + +void voidFoo(int *a) { + (*a)++; +} + +void voidFooFileDecl(int *a) { + (*a)++; +} + +void wrap_voidFooFileDecl(int *a) { + voidFooFileDecl(a); +} + +int main() { + + wrap_foo(10); + wrap_fooNoDecl(20); + + int a = 100; + wrap_voidFoo(&a); + wrap_voidFooFileDecl(&a); + + wrap_printf("Hello"); +} + +/**** End File ****/ + +/**** File 'wrap.h' ****/ + +#ifndef _WRAP_H_ +#define _WRAP_H_ + + +int foo(int a); + +void voidFoo(int *a); +#endif + +/**** End File ****/ + +/**** File 'clava_wrappers/clava_weaver_wrappers.h' ****/ + +#ifndef _CLAVA_WEAVER_WRAPPERS_H_ +#define _CLAVA_WEAVER_WRAPPERS_H_ + + +int wrap_foo(int a); + +void wrap_voidFoo(int *a); + +int wrap_printf(char const *A, ...); +#endif + +/**** End File ****/ + +/**** File 'clava_wrappers/clava_weaver_wrappers.cpp' ****/ + +#include "wrap.h" +#include +#include "clava_wrappers/clava_weaver_wrappers.h" + +int wrap_foo(int a) { + int result; + result = foo(a); + + return result; +} + + +void wrap_voidFoo(int *a) { + voidFoo(a); +} + + +int wrap_printf(char const *A, ...) { + int result; + // Before call + result = printf(A); + + return result; +} + +/**** End File ****/ + diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cpp/results/Wrap.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/src/loop.cpp b/ClavaWeaver/resources/clava/test/weaver/cpp/src/loop.cpp index f0bca14be1..80c224728a 100644 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/src/loop.cpp +++ b/ClavaWeaver/resources/clava/test/weaver/cpp/src/loop.cpp @@ -1,124 +1,124 @@ void iterationsExpr() { - - // 10 - for(int a=0; a<10; a++) { - } - - // 11 - for(int a=0; a<=10; a++) { - } - - // 9 - for(int a=1; a<10; a++) { - } - - // 11 - for(int a = 10; a >= 0; a--) { - } - - // 10 - for(int a = 0; 10 > a; a++) { - } - - // 11 - for(int a = 0; 10 >= a; a++) { - } - - // 10 - for(int a=0; (a) < 10; a++) { - } - - // 6 - for(float a = 0.0; a < 10.0; a+=1.5) { - } - - // 5 - for(int a=1; a<11; a+=2) { - } - - // 6 - for(int a=1; a<=11; a+=2) { - } - - // ((end - 1) - start + 1) / 1 - int start; - int end; - for(int a = end - 1; a >= start; a--) { - } - - // 10 - int a1; - for(a1=0; a1<10; a1++) { - } + + // 10 + for(int a=0; a<10; a++) { + } + + // 11 + for(int a=0; a<=10; a++) { + } + + // 9 + for(int a=1; a<10; a++) { + } + + // 11 + for(int a = 10; a >= 0; a--) { + } + + // 10 + for(int a = 0; 10 > a; a++) { + } + + // 11 + for(int a = 0; 10 >= a; a++) { + } + + // 10 + for(int a=0; (a) < 10; a++) { + } + + // 6 + for(float a = 0.0; a < 10.0; a+=1.5) { + } + + // 5 + for(int a=1; a<11; a+=2) { + } + + // 6 + for(int a=1; a<=11; a+=2) { + } + + // ((end - 1) - start + 1) / 1 + int start; + int end; + for(int a = end - 1; a >= start; a--) { + } + + // 10 + int a1; + for(a1=0; a1<10; a1++) { + } } void headerInsert1() { - for(int i=0; i<10; i++); + for(int i=0; i<10; i++); } void headerInsert2() { - int i; - for(i=0; i<10; i++); + int i; + for(i=0; i<10; i++); } int main() { - for(int a=0; a<10; a++) { - for(int b=0; b<10; b++) { - for(int c=0; c<10; c++) { - - } - } - } - - - - for(;;){ - - } - - double a = 0.5; - int i; - - for(i=0; i<10; i++) { - a += 0.1; - } - - for(int j=0; j<10; j++) { - a += 0.1; - } - - i = 0; - for(; i<10; i++) { - a += 0.1; - } - - for(; ; i++) { - a += 0.1; - } - - i = 20; - while(i > 10) { - i--; - } - - if(i > 10) { - for(int a=0; a<10; a++) { - for(int b=0; b<10; b++) { - } - } - } else { - for(int a=0; a<10; a++) { - if(i < 5) { - for(int b=0; b<10; b++) { - } - } - - } - } - - - - return 0; + for(int a=0; a<10; a++) { + for(int b=0; b<10; b++) { + for(int c=0; c<10; c++) { + + } + } + } + + + + for(;;){ + + } + + double a = 0.5; + int i; + + for(i=0; i<10; i++) { + a += 0.1; + } + + for(int j=0; j<10; j++) { + a += 0.1; + } + + i = 0; + for(; i<10; i++) { + a += 0.1; + } + + for(; ; i++) { + a += 0.1; + } + + i = 20; + while(i > 10) { + i--; + } + + if(i > 10) { + for(int a=0; a<10; a++) { + for(int b=0; b<10; b++) { + } + } + } else { + for(int a=0; a<10; a++) { + if(i < 5) { + for(int b=0; b<10; b++) { + } + } + + } + } + + + + return 0; } \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/test/weaver/cpp/src/pragma_attribute.cpp b/ClavaWeaver/resources/clava/test/weaver/cpp/src/pragma_attribute.cpp deleted file mode 100644 index cdc9c131af..0000000000 --- a/ClavaWeaver/resources/clava/test/weaver/cpp/src/pragma_attribute.cpp +++ /dev/null @@ -1,14 +0,0 @@ -int foo(int a); -int foo2(int a); - -int main() { - - int acc = 0; - - _Pragma("clava attribute init(int i=(10)) isParallel") - for(int i=0; i<10; i++) { - #pragma clava attribute select(call) name(foo2) - #pragma clava attribute select(call.arg) - acc += foo(20); - } -} diff --git a/ClavaWeaver/resources/clava/test/weaver/cuda/results/Cuda.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cuda/results/Cuda.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cuda/results/Cuda.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cuda/results/Cuda.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaMatrixMul.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaMatrixMul.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaMatrixMul.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaMatrixMul.js.txt diff --git a/ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaQuery.lara.txt b/ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaQuery.js.txt similarity index 100% rename from ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaQuery.lara.txt rename to ClavaWeaver/resources/clava/test/weaver/cuda/results/CudaQuery.js.txt diff --git a/ClavaWeaver/resources/clava/weaverspecs/actionModel.xml b/ClavaWeaver/resources/clava/weaverspecs/actionModel.xml index 2008f9cc7d..2a555fea90 100644 --- a/ClavaWeaver/resources/clava/weaverspecs/actionModel.xml +++ b/ClavaWeaver/resources/clava/weaverspecs/actionModel.xml @@ -1,7 +1,4 @@ - diff --git a/ClavaWeaver/resources/clava/weaverspecs/artifacts.xml b/ClavaWeaver/resources/clava/weaverspecs/artifacts.xml index d50b0cdd24..538427b3ea 100644 --- a/ClavaWeaver/resources/clava/weaverspecs/artifacts.xml +++ b/ClavaWeaver/resources/clava/weaverspecs/artifacts.xml @@ -1,7 +1,4 @@ - @@ -61,9 +58,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -126,9 +121,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ tooltip="Returns the node that declares the scope of this node"/> - - + tooltip="JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds."/> - - + tooltip="Returns the first child of this node, or undefined if it has no child"/> - - + tooltip="Returns the last child of this node, or undefined if it has no child"/> @@ -168,11 +157,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - + tooltip="Returns comments that are not explicitly in the AST, but embedded in other nodes"/> @@ -225,15 +210,11 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ tooltip="a Java file to the file that originated this translation unit"/> - - - - + tooltip="the path to the folder of the source file relative to the base source path"/> @@ -258,20 +239,13 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - - @@ -322,16 +289,10 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + - - - - - - + + @@ -359,23 +320,16 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - + - - - + - - + tooltip="The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;')"/> - - - - - - + + @@ -399,9 +349,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - + tooltip="true if the scope does not have curly braces"/> - - - - - + - - - - - + @@ -499,9 +435,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ tooltip="The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit"/> - - + tooltip="Storage class specifier, which can be none, extern, static, __private_extern__, auto, register"/> - - - + @@ -534,19 +466,11 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - + tooltip="the type of the call, which includes the return type and the types of the parameters"/> - - - + - - - - + @@ -585,9 +502,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -598,30 +513,20 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + - - - - - - + + - - - + - - - + @@ -670,7 +575,6 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - @@ -694,9 +598,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -714,7 +616,6 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - - - - + + @@ -746,15 +643,9 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - - - - - - + + + @@ -796,9 +687,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - + tooltip="true if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar)"/> @@ -807,9 +696,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -835,9 +722,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -858,18 +743,12 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ tooltip="True if this is a type declared with the 'auto' keyword"/> - - - - - + - - + tooltip="Single-step desugar. Returns the type itself if it does not have sugar"/> @@ -885,9 +764,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -895,16 +772,12 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + - - - + @@ -930,9 +803,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -957,9 +828,7 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + @@ -991,13 +860,9 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - + tooltip="An integer expression, or undefined if no 'num_threads' clause is defined"/> - - + tooltip="One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined"/> - @@ -1058,13 +922,5 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - \ No newline at end of file diff --git a/ClavaWeaver/resources/clava/weaverspecs/joinPointModel.xml b/ClavaWeaver/resources/clava/weaverspecs/joinPointModel.xml index b7009bd5ed..0d53c11350 100644 --- a/ClavaWeaver/resources/clava/weaverspecs/joinPointModel.xml +++ b/ClavaWeaver/resources/clava/weaverspecs/joinPointModel.xml @@ -1,16 +1,6 @@ - - - @@ -21,76 +11,41 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - - - - - - - + - + tooltip="Represents an include directive (e.g., #include <stdio.h>)"/> - - - + - - - + tooltip="Special pragma that can be used to mark scopes (e.g., #pragma lara marker loop1)"/> - + tooltip="A pragma that references a point in the code and sticks to it"/> - - + tooltip="Represents an OpenMP pragma (e.g., #pragma omp parallel)"/> - - - + - - + - - + - - + - - + - - - - - - - - - + - - - + - - - - - - - - - - - - - - - + - - + - - - - - + - - - - + - - + - - - - + @@ -347,7 +199,6 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - @@ -363,18 +214,15 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - @@ -384,98 +232,56 @@ https://docs.google.com/document/d/1uPrvuVBXHSbjDTfehpEeLDz9hgIr8EuJJJvBc5A70rs/ - - - + - - + - - + - - + - - + - - + - - - + - - - + - - + - - + - - + - - + - - + - - + - + tooltip="Represents a type that was referred to using an elaborated type keyword, e.g., struct S, or via a qualified name, e.g., N::M::type, or both. This type is used to keep track of a type name as written in the source code, including tag keywords and any nested-name-specifiers. The type itself is always 'sugar', used to express what was written in the source code but containing no additional semantic information."/> - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/ClavaWeaver/run/ClavaUnit.launch b/ClavaWeaver/run/ClavaUnit.launch deleted file mode 100644 index 8889a0fe7f..0000000000 --- a/ClavaWeaver/run/ClavaUnit.launch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ClavaWeaver/run/ClavaWeaver Generator.launch b/ClavaWeaver/run/ClavaWeaver Generator.launch deleted file mode 100644 index 7d5c812546..0000000000 --- a/ClavaWeaver/run/ClavaWeaver Generator.launch +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/run/ClavaWeaver-deploy.launch b/ClavaWeaver/run/ClavaWeaver-deploy.launch deleted file mode 100644 index 89b1bd9759..0000000000 --- a/ClavaWeaver/run/ClavaWeaver-deploy.launch +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/run/ClavaWeaver.deploy b/ClavaWeaver/run/ClavaWeaver.deploy deleted file mode 100644 index 27127d9d19..0000000000 --- a/ClavaWeaver/run/ClavaWeaver.deploy +++ /dev/null @@ -1,89 +0,0 @@ - - - - NameOfOutputJar - - Clava.jar - string - - - - ClassWithMain - - pt.up.fe.specs.clava.weaver.ClavaWeaverLauncher - string - - - - Tasks - - - - - - - OutputJarFilename - - - string - - - - DestinationFolder - - ./ - string - - - - Copy Task - - - - - Copy Task - - - - - setupList - - - - ProjectName - - ClavaWeaver - string - - - - OutputJarType - - SubfolderZip - multipleChoice - - - - DevelopersXml - - - string - - - - PomInfoFile - - - string - - - - WorkspaceFolder - - - string - - - - EclipseDeployment - \ No newline at end of file diff --git a/ClavaWeaver/run/ClavaWeaver.launch b/ClavaWeaver/run/ClavaWeaver.launch deleted file mode 100644 index 405f36432c..0000000000 --- a/ClavaWeaver/run/ClavaWeaver.launch +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/run/ClavaWeaverDoc.launch b/ClavaWeaver/run/ClavaWeaverDoc.launch deleted file mode 100644 index e214615edf..0000000000 --- a/ClavaWeaver/run/ClavaWeaverDoc.launch +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/run/ClavaWeaverGUI.launch b/ClavaWeaver/run/ClavaWeaverGUI.launch deleted file mode 100644 index 636201664c..0000000000 --- a/ClavaWeaver/run/ClavaWeaverGUI.launch +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/ClavaWeaver/settings.gradle b/ClavaWeaver/settings.gradle index 535621e030..3c3e60e781 100644 --- a/ClavaWeaver/settings.gradle +++ b/ClavaWeaver/settings.gradle @@ -1,27 +1,18 @@ rootProject.name = 'ClavaWeaver' -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/GsonPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/JsEngine") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/XStreamPlus") -includeBuild("../../specs-java-libs/tdrcLibrary") +def specsJavaLibsRoot = System.getenv('SPECS_JAVA_LIBS_HOME') ?: '../../specs-java-libs' +def laraFrameworkRoot = System.getenv('LARA_FRAMEWORK_HOME') ?: '../../lara-framework' -includeBuild("../../lara-framework/LanguageSpecification") -includeBuild("../../lara-framework/LaraCommonLanguageApi") -includeBuild("../../lara-framework/LaraDoc") -includeBuild("../../lara-framework/LaraFramework") -includeBuild("../../lara-framework/LARAI") -includeBuild("../../lara-framework/LaraLoc") -includeBuild("../../lara-framework/LaraUnit") -includeBuild("../../lara-framework/LaraUtils") -includeBuild("../../lara-framework/WeaverGenerator") -includeBuild("../../lara-framework/WeaverInterface") +includeBuild("${specsJavaLibsRoot}/jOptions") +includeBuild("${specsJavaLibsRoot}/SpecsUtils") -includeBuild("../../clava/AntarexClavaApi") -includeBuild("../../clava/ClangAstParser") -includeBuild("../../clava/ClavaAst") -includeBuild("../../clava/ClavaHls") -includeBuild("../../clava/ClavaLaraApi") -includeBuild("../../clava/ClavaWeaverSpecs") +includeBuild("${laraFrameworkRoot}/LanguageSpecification") +includeBuild("${laraFrameworkRoot}/LARAI") +includeBuild("${laraFrameworkRoot}/LaraUtils") +includeBuild("${laraFrameworkRoot}/WeaverGenerator") +includeBuild("${laraFrameworkRoot}/WeaverInterface") + +includeBuild("../AntarexClavaApi") +includeBuild("../ClangAstParser") +includeBuild("../ClavaAst") +includeBuild("../ClavaLaraApi") diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaMetrics.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaMetrics.java deleted file mode 100644 index 492b06ec79..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaMetrics.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import java.util.Set; - -import org.lara.interpreter.profile.BasicWeaverProfiler; -import org.lara.interpreter.profile.ReportField; -import org.lara.interpreter.profile.ReportWriter; -import org.lara.interpreter.profile.WeavingReport; -import org.lara.interpreter.weaver.interf.events.Stage; -import org.lara.interpreter.weaver.interf.events.data.ActionEvent; - -import pt.up.fe.specs.util.SpecsCollections; - -public class ClavaMetrics extends BasicWeaverProfiler { - - private static final Set ADDITIONAL_INSERT_ACTIONS = SpecsCollections.newHashSet("insertBefore", - "insertAfter", "replaceWith", "insertBegin", "insertEnd"); - - @Override - public WeavingReport getReport() { - return super.getReport(); - } - - @Override - protected void buildReport(ReportWriter writer) { - // System.out.println("REPORT:" + writer); - } - - @Override - protected void onActionImpl(ActionEvent data) { - // Update insert actions, after the action - if (data.getStage().equals(Stage.END)) { - boolean isAdditionalInsert = ADDITIONAL_INSERT_ACTIONS.contains(data.getActionName()); - boolean isInsert = data.getActionName().equals("insert"); - - // TEMP: Only while native loc are not updated by the default profiler - if (isInsert) { - reportNativeLoc(data.getArguments().get(1), true); - } - - // Update stats for additional inserts - if (isAdditionalInsert) { - getReport().inc(ReportField.INSERTS); - reportNativeLoc(data.getArguments().get(0), true); - } - } - - } - - /* - private String currentClass; - private String currentMethod; - private String currentField; - - private AccumulatorMap actionsPerformed = new AccumulatorMap<>(); - - @Override - protected void onApplyImpl(ApplyIterationEvent data) { - if (data.getStage().equals(Stage.BEGIN)) { - for (JoinPoint jp : data.getPointcutChain()) { - if (jp instanceof AClass) { - currentClass = ((AClass) jp).getQualifiedNameImpl(); - continue; - } - if (jp instanceof AMethod) { - currentMethod = ((AMethod) jp).getNameImpl(); - continue; - } - if (jp instanceof AField) { - currentField = ((AMethod) jp).getNameImpl(); - continue; - } - } - } else { - currentClass = null; - currentMethod = null; - } - } - - @Override - protected void onActionImpl(ActionEvent data) { - - if (data.getStage().equals(Stage.END)) { - String name = ""; - if (currentClass != null) { - name = currentClass; - } - if (currentMethod != null) { - name += (currentClass != null ? "#" : "") + currentMethod; - } else if (currentField != null) { - name += (currentClass != null ? "#" : "") + currentField; - } - if (name.isEmpty()) { - return; // What to do? - } - actionsPerformed.add(name); - } - } - - @Override - protected void buildReport(ReportWriter writer) { - writer.report("ActionsPerTarget", actionsPerformed.getAccMap()); - } - */ - -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverData.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverData.java index 5410b5c2ad..1a5e4a764a 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverData.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverData.java @@ -13,7 +13,6 @@ package pt.up.fe.specs.clava.weaver; -import org.suikasoft.jOptions.Interfaces.DataStore; import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.extra.App; @@ -29,9 +28,6 @@ public class ClavaWeaverData { - // Options - private final DataStore data; - // Parsed program state // private final Deque apps; private final Deque>> userValuesStack; @@ -39,8 +35,7 @@ public class ClavaWeaverData { private Collection generatedFiles; private ClavaContext context; - public ClavaWeaverData(DataStore data) { - this.data = data; + public ClavaWeaverData() { // this.apps = new ArrayDeque<>(); this.userValuesStack = new ArrayDeque<>(); @@ -64,12 +59,6 @@ public Optional getAst() { // if (app == null) { if (context == null) { - // Verify if weaving is disabled - // if (data.get(CxxWeaverOption.DISABLE_WEAVING)) { - // SpecsLogs.msgInfo("'Disable weaving' option is set, cannot use AST-related code (e.g., 'select')"); - // return Optional.empty(); - // } - SpecsLogs.warn("No parsed tree available"); return Optional.empty(); } @@ -145,16 +134,11 @@ private Map> getUserValuesCopy(App app, App previ continue; } - // Serialize value - // Map valueCopy = XStreamUtils.copy(entry.getValue()); - // Add to map - // userValuesCopy.put(newNode, valueCopy); userValuesCopy.put(newNode, entry.getValue()); } return userValuesCopy; - // return userValuesStack.isEmpty() ? new HashMap<>() : XStreamUtils.copy(userValuesStack.peek()); } private ClavaNode getNewNode(App app, ClavaNode previousNode) { @@ -172,9 +156,8 @@ public App popAst() { // Not implemented yet private App popAst(int astIndex) { - SpecsCheck.checkNotNull(context, () -> "No App to pop"); + Objects.requireNonNull(context, () -> "No App to pop"); - // System.out.println("DATA:" + data); userValuesStack.pop(); App topApp = context.popApp(); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverLauncher.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverLauncher.java deleted file mode 100644 index 0deb786e1c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/ClavaWeaverLauncher.java +++ /dev/null @@ -1,295 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.junit.runner.Result; - -import eu.antarex.clang.parser.tests.CBenchTest; -import eu.antarex.clang.parser.tests.CxxBenchTest; -import larai.LaraI; -import pt.up.fe.specs.clava.ClavaLog; -import pt.up.fe.specs.cxxweaver.tests.CApiTest; -import pt.up.fe.specs.cxxweaver.tests.CTest; -import pt.up.fe.specs.cxxweaver.tests.CxxApiTest; -import pt.up.fe.specs.cxxweaver.tests.CxxTest; -import pt.up.fe.specs.lara.WeaverLauncher; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsSystem; - -public class ClavaWeaverLauncher { - - public static void main(String[] args) { - SpecsSystem.programStandardInit(); - - // System.out.println("Press any key to proceed"); - // SpecsIo.read(); - - boolean success = execute(args); - - // Only exit if GUI is not running, or if not in server mode - if (!LaraI.isRunningGui() && !LaraI.isServerMode()) { - int exitValue = success ? 0 : 1; - ClavaLog.debug("Calling System.exit() on ClavaWeaverLauncher, no running GUI detected"); - System.exit(exitValue); - } - - } - - public static boolean execute(String[] args) { - // To profile using VisualVM - // try { - // System.out.println("PRESS ENTER"); - // System.in.read(); - // } catch (IOException e) { - // LoggingUtils.msgWarn("Error message:\n", e); - // } - - // If junit file present, run junit - if (new File("junit").isFile()) { - ClavaLog.info("Found file 'junit', running unit tets"); - Result result = org.junit.runner.JUnitCore.runClasses(CApiTest.class, CTest.class, CxxApiTest.class, - CxxTest.class); - System.out.println("RESULT:\n" + result); - return result.getFailures().isEmpty(); - } - - if (new File("junit-parser").isFile()) { - ClavaLog.info("Found file 'junit-parser', running parser unit tets"); - Result result = org.junit.runner.JUnitCore.runClasses(CBenchTest.class, - eu.antarex.clang.parser.tests.CTest.class, CxxBenchTest.class, - eu.antarex.clang.parser.tests.CxxTest.class); - System.out.println("RESULT:\n" + result); - return result.getFailures().isEmpty(); - } - - return new WeaverLauncher(new CxxWeaver()).launch(args); - - // // If unit testing flag is present, run unit tester - // Optional unitTesterResult = runUnitTester(args); - // if (unitTesterResult.isPresent()) { - // return unitTesterResult.get(); - // } - // - // // If doc generator flag is present, run doc generator - // Optional docGeneratorResult = runDocGenerator(args); - // if (docGeneratorResult.isPresent()) { - // return docGeneratorResult.get(); - // } - // - // return LaraLauncher.launch(args, new CxxWeaver()); - // // return LaraI.exec(args, new CxxWeaver()); - } - - public static boolean execute(List args) { - return execute(args.toArray(new String[0])); - } - - // private static Optional runUnitTester(String[] args) { - // // Look for flag - // String unitTestingFlag = "-" + LaraiKeys.getUnitTestFlag(); - // - // int flagIndex = IntStream.range(0, args.length) - // .filter(index -> unitTestingFlag.equals(args[index])) - // .findFirst() - // .orElse(-1); - // - // if (flagIndex == -1) { - // return Optional.empty(); - // } - // - // List laraUnitArgs = new ArrayList<>(); - // // laraUnitArgs.add("lara-unit-weaver=" + CxxWeaver.class.getName()); - // laraUnitArgs.add("--weaver"); - // laraUnitArgs.add(CxxWeaver.class.getName()); - // - // // laraUnitArgs.add("lara-unit-weaver=" + CxxWeaver.class.getName()); - // for (int i = flagIndex + 1; i < args.length; i++) { - // laraUnitArgs.add(args[i]); - // } - // - // SpecsLogs.debug("Launching lara-unit with flags '" + laraUnitArgs + "'"); - // - // int unitResults = LaraUnitLauncher.execute(laraUnitArgs.toArray(new String[0])); - // - // return Optional.of(unitResults == 0); - // } - // - // private static Optional runDocGenerator(String[] args) { - // // Look for flag - // String docGeneratorFlag = "-" + LaraiKeys.getDocGeneratorFlag(); - // - // int flagIndex = IntStream.range(0, args.length) - // .filter(index -> docGeneratorFlag.equals(args[index])) - // .findFirst() - // .orElse(-1); - // - // if (flagIndex == -1) { - // return Optional.empty(); - // } - // - // List laraDocArgs = new ArrayList<>(); - // laraDocArgs.add("--weaver"); - // laraDocArgs.add(CxxWeaver.class.getName()); - // - // for (int i = flagIndex + 1; i < args.length; i++) { - // laraDocArgs.add(args[i]); - // } - // - // SpecsLogs.debug("Launching lara-doc with flags '" + laraDocArgs + "'"); - // - // int docResults = LaraDocLauncher.execute(laraDocArgs.toArray(new String[0])); - // - // return Optional.of(docResults != -1); - // } - - public static String[] executeParallel(String[][] args, int threads, List clavaCommand) { - return executeParallel(args, threads, clavaCommand, SpecsIo.getWorkingDir().getAbsolutePath()); - } - - /** - * - * @param args - * @param threads - * @param clavaCommand - * @param workingDir - * @return an array with the same size as the number if args, with strings representing JSON objects that represent - * the outputs of the execution. The order of the results is the same as the args - */ - public static String[] executeParallel(String[][] args, int threads, List clavaCommand, String workingDir) { - - var workingFolder = SpecsIo.sanitizeWorkingDir(workingDir); - - var customThreadPool = threads > 0 ? new ForkJoinPool(threads) : new ForkJoinPool(); - - // Choose executor - Function clavaExecutor = clavaCommand.isEmpty() ? ClavaWeaverLauncher::executeSafe - : weaverArgs -> ClavaWeaverLauncher.executeOtherJvm(weaverArgs, clavaCommand, workingFolder); - - ClavaLog.info( - () -> "Launching " + args.length + " instances of Clava in parallel, using a parallelism level of " - + threads); - - if (!clavaCommand.isEmpty()) { - ClavaLog.info( - () -> "Each Clava instance will run on a separate process, using the command " + clavaCommand); - } - - // Create paths for the results - List resultFiles = new ArrayList<>(); - var resultsFolder = SpecsIo.getTempFolder("clava_parallel_results_" + UUID.randomUUID()); - ClavaLog.debug(() -> "Create temporary folder for storing results of Clava parallel execution: " - + resultsFolder.getAbsolutePath()); - - for (int i = 0; i < args.length; i++) { - resultFiles.add(new File(resultsFolder, "clava_parallel_result_" + i + ".json")); - } - - try { - - // Adapt the args so that each execution produces a result file - String[][] adaptedArgs = new String[args.length][]; - for (int i = 0; i < args.length; i++) { - var newArgs = Arrays.copyOf(args[i], args[i].length + 2); - newArgs[newArgs.length - 2] = "-r"; - newArgs[newArgs.length - 1] = resultFiles.get(i).getAbsolutePath(); - adaptedArgs[i] = newArgs; - } - - // var results = - customThreadPool.submit(() -> Arrays.asList(adaptedArgs).parallelStream() - .map(clavaExecutor) - .collect(Collectors.toList())).get(); - - // Find the file for each execution - return collectResults(resultFiles); - - // return results.stream() - // .filter(result -> result == false) - // .findFirst() - // .orElse(true); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return collectResults(resultFiles); - } catch (ExecutionException e) { - ClavaLog.info("Unrecoverable exception while executing parallel instances of Clava: " + e); - return collectResults(resultFiles); - } finally { - SpecsIo.deleteFolder(resultsFolder); - } - - } - - private static String[] collectResults(List resultFiles) { - List results = new ArrayList<>(); - for (var resultFile : resultFiles) { - // If file does not exist, create empty object - if (!resultFile.isFile()) { - results.add("{}"); - continue; - } - - results.add(SpecsIo.read(resultFile)); - } - - return results.toArray(size -> new String[size]); - } - - private static boolean executeSafe(String[] args) { - try { - return execute(args); - } catch (Exception e) { - ClavaLog.info("Exception during Clava execution: " + e); - return false; - } - } - - private static boolean executeOtherJvm(String[] args, List clavaCommand, File workingDir) { - try { - // DEBUG - // if (true) { - // return ClavaWeaverLauncher.execute(args); - // } - - List newArgs = new ArrayList<>(); - // newArgs.add("java"); - // newArgs.add("-jar"); - // newArgs.add("Clava.jar"); - // newArgs.add("/usr/local/bin/clava"); - newArgs.addAll(clavaCommand); - newArgs.addAll(Arrays.asList(args)); - - // ClavaLog.info(() -> "Launching Clava on another JVM with command: " + newArgs); - - // var result = SpecsSystem.run(newArgs, SpecsIo.getWorkingDir()); - var result = SpecsSystem.run(newArgs, workingDir); - - return result == 0; - - // return execute(args); - } catch (Exception e) { - ClavaLog.info("Exception during Clava execution: " + e); - return false; - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxSelects.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxSelects.java index 5bd4e38dd4..36e310f498 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxSelects.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxSelects.java @@ -19,8 +19,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.lara.interpreter.profile.ReportField; -import org.lara.interpreter.profile.WeavingReport; import org.lara.interpreter.weaver.interf.WeaverEngine; import pt.up.fe.specs.clava.ClavaNode; @@ -127,44 +125,6 @@ public static AJoinPoint[] selectedNodesToJps(Stream select .collect(Collectors.toList()) // .toArray(new AJoinPoint[0]); .toArray(AJoinPoint[]::new); - /* - Incrementer excludedJoinpoints = new Incrementer(); - - AJoinPoint[] selectedJps = selectedNodes - // Ignore null nodes - .filter(sibling -> !(sibling instanceof NullNode)) - .map(CxxJoinpoints::create) - // Filter null nodes - .filter(jp -> jp != null) - // Default filter - .filter(CxxSelects::defaultSelectFilter) - .filter(jp -> { - - boolean accepted = filter.test(jp); - - if (!accepted) { - excludedJoinpoints.increment(); - } - return accepted; - }) - // Null nodes should have been filtered by previous filter - // .filter(jp -> jp != null) - // Filter null nodes - // .filter(jp -> jp != null) - .collect(Collectors.toList()) - // .toArray(new AJoinPoint[0]); - .toArray(AJoinPoint[]::new); - - // Count as selected nodes - var report = weaverEngine.getWeaverProfiler().getReport(); - report.inc(ReportField.JOIN_POINTS, selectedJps.length + excludedJoinpoints.getCurrent()); - report.inc(ReportField.FILTERED_JOIN_POINTS, selectedJps.length); - - // Count as a select - report.inc(ReportField.SELECTS); - - return selectedJps; - */ } public static Stream selectedNodesToJpsStream(Stream selectedNodes, @@ -176,8 +136,6 @@ public static Stream selectedNodesToJpsStream(Stream selectedNodesToJpsStream(Stream selectedNodes, Predicate filter, WeaverEngine weaverEngine) { - var report = weaverEngine.getWeaverProfiler().getReport(); - var selectedJps = selectedNodes // Ignore null nodes .filter(sibling -> !(sibling instanceof NullNode)) @@ -186,23 +144,13 @@ public static Stream selectedNodesToJpsStream(Stream jp != null) // Default filter .filter(CxxSelects::defaultSelectFilter) - .filter(jp -> { - reportJp(jp, report, ReportField.JOIN_POINTS); - return filter.test(jp); - }) - .map(jp -> reportJp(jp, report, ReportField.FILTERED_JOIN_POINTS)); - - // Count as a select - report.inc(ReportField.SELECTS); + .filter(jp -> filter.test(jp)) + // Cast back to AJoinPoint + .map(jp -> (AJoinPoint) jp); return selectedJps; } - private static AJoinPoint reportJp(AJoinPoint jp, WeavingReport report, ReportField type) { - report.inc(type, 1); - return jp; - } - private static boolean defaultSelectFilter(AJoinPoint jp) { // TODO: If more cases, use a ClassMap instead @@ -213,32 +161,4 @@ private static boolean defaultSelectFilter(AJoinPoint jp) { return true; } - - /* - Incrementer nullJoinpoints = new Incrementer(); - Incrementer excludedJoinpoints = new Incrementer(); - AJoinPoint[] descendants = getNode().getDescendantsStream() - .map(descendant -> CxxJoinpoints.create(descendant)) - .filter(jp -> { - // Count null join points separately - if (jp == null) { - nullJoinpoints.increment(); - return false; - } - - boolean accepted = jp.instanceOf(type); - if (!accepted) { - excludedJoinpoints.increment(); - } - return accepted; - }) - // .filter(jp -> jp.getJoinpointType().equals(type)) - .toArray(AJoinPoint[]::new); - - // Count as selected nodes - getWeaverEngine().getWeavingReport().inc(ReportField.JOIN_POINTS, - descendants.length + excludedJoinpoints.getCurrent()); - getWeaverEngine().getWeavingReport().inc(ReportField.FILTERED_JOIN_POINTS, descendants.length); - */ - } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.dotty b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.dotty deleted file mode 100644 index 5b4735fdac..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.dotty +++ /dev/null @@ -1,95 +0,0 @@ -digraph CxxWeaver_join_point_hierarchy_join_point_hierarchy { -node [color=lightblue2, style=filled]; -rankdir="RL" -node [fontsize=10, shape=box, height=0.25] -edge [fontsize=10] -"accessSpecifier"->"decl" -"adjustedType"->"type" -"arrayAccess"->"expression" -"arrayType"->"type" -"asmStmt"->"statement" -"attribute"->"joinpoint" -"binaryOp"->"op" -"body"->"scope" -"boolLiteral"->"literal" -"break"->"statement" -"builtinType"->"type" -"call"->"expression" -"case"->"switchCase" -"cast"->"expression" -"cilkFor"->"loop" -"cilkSpawn"->"call" -"cilkSync"->"statement" -"class"->"record" -"clavaException"->"joinpoint" -"comment"->"joinpoint" -"continue"->"statement" -"cudaKernelCall"->"call" -"decl"->"joinpoint" -"declStmt"->"statement" -"declarator"->"namedDecl" -"default"->"switchCase" -"deleteExpr"->"expression" -"elaboratedType"->"type" -"empty"->"joinpoint" -"emptyStmt"->"statement" -"enumDecl"->"namedDecl" -"enumType"->"tagType" -"enumeratorDecl"->"namedDecl" -"exprStmt"->"statement" -"expression"->"joinpoint" -"field"->"declarator" -"file"->"joinpoint" -"floatLiteral"->"literal" -"function"->"declarator" -"functionType"->"type" -"gotoStmt"->"statement" -"if"->"statement" -"implicitValue"->"expression" -"include"->"decl" -"incompleteArrayType"->"arrayType" -"initList"->"expression" -"intLiteral"->"literal" -"labelDecl"->"namedDecl" -"labelStmt"->"statement" -"literal"->"expression" -"loop"->"statement" -"marker"->"pragma" -"memberAccess"->"expression" -"memberCall"->"call" -"method"->"function" -"namedDecl"->"decl" -"newExpr"->"expression" -"omp"->"pragma" -"op"->"expression" -"param"->"vardecl" -"parenExpr"->"expression" -"parenType"->"type" -"pointerType"->"type" -"pragma"->"joinpoint" -"program"->"joinpoint" -"qualType"->"type" -"record"->"namedDecl" -"returnStmt"->"statement" -"scope"->"statement" -"statement"->"joinpoint" -"struct"->"record" -"switch"->"statement" -"switchCase"->"statement" -"tag"->"pragma" -"tagType"->"type" -"templateSpecializationType"->"type" -"ternaryOp"->"op" -"this"->"expression" -"type"->"joinpoint" -"typedefDecl"->"typedefNameDecl" -"typedefNameDecl"->"namedDecl" -"typedefType"->"type" -"unaryExprOrType"->"expression" -"unaryOp"->"op" -"undefinedType"->"type" -"vardecl"->"declarator" -"variableArrayType"->"arrayType" -"varref"->"expression" -"wrapperStmt"->"statement" -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.java index 4197616a27..f0a9897229 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.java @@ -1,19 +1,15 @@ package pt.up.fe.specs.clava.weaver; import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.profile.WeavingReport; import org.lara.interpreter.weaver.ast.AstMethods; import org.lara.interpreter.weaver.interf.AGear; import org.lara.interpreter.weaver.interf.JoinPoint; import org.lara.interpreter.weaver.interf.events.Stage; import org.lara.interpreter.weaver.options.WeaverOption; -import org.lara.interpreter.weaver.utils.LaraResourceProvider; import org.lara.language.specification.dsl.LanguageSpecification; import org.suikasoft.jOptions.Interfaces.DataStore; import org.suikasoft.jOptions.storedefinition.StoreDefinition; import org.suikasoft.jOptions.storedefinition.StoreDefinitionBuilder; -import pt.up.fe.specs.antarex.clava.AntarexClavaLaraApis; -import pt.up.fe.specs.antarex.clava.JsAntarexApiResource; import pt.up.fe.specs.clang.ClangAstKeys; import pt.up.fe.specs.clang.SupportedPlatform; import pt.up.fe.specs.clang.codeparser.CodeParser; @@ -33,18 +29,14 @@ import pt.up.fe.specs.clava.utils.SourceType; import pt.up.fe.specs.clava.weaver.abstracts.weaver.ACxxWeaver; import pt.up.fe.specs.clava.weaver.gears.CacheHandlerGear; -import pt.up.fe.specs.clava.weaver.gears.InsideApplyGear; import pt.up.fe.specs.clava.weaver.gears.ModifiedFilesGear; import pt.up.fe.specs.clava.weaver.joinpoints.CxxProgram; import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; import pt.up.fe.specs.clava.weaver.options.CxxWeaverOptions; import pt.up.fe.specs.clava.weaver.utils.ClavaAstMethods; -import pt.up.fe.specs.lara.lcl.LaraCommonLanguageApis; -import pt.up.fe.specs.lara.unit.LaraUnitLauncher; import pt.up.fe.specs.util.*; import pt.up.fe.specs.util.collections.AccumulatorMap; import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.providers.ResourceProvider; import pt.up.fe.specs.util.utilities.Buffer; import pt.up.fe.specs.util.utilities.LineStream; import pt.up.fe.specs.util.utilities.StringLines; @@ -57,22 +49,19 @@ /** * Weaver Implementation for CxxWeaver
- * Since the generated abstract classes are always overwritten, their implementation should be done by extending those + * Since the generated abstract classes are always overwritten, their + * implementation should be done by extending those * abstract classes with user-defined classes.
- * The abstract class {@link pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint} can be used to add user-defined - * methods and fields which the user intends to add for all join points and are not intended to be used in LARA aspects. + * The abstract class + * {@link pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint} can be used + * to add user-defined + * methods and fields which the user intends to add for all join points and are + * not intended to be used in LARA aspects. * * @author Lara Weaver Generator */ public class CxxWeaver extends ACxxWeaver { - static { - // DevUtils.addDevProject( - // new File("C:\\Users\\JoaoBispo\\Desktop\\shared\\specs-lara\\2017 COMLAN\\RangeValueMonitor\\lara"), - // "COMLAN", - // true, true); - } - public static LanguageSpecification buildLanguageSpecification() { return LanguageSpecification.newInstance(ClavaWeaverResource.JOINPOINTS, ClavaWeaverResource.ARTIFACTS, ClavaWeaverResource.ACTIONS); @@ -96,7 +85,6 @@ public static LanguageSpecification buildLanguageSpecification() { "Benchmark - Rosetta (import lara.benchmark.RosettaBenchmarkSet)", "https://github.com/specs-feup/clava-benchmarks.git?folder=Rosetta"); - private static final String TEMP_WEAVING_FOLDER = "__clava_woven"; private static final String TEMP_SRC_FOLDER = "__clava_src"; private static final String WOVEN_CODE_FOLDERNAME = "woven_code"; @@ -139,16 +127,6 @@ public static List getDefaultFlags() { return DEFAULT_DUMPER_FLAGS; } - private static final String CLAVA_API_NAME = "@specs-feup/clava"; - - private static final List CLAVA_LARA_API = new ArrayList<>(); - - static { - CLAVA_LARA_API.addAll(LaraCommonLanguageApis.getApis()); - CLAVA_LARA_API.addAll(ClavaLaraApis.getApis()); - CLAVA_LARA_API.addAll(AntarexClavaLaraApis.getApis()); - } - /** * All definitions, including default LaraI keys and Clava-specific keys. */ @@ -168,23 +146,14 @@ public static StoreDefinition getWeaverDefinition() { return WEAVER_DEFINITION.get(); } - // Weaver configuration - private DataStore args = null; - // Parsing Context private ClavaContext context = null; // Gears private ModifiedFilesGear modifiedFilesGear = null; - private InsideApplyGear insideApplyGear = null; private CacheHandlerGear cacheHandlerGear = null; // Parsed program state - // private Deque apps; - // private Deque>> userValuesStack; - - // private File outputDir = null; - // private List originalSources = null; private List currentSources = null; private Map currentBases = null; private Map sourceFoldernames = null; @@ -192,13 +161,6 @@ public static StoreDefinition getWeaverDefinition() { private List originalSourceFolders = null; private List userFlags = null; - // private CxxJoinpoints jpFactory = null; - - // private File baseFolder = null; - // private List parserOptions = new ArrayList<>(); - - // private Logger infoLogger = null; - // private Level previousLevel = null; private Set messagesToUser; @@ -206,68 +168,24 @@ public static StoreDefinition getWeaverDefinition() { private ClavaWeaverData weaverData; - private ClavaMetrics metrics; - public CxxWeaver() { - // addApis(CLAVA_API_NAME, CLAVA_LARA_API); reset(); - // // Gears - // this.modifiedFilesGear = new ModifiedFilesGear(); - // this.insideApplyGear = new InsideApplyGear(); - // - // context = new ClavaContext(); - // - // // Weaver configuration - // args = null; - // - // // outputDir = null; - // currentSources = new ArrayList<>(); - // userFlags = null; - // - // // baseFolder = null; - // // parserOptions = new ArrayList<>(); - // - // // infoLogger = null; - // // previousLevel = null; - // - // // Set, in order to filter repeated messages - // // Linked, to preserve order - // messagesToUser = null; - // - // accMap = null; - // - // weaverData = null; - // - // metrics = new ClavaMetrics(); - // this.setWeaverProfiler(metrics); - } - - @Override - public String getWeaverApiName() { - return CLAVA_API_NAME; } private void reset() { // Gears this.modifiedFilesGear = new ModifiedFilesGear(); - this.insideApplyGear = new InsideApplyGear(); this.cacheHandlerGear = new CacheHandlerGear(); - context = new ClavaContext(); - // Weaver configuration - args = null; - - // outputDir = null; + context = new ClavaContext(); currentSources = new ArrayList<>(); + currentBases = null; + sourceFoldernames = null; + currentSourceFolders = null; + originalSourceFolders = null; userFlags = null; - // baseFolder = null; - // parserOptions = new ArrayList<>(); - - // infoLogger = null; - // previousLevel = null; - // Set, in order to filter repeated messages // Linked, to preserve order messagesToUser = null; @@ -275,15 +193,6 @@ private void reset() { accMap = null; weaverData = null; - - metrics = new ClavaMetrics(); - this.setWeaverProfiler(metrics); - - currentSources = new ArrayList<>(); - } - - public WeavingReport getWeavingReport() { - return metrics.getReport(); } public ClavaWeaverData getWeaverData() { @@ -291,10 +200,6 @@ public ClavaWeaverData getWeaverData() { } public App getApp() { - // if (args.get(CxxWeaverOption.DISABLE_WEAVING)) { - // throw new RuntimeException("Tried to access top-level node, but weaving is disabled"); - // } - return getAppTry() .orElseThrow(() -> new RuntimeException( "No App available, check if the code has compilation errors")); @@ -309,17 +214,12 @@ public Optional getAppTry() { return weaverData.getAst(); } - // public File getBaseSourceFolder() { - // return baseFolder; - // } - public CxxProgram getAppJp() { return CxxJoinpoints.programFactory(getApp()); } private Map> getUserValues() { return weaverData.getUserValues(); - // return userValuesStack.peek(); } public boolean addMessageToUser(String message) { @@ -327,18 +227,8 @@ public boolean addMessageToUser(String message) { } /** - * Warns the lara interpreter if the weaver accepts a folder as the application or only one file at a time. - * - * @return true if the weaver is able to work with several files, false if only works with one file - */ - @Override - public boolean handlesApplicationFolder() { - // Can the weaver handle an application folder? - return true; - } - - /** - * Set a file/folder in the weaver if it is valid file/folder type for the weaver. + * Set a file/folder in the weaver if it is valid file/folder type for the + * weaver. * * @param source the file with the source code * @param outputDir output directory for the generated file(s) @@ -346,79 +236,40 @@ public boolean handlesApplicationFolder() { * @return true if the file type is valid */ @Override - public boolean begin(List sources, File outputDir, DataStore args) { - // reset(); - - // Set args - this.args = args; - - // TODO: Temporarily disabled - // ClavaLog.debug(() -> "Clava Weaver arguments: " + args); - - // Add normal include folders to the sources - // sources.addAll(args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles()); - - weaverData = new ClavaWeaverData(args); - - accMap = new AccumulatorMap<>(); - - // Logger.getLogger(LoggingUtils.INFO_TAG).setLevel(Level.WARNING); - // - // Logger.getLogger(LoggingUtils.INFO_TAG).setUseParentHandlers(false); + protected boolean begin(List sources, File outputDir, DataStore args) { + setData(args); + this.weaverData = new ClavaWeaverData(); + this.accMap = new AccumulatorMap<>(); + this.messagesToUser = new LinkedHashSet<>(); - if (args.get(CxxWeaverOption.DISABLE_CLAVA_INFO)) { - // System.out.println("DISABLING CLAVA INFO FOR LOGGER " + SpecsLogs.getSpecsLogger()); - // Needs to keep a strong reference, or it can be garbage collected - /* - infoLogger = Logger.getLogger(SpecsLogs.INFO_TAG); - previousLevel = infoLogger.getLevel(); - infoLogger.setLevel(Level.WARNING); - */ + if (this.dataStore.get(CxxWeaverOption.DISABLE_CLAVA_INFO)) { SpecsLogs.getSpecsLogger().setLevelAll(Level.WARNING); ClavaLog.getLogger().setLevelAll(Level.WARNING); } - // boolean disableWeaving = args.get(CxxWeaverOption.DISABLE_WEAVING); - - // Set weaver in CxxFactory, so that it can have access to a weaver configuration - // This setting is local to the thread - - // Weaver arguments - // this.originalSources = sources; - // this.currentSources = buildSources(sources, args.get(LaraiKeys.WORKSPACE_EXTRA)); - // Create map with all sources, mapped to the corresponding base folder Map allSources = new HashMap<>(); for (var source : sources) { if (!source.exists()) { ClavaLog.info("Source path '" + source + "' does not exist, ignoring"); - continue; - } - - if (source.isFile()) { + } else if (source.isFile()) { allSources.put(source, null); - continue; - } - - if (source.isDirectory()) { - var sourceMapping = args.get(CxxWeaverOption.FLAT_OUTPUT_FOLDER) ? null : source; - allSources.put(source, sourceMapping); - // allSources.put(source, source); - continue; + } else if (source.isDirectory()) { + allSources.put(source, + this.dataStore.get(CxxWeaverOption.FLAT_OUTPUT_FOLDER) ? null : source); + } else { + throw new RuntimeException("Case not implemented: " + source); } - - throw new RuntimeException("Case not implemented: " + source); } - allSources.putAll(args.get(LaraiKeys.WORKSPACE_EXTRA)); updateSources(allSources); // Store original source folders // This means the current bases + folders of the sources Set originalSourceFoldersSet = new LinkedHashSet<>(); - currentBases.values().stream() - .filter(base -> base != null) + this.currentBases.values().stream() + .filter(Objects::nonNull) .map(CxxWeaver::parseIncludePath) .forEach(originalSourceFoldersSet::add); @@ -426,46 +277,32 @@ public boolean begin(List sources, File outputDir, DataStore args) { .map(CxxWeaver::parseIncludePath) .forEach(originalSourceFoldersSet::add); - originalSourceFolders = new ArrayList<>(originalSourceFoldersSet); - // System.out.println("ORIGINAL SOURCES: " + originalSourceFolders); - // updateSources(sources, args.get(LaraiKeys.WORKSPACE_EXTRA)); - - // this.outputDir = outputDir; + this.originalSourceFolders = new ArrayList<>(originalSourceFoldersSet); // If args does not have a standard, add a standard one based on the input files - if (!this.args.hasValue(ClavaOptions.STANDARD)) { - this.args.add(ClavaOptions.STANDARD, getStandard()); + if (!this.dataStore.hasValue(ClavaOptions.STANDARD)) { + this.dataStore.add(ClavaOptions.STANDARD, getStandard()); } - var parserOptions = buildParserOptions(args); - - // Initialize weaver with the input file/folder - - // First folder is considered the base folder - // Only needs folder if we are doing weaving - // if (!disableWeaving) { - // baseFolder = getFirstSourceFolder(sources); - // } + var parserOptions = buildParserOptions(dataStore); - // Init messages to user - messagesToUser = new LinkedHashSet<>(); + App app = null; // If weaving disabled, create empty App - if (args.get(CxxWeaverOption.DISABLE_WEAVING)) { + if (this.dataStore.get(CxxWeaverOption.DISABLE_WEAVING)) { SpecsLogs.msgInfo("Initial parsing disabled, creating empty 'program'"); - App emptyApp = context.get(ClavaContext.FACTORY).app(Collections.emptyList()); + app = context.get(ClavaContext.FACTORY).app(Collections.emptyList()); // First app, add it to context - context.pushApp(emptyApp); - weaverData.pushAst(emptyApp); - return true; + this.context.pushApp(app); + } else { + app = createApp(getSources(), parserOptions); } - // weaverData.pushAst(createApp(sources, parserOptions)); - App app = createApp(getSources(), parserOptions); - weaverData.pushAst(app); - // TODO: Option to dump clang and clava + this.weaverData.pushAst(app); + if (SpecsSystem.isDebug()) { + // TODO: Option to dump clang and clava SpecsIo.write(new File("clavaDump.txt"), getApp().toString()); } @@ -475,9 +312,6 @@ public boolean begin(List sources, File outputDir, DataStore args) { private List buildParserOptions(DataStore args) { List parserOptions = new ArrayList<>(); - // Initialize list of options for parser - parserOptions = new ArrayList<>(); - // Add all source folders as include folders // Set sourceIncludeFolders = getIncludeFlags(sources); Set sourceIncludeFolders = getIncludeFlags(getSources()); @@ -516,9 +350,12 @@ private List buildParserOptions(DataStore args) { * *

* Creation of sources follow this rules:
- * 1) Single files listed in 'sources' are considered to not have a base folder (relative path is null)
- * 2) Source folders listed in 'sources' will have the parent folder as its base folder
- * 3) Source files or folders listed in 'map' will have the base folder indicated in the map + * 1) Single files listed in 'sources' are considered to not have a base folder + * (relative path is null)
+ * 2) Source folders listed in 'sources' will have the parent folder as its base + * folder
+ * 3) Source files or folders listed in 'map' will have the base folder + * indicated in the map */ private void updateSources(Map map) { // TODO: Convert all folders to files, folders become bases when in sources @@ -530,7 +367,8 @@ private void updateSources(Map map) { currentSources.addAll(map.keySet()); // String datastoreFolderpath = args.get(JOptionKeys.CURRENT_FOLDER_PATH); - // File datastoreFolder = datastoreFolderpath == null ? null : new File(datastoreFolderpath); + // File datastoreFolder = datastoreFolderpath == null ? null : new + // File(datastoreFolderpath); /// Bases currentBases = new HashMap<>(); @@ -540,7 +378,8 @@ private void updateSources(Map map) { continue; } - // File base = entry.getValue().equals(datastoreFolder) ? null : entry.getValue(); + // File base = entry.getValue().equals(datastoreFolder) ? null : + // entry.getValue(); // currentBases.put(entry.getKey(), base); currentBases.put(entry.getKey(), entry.getValue()); } @@ -582,26 +421,20 @@ private List extractUserFlags(DataStore args) { .collect(Collectors.toList()); // Add JSON argument flags - // flags.addAll(args.get(ClavaOptions.FLAGS_LIST)); - flags.addAll(args.get(ClavaOptions.FLAGS_LIST).getStringList()); + flags.addAll(args.get(ClavaOptions.FLAGS_LIST)); return flags; } public String getStdFlag() { - // String std = getStandard().getString(); - // - // return "-std=" + std; - - Standard standard = args.get(ClavaOptions.STANDARD); + Standard standard = this.dataStore.get(ClavaOptions.STANDARD); return "-std=" + standard.getString(); - } public Standard getStandard() { - if (args.hasValue(ClavaOptions.STANDARD)) { - return args.get(ClavaOptions.STANDARD); + if (this.dataStore.hasValue(ClavaOptions.STANDARD)) { + return this.dataStore.get(ClavaOptions.STANDARD); } // Determine standard based on implementation files @@ -704,18 +537,19 @@ private static String parseIncludePath(File path) { return folderAbsPath; /* - if (!folderAbsPath.contains(" ")) { - return folderAbsPath; - } - - // If on Windows, do not escape, or it will not work: - // https://coderanch.com/t/627514/java/ProcessBuilder-incorrectly-processes-embedded-spaces - if (SpecsPlatforms.isWindows()) { - return folderAbsPath; - } - - return "\"" + folderAbsPath + "\""; - */ + * if (!folderAbsPath.contains(" ")) { + * return folderAbsPath; + * } + * + * // If on Windows, do not escape, or it will not work: + * // https://coderanch.com/t/627514/java/ProcessBuilder-incorrectly-processes- + * embedded-spaces + * if (SpecsPlatforms.isWindows()) { + * return folderAbsPath; + * } + * + * return "\"" + folderAbsPath + "\""; + */ } /** @@ -736,8 +570,10 @@ public App createApp(List sources, List parserOptions) { /** * @param sources * @param parserOptions - * @param extraOptions options that should not be processed (e.g., header files found in folders specified by -I flags are - * automatically added to the compilation, if we want to add header folders whose header files should not + * @param extraOptions options that should not be processed (e.g., header files + * found in folders specified by -I flags are + * automatically added to the compilation, if we want to + * add header folders whose header files should not * be parsed, they can be specified here) * @return */ @@ -749,37 +585,33 @@ public App createApp(List sources, List parserOptions, List sourceIncludeFolders = getSourceIncludes(sources); ClavaLog.debug(() -> "Source include folders: " + sourceIncludeFolders); - // originalSourceFolders - // Set sourceIncludeFolders = // Add include folders to extra options List adaptedExtraOptions = new ArrayList<>(sourceIncludeFolders.size() + extraOptions.size()); adaptedExtraOptions.addAll(extraOptions); sourceIncludeFolders.stream().map(includeFolder -> "-I" + includeFolder).forEach(adaptedExtraOptions::add); - // System.out.println("EXTRA OPTIONS: " + extraOptions); - // System.out.println("ADAPTED EXTRA OPTIONS: " + adaptedExtraOptions); + List allFiles = sources.stream().map(File::toString).collect(Collectors.toList()); // Sort filenames so that select order of files is consistent between OSes Collections.sort(allFiles); - boolean useCustomResources = getConfig().get(ClavaOptions.CUSTOM_RESOURCES); + boolean useCustomResources = this.dataStore.get(ClavaOptions.CUSTOM_RESOURCES); CodeParser codeParser = CodeParser.newInstance(); // Setup code parser codeParser.set(CodeParser.USE_CUSTOM_RESOURCES, useCustomResources); - codeParser.set(CodeParser.CUDA_GPU_ARCH, getConfig().get(CodeParser.CUDA_GPU_ARCH)); - codeParser.set(CodeParser.CUDA_PATH, getConfig().get(CodeParser.CUDA_PATH)); - codeParser.set(ParallelCodeParser.PARALLEL_PARSING, getConfig().get(ParallelCodeParser.PARALLEL_PARSING)); - codeParser.set(ParallelCodeParser.PARSING_NUM_THREADS, getConfig().get(ParallelCodeParser.PARSING_NUM_THREADS)); + codeParser.set(CodeParser.CUDA_GPU_ARCH, this.dataStore.get(CodeParser.CUDA_GPU_ARCH)); + codeParser.set(CodeParser.CUDA_PATH, this.dataStore.get(CodeParser.CUDA_PATH)); + codeParser.set(ParallelCodeParser.PARALLEL_PARSING, this.dataStore.get(ParallelCodeParser.PARALLEL_PARSING)); + codeParser.set(ParallelCodeParser.PARSING_NUM_THREADS, this.dataStore.get(ParallelCodeParser.PARSING_NUM_THREADS)); codeParser.set(ParallelCodeParser.SYSTEM_INCLUDES_THRESHOLD, - getConfig().get(ParallelCodeParser.SYSTEM_INCLUDES_THRESHOLD)); + this.dataStore.get(ParallelCodeParser.SYSTEM_INCLUDES_THRESHOLD)); codeParser.set(ParallelCodeParser.CONTINUE_ON_PARSING_ERRORS, - getConfig().get(ParallelCodeParser.CONTINUE_ON_PARSING_ERRORS)); - // codeParser.set(ClangAstKeys.USE_PLATFORM_INCLUDES, getConfig().get(ClangAstKeys.USE_PLATFORM_INCLUDES)); - codeParser.set(ClangAstKeys.LIBC_CXX_MODE, getConfig().get(ClangAstKeys.LIBC_CXX_MODE)); - codeParser.set(CodeParser.CUSTOM_CLANG_AST_DUMPER_EXE, getConfig().get(CodeParser.CUSTOM_CLANG_AST_DUMPER_EXE)); + this.dataStore.get(ParallelCodeParser.CONTINUE_ON_PARSING_ERRORS)); + codeParser.set(ClangAstKeys.LIBC_CXX_MODE, this.dataStore.get(ClangAstKeys.LIBC_CXX_MODE)); + codeParser.set(CodeParser.DUMPER_FOLDER, this.dataStore.get(CodeParser.DUMPER_FOLDER)); List allParserOptions = new ArrayList<>(parserOptions.size() + adaptedExtraOptions.size()); allParserOptions.addAll(parserOptions); @@ -787,15 +619,12 @@ public App createApp(List sources, List parserOptions, List getSourceIncludes(List sources) { .map(CxxWeaver::parseIncludePath) .forEach(sourceIncludeFolders::add); - // Add original source folders as includes if skipping header parsing - // if (args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING)) { sourceIncludeFolders.addAll(originalSourceFolders); - // System.out.println("ORIGINAL SOURCE FOLDERS: " + originalSourceFolders); - // originalSourceFolders.stream().forEach(sourceIncludeFolders::add); - // } return sourceIncludeFolders; } @@ -833,48 +657,6 @@ private boolean isCutoffFolder(File path) { return false; } - /** - * Adapts initial source files. - * - *

- * E.g., if compiling for CMake, adds normal include folders as source folders. - * - * @param sources - * @param parserOptions2 - * @return - */ - /* - private List adaptSources(List sources, List parserOptions) { - List adaptedSources = new ArrayList<>(sources); - // if (args.get(CxxWeaverOption.GENERATE_CMAKE_HELPER_FILES)) { - - // Add header files in normal include folders to the tree - if (!args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING)) { - // Use parser options instead of weaver options, it can be a rebuild with other folders - List headerIncludes = parserOptions.stream() - .filter(option -> option.startsWith("-I")) - .map(option -> new File(option.substring("-I".length()))) - .collect(Collectors.toList()); - - adaptedSources.addAll(headerIncludes); - - ClavaLog.debug(() -> "Adding the following header includes from the options: " + headerIncludes); - ClavaLog.debug(() -> "Original header includes: " + args.get(CxxWeaverOption.HEADER_INCLUDES)); - // for (File includeFolder : args.get(CxxWeaverOption.HEADER_INCLUDES)) { - // adaptedSources.add(includeFolder); - // // parserOptions.add("-I" + parseIncludePath(includeFolder)); - // } - } - - // parserOptions.stream() - // .filter(option -> option.startsWith("-I")) - // .map(option -> option.substring("-I".length())) - // .forEach(includeFolder -> adaptedSources.add(new File(includeFolder))); - // } - - return adaptedSources; - } - */ private List processSources(Map sourceFiles, List parserOptions) { SpecsCheck.checkArgument(!sourceFiles.isEmpty(), @@ -882,8 +664,9 @@ private List processSources(Map sourceFiles, List Set adaptedSources = new HashSet<>(); - // boolean skipHeaderFiles = args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING); - boolean skipHeaderFiles = !args.get(CxxWeaverOption.PARSE_INCLUDES); + // boolean skipHeaderFiles = + // args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING); + boolean skipHeaderFiles = !this.dataStore.get(CxxWeaverOption.PARSE_INCLUDES); if (skipHeaderFiles) { // Add only implementation files if skipping header includes @@ -900,7 +683,8 @@ private List processSources(Map sourceFiles, List // Add header files in normal include folders to the tree if (!skipHeaderFiles) { - // Use parser options instead of weaver options, it can be a rebuild with other folders + // Use parser options instead of weaver options, it can be a rebuild with other + // folders // TODO: Remove dependency to parserOptions, instead ask for list of includes? List headerIncludes = parserOptions.stream() .map(CxxWeaver::headerFlagToFile) @@ -922,7 +706,8 @@ private List processSources(Map sourceFiles, List ClavaLog.debug(() -> "Found the following normal header includes: " + headerIncludes); ClavaLog.debug(() -> "Adding the following header includes from the options: " + headerFilesMap.keySet()); - // ClavaLog.debug(() -> "Original header includes: " + args.get(CxxWeaverOption.HEADER_INCLUDES)); + // ClavaLog.debug(() -> "Original header includes: " + + // args.get(CxxWeaverOption.HEADER_INCLUDES)); // for (File includeFolder : args.get(CxxWeaverOption.HEADER_INCLUDES)) { // adaptedSources.add(includeFolder); // // parserOptions.add("-I" + parseIncludePath(includeFolder)); @@ -930,8 +715,6 @@ private List processSources(Map sourceFiles, List } return new ArrayList<>(adaptedSources); - // return sourceFiles.keySet().stream() - // .collect(Collectors.toList()); } private static Optional headerFlagToFile(String headerFlag) { @@ -952,108 +735,95 @@ private static Optional headerFlagToFile(String headerFlag) { } /** - * Return a JoinPoint instance of the language root, i.e., an instance of AProgram + * Return a JoinPoint instance of the language root, i.e., an instance of + * AProgram * * @return an instance of the join point root/program */ @Override - public JoinPoint select() { + public JoinPoint getRootJp() { return CxxJoinpoints.create(getApp()); } public String getProgramName() { return getFirstSourceFolder(getSources()).getName(); - // return getSources().stream() - // .findFirst() - // .map(File::getName) - // .orElse("C/C++ Program"); - // return baseFolder.getName(); } public File getWeavingFolder() { - String outputFoldername = args.get(CxxWeaverOption.WOVEN_CODE_FOLDERNAME); + String outputFoldername = this.dataStore.get(CxxWeaverOption.WOVEN_CODE_FOLDERNAME); if (outputFoldername.isEmpty()) { ClavaLog.info("No name defined for the output folder, using default value 'output'"); outputFoldername = "output"; } - // System.out.println("OUTPUT FOLDER:" + args.get(LaraiKeys.OUTPUT_FOLDER)); - // System.out.println("WOVEN CODE FOLDERNAME:" + args.get(CxxWeaverOption.WOVEN_CODE_FOLDERNAME)); - // return SpecsIo.mkdir(outputDir, args.get(CxxWeaverOption.WOVEN_CODE_FOLDERNAME)); - File outputFolder = SpecsIo.mkdir(args.get(LaraiKeys.OUTPUT_FOLDER), outputFoldername); + File outputFolder = SpecsIo.mkdir(this.dataStore.get(LaraiKeys.OUTPUT_FOLDER), outputFoldername); return outputFolder; } /** - * Closes the weaver to the specified output directory location, if the weaver generates new file(s) + * Closes the weaver to the specified output directory location, if the weaver + * generates new file(s) * * @return if close was successful */ @Override - public boolean close() { + protected boolean close() { // if (!args.get(CxxWeaverOption.DISABLE_WEAVING)) { // Process App files - if (!getApp().getTranslationUnits().isEmpty()) { - if (args.get(CxxWeaverOption.CHECK_SYNTAX)) { - SpecsLogs.msgInfo("Checking woven code syntax..."); - rebuildAst(false); - // rebuildAst(true); - } + getAppTry().ifPresent(app -> { + if (!app.getTranslationUnits().isEmpty()) { + if (this.dataStore.get(CxxWeaverOption.CHECK_SYNTAX)) { + SpecsLogs.msgInfo("Checking woven code syntax..."); + rebuildAst(false); + } - // Terminate weaver execution with final steps required and writing output files + // Terminate weaver execution with final steps required and writing output files - // Write output files if code generation is not disabled - if (!args.get(CxxWeaverOption.DISABLE_CODE_GENERATION)) { - writeCode(getWeavingFolder()); - } + // Write output files if code generation is not disabled + if (!this.dataStore.get(CxxWeaverOption.DISABLE_CODE_GENERATION)) { + writeCode(getWeavingFolder()); + } - // Write CMake helper files - if (args.get(CxxWeaverOption.GENERATE_CMAKE_HELPER_FILES)) { - generateCmakerHelperFiles(); - } + // Write CMake helper files + if (this.dataStore.get(CxxWeaverOption.GENERATE_CMAKE_HELPER_FILES)) { + generateCmakerHelperFiles(); + } - } + } + }); /// Clean-up phase - // if (!SpecsSystem.isDebug()) { // Delete temporary weaving folder, if exists SpecsIo.deleteFolder(new File(TEMP_WEAVING_FOLDER)); // Delete temporary source folder, if exists SpecsIo.deleteFolder(new File(TEMP_SRC_FOLDER)); - // } - - // Delete intermediary files - if (args.get(CxxWeaverOption.CLEAN_INTERMEDIATE_FILES)) { - for (String tempFile : ClangAstDumper.getTempFiles()) { - new File(tempFile).delete(); + if (this.dataStore != null) { + // Delete intermediary files + if (this.dataStore.get(CxxWeaverOption.CLEAN_INTERMEDIATE_FILES)) { + for (String tempFile : ClangAstDumper.getTempFiles()) { + new File(tempFile).delete(); + } } - } - // Re-enable output - if (args.get(CxxWeaverOption.DISABLE_CLAVA_INFO)) { - // System.out.println("REENABLING CLAVA INFO FOR LOGGER " + SpecsLogs.getSpecsLogger()); - /* - Preconditions.checkNotNull(infoLogger); - infoLogger.setLevel(previousLevel); - infoLogger = null; - previousLevel = null; - */ - SpecsLogs.getSpecsLogger().setLevelAll(null); - ClavaLog.getLogger().setLevelAll(null); + // Re-enable output + if (this.dataStore.get(CxxWeaverOption.DISABLE_CLAVA_INFO)) { + SpecsLogs.getSpecsLogger().setLevelAll(null); + ClavaLog.getLogger().setLevelAll(null); + } } - if (!messagesToUser.isEmpty()) { + if ((messagesToUser != null) && !messagesToUser.isEmpty()) { ClavaLog.info(" - Messages -"); messagesToUser.forEach(ClavaLog::info); } // Clear weaver data - weaverData = null; + reset(); return true; } @@ -1097,21 +867,26 @@ private void generateCmakerHelperFiles() { // Add folders for generated files newIncludeDirs.addAll(getAllIncludeFolders(getWeavingFolder(), generatedFiles)); - // Add original includes at the end, in case there are "out-of-source" files (e.g., .inc files) that are needed - newIncludeDirs.addAll(args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles()); + // Add original includes at the end, in case there are "out-of-source" files + // (e.g., .inc files) that are needed + newIncludeDirs.addAll(this.dataStore.get(CxxWeaverOption.HEADER_INCLUDES).getFiles()); // Add includes from original sources originalSourceFolders.stream().map(sourceFolder -> new File(sourceFolder)) .forEach(newIncludeDirs::add); - // If we are skipping the parsing of include folders, we should include the original include folders as includes + // If we are skipping the parsing of include folders, we should include the + // original include folders as includes // if (args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING)) { - // List originalHeaderIncludes = args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles(); + // List originalHeaderIncludes = + // args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles(); // newIncludeDirs.addAll(originalHeaderIncludes); - // ClavaLog.debug(() -> "Skip headers is enabled, adding original headers: " + originalHeaderIncludes); + // ClavaLog.debug(() -> "Skip headers is enabled, adding original headers: " + + // originalHeaderIncludes); // } - // String includeFoldersContent = getIncludePaths(getWeavingFolder()).stream().collect(Collectors.joining(";")); + // String includeFoldersContent = + // getIncludePaths(getWeavingFolder()).stream().collect(Collectors.joining(";")); String includeFoldersContent = newIncludeDirs.stream() // .map(File::getAbsolutePath) .map(SpecsIo::getCanonicalPath) @@ -1137,23 +912,7 @@ private void generateCmakerHelperFiles() { @Override public void writeCode(File outputFolder) { // If copy files is enabled, first copy source files to output folder - if (getConfig().get(CxxWeaverOption.COPY_FILES_IN_SOURCES)) { - // for (File source : getSources()) { - // // If file, just copy the file - // if (source.isFile()) { - // SpecsIo.copy(source, new File(outputFolder, source.getName())); - // continue; - // } - // - // if (source.isDirectory()) { - // File destFolder = SpecsIo.mkdir(outputFolder, source.getName()); - // SpecsIo.copyFolderContents(source, destFolder); - // continue; - // } - // - // SpecsLogs.warn("Case not defined for source '" + source + "', is neither a file or a folder"); - // } - + if (this.dataStore.get(CxxWeaverOption.COPY_FILES_IN_SOURCES)) { for (File source : currentSourceFolders) { // If file, just copy the file // if (source.isFile()) { @@ -1182,7 +941,8 @@ public void writeCode(File outputFolder) { // System.out.println("DESTINATION FILE:" + destinationFile); String code = entry.getValue(); - // If file already exists, and is the same as the file that we are about to write, skip + // If file already exists, and is the same as the file that we are about to + // write, skip if (destinationFile.isFile() && areEqual(destinationFile, code)) { continue; } @@ -1197,7 +957,7 @@ public void writeCode(File outputFolder) { private Set getModifiedFilenames() { // If option is disabled, return null - if (!args.get(CxxWeaverOption.GENERATE_MODIFIED_CODE_ONLY)) { + if (!this.dataStore.get(CxxWeaverOption.GENERATE_MODIFIED_CODE_ONLY)) { return null; } @@ -1249,11 +1009,12 @@ private static boolean areEqual(File expected, String actual) { /** * Returns a list of Gears associated to this weaver engine * - * @return a list of implementations of {@link AGear} or null if no gears are available + * @return a list of implementations of {@link AGear} or null if no gears are + * available */ @Override public List getGears() { - return Arrays.asList(modifiedFilesGear, insideApplyGear, cacheHandlerGear); + return Arrays.asList(modifiedFilesGear, cacheHandlerGear); } @Override @@ -1271,7 +1032,7 @@ public String getName() { } public DataStore getConfig() { - return args; + return this.dataStore; } public TranslationUnit rebuildFile(TranslationUnit tUnit) { @@ -1295,7 +1056,7 @@ public TranslationUnit rebuildFile(TranslationUnit tUnit) { List rebuildOptions = new ArrayList<>(); // Copy current options, removing previous normal includes - var parserOptions = buildParserOptions(args); + var parserOptions = buildParserOptions(this.dataStore); parserOptions.stream() .filter(option -> !option.startsWith("-I")) .forEach(rebuildOptions::add); @@ -1312,7 +1073,8 @@ public TranslationUnit rebuildFile(TranslationUnit tUnit) { rebuildOptions.add(0, CxxWeaver.buildIncludeArg(extraInclude.getAbsolutePath())); } - // Write the other translation units and add folder as includes, in case they are needed + // Write the other translation units and add folder as includes, in case they + // are needed String currentCodeFoldername = TEMP_WEAVING_FOLDER + "_for_file_rebuild"; File currentCodeFolder = SpecsIo.mkdir(currentCodeFoldername).getAbsoluteFile(); SpecsIo.deleteFolderContents(currentCodeFolder, true); @@ -1341,10 +1103,6 @@ public TranslationUnit rebuildFile(TranslationUnit tUnit) { // Delete current code folder SpecsIo.deleteFolder(currentCodeFolder); - // SpecsCheck.checkArgument(rebuiltApp.getTranslationUnits().size() == 1, - // () -> "Expected number of translation units to be 1, got " + rebuiltApp.getTranslationUnits().size() - // + ":\n" + rebuiltApp.getTranslationUnits()); - // After rebuilding, clear current app cache getApp().clearCache(); getEventTrigger().triggerAction(Stage.DURING, @@ -1437,7 +1195,8 @@ private void fuzzyFix(TranslationUnit tunit, String errorOutput) { } /** - * @param update if true, the weaver will update its state to use the rebuilt tree instead of the original tree + * @param update if true, the weaver will update its state to use the rebuilt + * tree instead of the original tree */ public boolean rebuildAst(boolean update) { // Check if inside apply @@ -1453,61 +1212,39 @@ public boolean rebuildAst(boolean update) { Set includeFolders = getSourceIncludeFoldersFromTempFolder(tempFolder); - /* - // If we are skipping the parsing of include folders, we should include the original include folders as includes - if (args.get(CxxWeaverOption.SKIP_HEADER_INCLUDES_PARSING)) { - List originalHeaderIncludes = args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles(); - includeFolders.addAll(originalHeaderIncludes); - ClavaLog.debug( - () -> "Skip headers is enabled, adding original headers to rebuild: " + originalHeaderIncludes); - } - */ - ClavaLog.debug(() -> "Include folders for rebuild, from folder '" + tempFolder + "': " + includeFolders); List extraOptions = new ArrayList<>(); - // Add original includes as extra options, in case it needs any header file that is excluded from parsing (e.g., + // Add original includes as extra options, in case it needs any header file that + // is excluded from parsing (e.g., // .incl) - List originalHeaderIncludes = args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles(); + List originalHeaderIncludes = this.dataStore.get(CxxWeaverOption.HEADER_INCLUDES).getFiles(); originalHeaderIncludes.stream().map(folder -> CxxWeaver.buildIncludeArg(folder.getAbsolutePath())) .forEach(extraOptions::add); - // includeFolders.addAll(originalHeaderIncludes); - - // ClavaLog.debug(() -> "All include folders for rebuild" + includeFolders); List rebuildOptions = new ArrayList<>(); // Copy current options, removing previous normal includes - var parserOptions = buildParserOptions(args); + var parserOptions = buildParserOptions(this.dataStore); parserOptions.stream() - .filter(option -> !option.startsWith("-I")) + .filter(option -> !(option.startsWith("-I") || option.startsWith("-i"))) .forEach(rebuildOptions::add); - // rebuildOptions.addAll(parserOptions); // Add include folders for (File includeFolder : includeFolders) { - // rebuildOptions.add(0, "\"-I" + includeFolder.getAbsolutePath() + "\""); rebuildOptions.add(0, CxxWeaver.buildIncludeArg(includeFolder.getAbsolutePath())); } // Add extra includes - // for (File extraInclude : getApp().getExternalDependencies().getExtraIncludes()) { for (File extraInclude : getExternalIncludeFolders()) { - // rebuildOptions.add(0, "\"-I" + extraInclude.getAbsolutePath() + "\""); rebuildOptions.add(0, CxxWeaver.buildIncludeArg(extraInclude.getAbsolutePath())); } - // App rebuiltApp = createApp(srcFolders, rebuildOptions); - // List srcFolders = new ArrayList<>(includeFolders); - - // App rebuiltApp = createApp(srcFolders, rebuildOptions); - var previousBases = currentBases; var rebuildBases = new HashMap(); - for (var writtenFile : writtenFiles) { - rebuildBases.put(SpecsIo.getCanonicalFile(writtenFile), tempFolder); - } + writtenFiles.stream() + .forEach(writtenFile -> rebuildBases.put(SpecsIo.getCanonicalFile(writtenFile), tempFolder)); currentBases = rebuildBases; App rebuiltApp = createApp(writtenFiles, rebuildOptions, extraOptions); @@ -1515,29 +1252,12 @@ public boolean rebuildAst(boolean update) { // Restore current bases currentBases = previousBases; - // rebuiltApp.getTranslationUnits().forEach(tu -> System.out.println("Relative: " + tu.getRelativeFilepath())); - // Creating an app automatically pushes the App in the Context context.popApp(); // Clear data ClavaData.clearAllCaches(); - // if (update) { - // // Top app is the one we want, pop the app before that one - // weaverData.popAst(); - // weaverData.pushAst(rebuiltApp); - // currentSources = srcFolders; - // - // } - // System.out.println("TUs:" - // + getApp().getTranslationUnits().stream().map(tu -> tu.getFilename()) - // .collect(Collectors.toList())); - // - // System.out.println("TUs Rebuilt:" - // + rebuiltApp.getTranslationUnits().stream().map(tu -> tu.getFilename()) - // .collect(Collectors.toList())); - // Base folder is now the temporary folder if (update) { currentBases = rebuildBases; @@ -1550,7 +1270,8 @@ public boolean rebuildAst(boolean update) { // Create file->base map // Since files where all written to the same folder: - // 1) If the parent folder is the same as the temp folder, it has not base folder; + // 1) If the parent folder is the same as the temp folder, it has not base + // folder; // 2) Otherwise, the temp folder is the base folder Map writtenFilesToBase = new HashMap<>(); @@ -1571,11 +1292,13 @@ public boolean rebuildAst(boolean update) { String sourceFoldername = relativePath.substring(0, slashIndex); writtenFilesToBase.put(writtenFile, new File(tempFolder, sourceFoldername)); - // File baseFolder = writtenFile.getParentFile().equals(tempFolder) ? null : tempFolder; + // File baseFolder = writtenFile.getParentFile().equals(tempFolder) ? null : + // tempFolder; // writtenFilesToBase.put(writtenFile, baseFolder); } // writtenFiles.stream().forEach( - // file -> file.getParentFile().equals(tempFolder) ? null : writtenFilesToBase.put(file, tempFolder)); + // file -> file.getParentFile().equals(tempFolder) ? null : + // writtenFilesToBase.put(file, tempFolder)); updateSources(writtenFilesToBase); @@ -1611,22 +1334,6 @@ private static File newTemporaryWeavingFolder() { return tempFolder.getAbsoluteFile(); } - @Override - public List getAspectsAPI() { - return CLAVA_LARA_API; - } - - @Override - public List getImportableScripts() { - return ResourceProvider.getResourcesFromEnum(Arrays.asList(JsApiResource.class, JsAntarexApiResource.class)); - } - - @Override - public ResourceProvider getIcon() { - // return () -> "cxxweaver/clava_icon_48x48.ico"; - return () -> "clava/clava_icon_300dpi.png"; - } - public Object getUserField(ClavaNode node, String fieldName) { // Get node values Map values = getUserValues().get(node); @@ -1670,12 +1377,7 @@ public Set getLanguages() { public void pushAst() { // Create a copy of app and push it App clonedApp = (App) getApp().copy(true); - - // App newApp = getApp().pushAst(); - // weaverData.pushAst(newApp); weaverData.pushAst(clonedApp); - - // weaverData.pushAst(clonedApp); } public void pushAst(App app) { @@ -1694,7 +1396,6 @@ public void popAst() { } public Integer nextId(String prefix) { - return accMap.add(prefix); } @@ -1703,7 +1404,7 @@ public List getAvailableIncludes() { List searchPaths = new ArrayList<>(); searchPaths.addAll(getSources()); - searchPaths.addAll(args.get(CxxWeaverOption.HEADER_INCLUDES).getFiles()); + searchPaths.addAll(this.dataStore.get(CxxWeaverOption.HEADER_INCLUDES).getFiles()); // System.out.println("SEARCH PATHS:" + searchPaths); Set includeFolders = searchPaths.stream() // .map(CxxWeaver::parseIncludePath) @@ -1735,21 +1436,6 @@ public List getAvailableIncludes() { return includes; } - // public static String getRelativeFilepath(TranslationUnit tunit) { - // return tunit.getRelativeFilepath(CxxWeaver.getCxxWeaver().getBaseSourceFolder()); - // } - - // public static String getRelativeFolderpath(TranslationUnit tunit) { - // return tunit.getRelativeFolderpath(CxxWeaver.getCxxWeaver().getBaseSourceFolder()); - // } - - @Override - public boolean executeUnitTestMode(DataStore dataStore) { - int unitResults = LaraUnitLauncher.execute(dataStore, getClass().getName()); - - return unitResults == 0; - } - public static ClavaFactory getFactory() { return getContex().get(ClavaContext.FACTORY); } @@ -1766,7 +1452,8 @@ public static SnippetParser getSnippetParser() { * Helper method which returns include folders of the source files. * *

- * For the temporary folder, the source folders are the children folders of the temporary folder, and the temporary + * For the temporary folder, the source folders are the children folders of the + * temporary folder, and the temporary * folder itself. * * @param weavingFolder @@ -1785,19 +1472,6 @@ private Set getSourceIncludeFolders(File weavingFolder, boolean onlyHeader includeFolders.add(weavingFolder); return includeFolders; - /* - boolean flattenFolders = getConfig().get(CxxWeaverOption.FLATTEN_WOVEN_CODE_FOLDER_STRUCTURE); - - // For all Translation Units, collect new destination folders - return getApp().getTranslationUnits().stream() - // .map(tu -> new File(tu.getDestinationFolder(weavingFolder, flattenFolders), - // tu.getRelativeFolderpath())) - // Consider only header files - .filter(tu -> onlyHeaders ? tu.isHeaderFile() : true) - .map(tu -> tu.getDestinationFolder(weavingFolder, flattenFolders)) - .map(file -> SpecsIo.getCanonicalFile(file)) - .collect(Collectors.toCollection(() -> new LinkedHashSet<>())); - */ } private Set getExternalIncludeFolders() { @@ -1808,87 +1482,35 @@ private Set getExternalIncludeFolders() { private Set getAllIncludeFolders(File weavingFolder, Set generatedFiles) { Set includePaths = new LinkedHashSet<>(); - // System.out.println("SOURCE INCLUDE FOLDERS: " + getSourceIncludeFolders(weavingFolder, true)); - // System.out.println("EXTERNAL INCLUDE FOLDERS: " + getExternalIncludeFolders()); - // System.out.println("GENERATED FILES: " + generatedFiles); includePaths.addAll(getSourceIncludeFolders(weavingFolder, true)); includePaths.addAll(getExternalIncludeFolders()); - /* - if(!generatedFiles.isEmpty()) { - // Get translation units that correspond to generated files - getApp().getTranslationUnits(); - } - */ - - // System.out.println("INCLUDES BEFORE:" + includePaths); // Add includes to manually generated files generatedFiles.stream() .filter(SourceType::isHeader) .map(File::getParentFile) .forEach(includePaths::add); - // .collect(Collectors.toList()); - // System.out.println("INCLUDES AFTER:" + includePaths); - return includePaths; - } - /* - - private Set getIncludePaths(File weavingFolder) { - Set includePaths = new HashSet<>(); - - boolean flattenFolders = getConfig().get(CxxWeaverOption.FLATTEN_WOVEN_CODE_FOLDER_STRUCTURE); - // System.out.println("FLATTEN FOLDERS:" + flattenFolders); - // for (TranslationUnit tunit : getApp().getTranslationUnits()) { - // System.out.println("TUNIT: " + tunit.getLocation()); - // System.out.println("DESTINATION FOLDER:" + tunit.getDestinationFolder(weavingFolder, flattenFolders)); - // System.out.println("Relative filepath:" + tunit.getRelativeFilepath()); - // System.out.println("Relative folderpath:" + tunit.getRelativeFolderpath()); - // - // } - - // For all Translation Units, collect new destination folders - getApp().getTranslationUnits().stream() - // .map(tu -> tu.getDestinationFolder(weavingFolder, flattenFolders)) - .map(tu -> new File(tu.getDestinationFolder(weavingFolder, flattenFolders), - tu.getRelativeFolderpath())) - .map(file -> SpecsIo.getCanonicalPath(file)) - .forEach(includePaths::add); - - // getApp().getTranslationUnits().stream() - // .map(tu -> SpecsIo.getCanonicalPath(new File(tu.getFolderpath()))) - // .forEach(includePaths::add); - - getApp().getExternalDependencies().getExtraIncludes().stream() - .map(SpecsIo::getCanonicalPath) - .forEach(includePaths::add); - return includePaths; } - - */ - - /** - * Creates an empty App. - * - * @return - */ - // private static App createEmptyApp(ClavaContext context) { - // return context.get(ClavaContext.FACTORY).app(Collections.emptyList()); - // } /** * Normalizes key paths to be only files */ private Map obtainFiles(Map filesToBases) { - var parserOptions = buildParserOptions(args); + var parserOptions = buildParserOptions(this.dataStore); Map processedFiles = new HashMap<>(); for (var sourceAndBase : filesToBases.entrySet()) { - // If a file, just add it - if (sourceAndBase.getKey().isFile()) { - processedFiles.put(sourceAndBase.getKey(), sourceAndBase.getValue()); + File source = sourceAndBase.getKey(); + // If a file, just add it (unless we are skipping header parsing) + if (source.isFile()) { + if (shouldSkipFile(source)) { + continue; + } + + processedFiles.put(source, sourceAndBase.getValue()); } // Process folder @@ -1899,6 +1521,10 @@ private Map obtainFiles(Map filesToBases) { } + private boolean shouldSkipFile(File file) { + return !this.dataStore.get(CxxWeaverOption.PARSE_INCLUDES) && SourceType.isHeader(file); + } + private void obtainFiles(File folder, File baseFolder, Map processedFiles, List parserOptions) { // All files specified by the user, header and implementation Set extensions = SourceType.getPermittedExtensions(); @@ -1930,20 +1556,10 @@ public int getStackSize() { @Override public AstMethods getAstMethods() { - // var temp = getFactory().builtinType("int"); - // temp.getChildren().stream() - // .filter(CxxWeaver::lclFilter) - // .collect(Collectors.toList()); - return new ClavaAstMethods(this, ClavaNode.class, node -> CxxJoinpoints.create(node), node -> ClavaCommonLanguage.getJoinPointName(node), node -> node.getScopeChildren()); } - @Override - protected List getWeaverNpmResources() { - return Arrays.asList(ClavaApiJsResource.values()); - } - public void clearAppHistory() { context.clearAppHistory(); } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.json b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.json deleted file mode 100644 index ac56d258cf..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.json +++ /dev/null @@ -1,103329 +0,0 @@ -{ - "root": "program", - "rootAlias": "program", - "children": [ - { - "type": "joinpoint", - "name": "joinpoint", - "extends": "" , - "children": [ - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "accessSpecifier", - "defaultAttr": "kind", - "extends": "decl" , - "children": [ - { - "type": "attribute", - "tooltip": "the type of specifier. Can return 'public', 'protected', 'private' or 'none'", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "adjustedType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "tooltip": "the type that is being adjusted", - "children": [ - { - "type": "type", - "name": "originalType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "arrayAccess", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "expression representing the variable of the array access (can be a varref, memberAccess...)", - "children": [ - { - "type": "expression", - "name": "arrayVar" - }] - }, - { - "type": "attribute", - "tooltip": "If the array access is done over a variable, returns the name of the variable. Equivalent to $arrayAccess.arrayVar.name", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The number of subscripts of this array access", - "children": [ - { - "type": "int", - "name": "numSubscripts" - }] - }, - { - "type": "attribute", - "tooltip": "A view of the current arrayAccess without the last subscript, or undefined if this arrayAccess only has one subscript", - "children": [ - { - "type": "arrayAccess", - "name": "parentAccess" - }] - }, - { - "type": "attribute", - "tooltip": "expression of the array access subscript", - "children": [ - { - "type": "expression[]", - "name": "subscript" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "arrayVar", - "tooltip": "varref to the variable of the array access" - }, - { - "type": "select", - "clazz": "expression", - "alias": "subscript", - "tooltip": "expression of the array access subscript" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "arrayType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "elementType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the element type of the array", - "children": [ - { - "type": "void", - "name": "setElementType" - }, - { - "type": "type", - "name": "arrayElementType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "asmStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "clobbers" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isSimple" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isVolatile" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "attribute", - "extends": "joinpoint" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "binaryOp", - "extends": "op" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isAssignment" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "left" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "right" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBitwise" - }] - }, - { - "type": "attribute", - "tooltip": "The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary'", - "children": [ - { - "type": "[ptr_mem_d| ptr_mem_i| mul| div| rem| add| sub| shl| shr| cmp| lt| gt| le| ge| eq| ne| and| xor| or| l_and| l_or| assign| mul_assign| div_assign| rem_assign| add_assign| sub_assign| shl_assign| shr_assign| and_assign| xor_assign| or_assign| comma| post_inc| post_dec| pre_inc| pre_dec| addr_of| deref| plus| minus| not| l_not| real| imag| extension| cowait| ternary]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "operator" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "left" - }, - { - "type": "select", - "clazz": "expression", - "alias": "right" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setLeft" - }, - { - "type": "expression", - "name": "left", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setRight" - }, - { - "type": "expression", - "name": "right", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "body", - "extends": "scope" , - "children": [ - { - "type": "attribute", - "tooltip": "Returns the descendant statements of this scope, excluding other scopes, loops, ifs and wrapper statements", - "children": [ - { - "type": "statement[]", - "name": "allStmts" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "statement", - "name": "firstStmt" - }] - }, - { - "type": "attribute", - "tooltip": "The number of statements in the scope, including the statements inside the declaration and bodies of structures such as ifs and loops, and not considering comments and pragmas. If flat is true, does not consider the statements inside structures such as ifs and loops (e.g., a loop counts as one statement)", - "children": [ - { - "type": "Long", - "name": "getNumStatements" - }, - { - "type": "Boolean", - "name": "flat", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "statement", - "name": "lastStmt" - }] - }, - { - "type": "attribute", - "tooltip": "true if the scope does not have curly braces", - "children": [ - { - "type": "Boolean", - "name": "naked" - }] - }, - { - "type": "attribute", - "tooltip": "The statement that owns the scope (e.g., function, loop...)", - "children": [ - { - "type": "joinpoint", - "name": "owner" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the direct (children) statements of this scope", - "children": [ - { - "type": "statement[]", - "name": "stmts" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "statement", - "alias": "stmt" - }, - { - "type": "select", - "clazz": "statement", - "alias": "childStmt" - }, - { - "type": "select", - "clazz": "scope", - "alias": "" - }, - { - "type": "select", - "clazz": "if", - "alias": "" - }, - { - "type": "select", - "clazz": "loop", - "alias": "" - }, - { - "type": "select", - "clazz": "pragma", - "alias": "" - }, - { - "type": "select", - "clazz": "marker", - "alias": "" - }, - { - "type": "select", - "clazz": "tag", - "alias": "" - }, - { - "type": "select", - "clazz": "omp", - "alias": "" - }, - { - "type": "select", - "clazz": "comment", - "alias": "" - }, - { - "type": "select", - "clazz": "returnStmt", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkFor", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSync", - "alias": "" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a new local variable to this scope", - "children": [ - { - "type": "joinpoint", - "name": "addLocal" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "joinpoint", - "name": "type", - "defaultValue": "" - }, - { - "type": "String", - "name": "initValue", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "CFG tester", - "children": [ - { - "type": "String", - "name": "cfg" - }] - }, - { - "type": "action", - "tooltip": "Clears the contents of this scope (untested)", - "children": [ - { - "type": "void", - "name": "clear" - }] - }, - { - "type": "action", - "tooltip": "DFG tester", - "children": [ - { - "type": "String", - "name": "dfg" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertBegin" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertBegin" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertEnd" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertEnd" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "joinpoint", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces)", - "children": [ - { - "type": "void", - "name": "setNaked" - }, - { - "type": "Boolean", - "name": "isNaked", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "boolLiteral", - "extends": "literal" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "value" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "break", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "tooltip": "The enclosing statement related to this break. It should be either a loop or a switch statement.", - "children": [ - { - "type": "statement", - "name": "enclosingStmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "builtinType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "builtinKind" - }] - }, - { - "type": "attribute", - "tooltip": "true, if ot is a floating type (e.g., float, double)", - "children": [ - { - "type": "Boolean", - "name": "isFloat" - }] - }, - { - "type": "attribute", - "tooltip": "true, if it is an integer type", - "children": [ - { - "type": "Boolean", - "name": "isInteger" - }] - }, - { - "type": "attribute", - "tooltip": "true, if it is a signed integer type", - "children": [ - { - "type": "Boolean", - "name": "isSigned" - }] - }, - { - "type": "attribute", - "tooltip": "true, if it is an unsigned integer type", - "children": [ - { - "type": "Boolean", - "name": "isUnsigned" - }] - }, - { - "type": "attribute", - "tooltip": "true, if it is the type 'void'", - "children": [ - { - "type": "Boolean", - "name": "isVoid" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "call", - "defaultAttr": "name", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "an alias for 'args'", - "children": [ - { - "type": "expression[]", - "name": "argList" - }] - }, - { - "type": "attribute", - "tooltip": "an array with the arguments of the call", - "children": [ - { - "type": "expression[]", - "name": "args" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found", - "children": [ - { - "type": "function", - "name": "declaration" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found", - "children": [ - { - "type": "function", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function)", - "children": [ - { - "type": "function", - "name": "directCallee" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration", - "children": [ - { - "type": "function", - "name": "function" - }] - }, - { - "type": "attribute", - "tooltip": "the function type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "getArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isMemberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isStmtCall" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "memberAccess", - "name": "memberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "memberNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "numArgs" - }] - }, - { - "type": "attribute", - "tooltip": "the return type of the call", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "callee" - }, - { - "type": "select", - "clazz": "expression", - "alias": "arg" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "argCode", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating a literal 'type' from the type string", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "arg", - "defaultValue": "" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Tries to inline this call", - "children": [ - { - "type": "boolean", - "name": "inline" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "expression", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArgFromString" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the name of the call", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Wraps this call with a possibly new wrapping function", - "children": [ - { - "type": "void", - "name": "wrap" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "case", - "extends": "switchCase" , - "children": [ - { - "type": "attribute", - "tooltip": "the instructions that are associated with this case in the source code. This does not represent what instructions are actually executed (e.g., if a case does not have a break, does not show instructions of the next case)", - "children": [ - { - "type": "statement[]", - "name": "instructions" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a default case, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isDefault" - }] - }, - { - "type": "attribute", - "tooltip": "true if this case does not contain instructions (i.e., it is directly above another case), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isEmpty" - }] - }, - { - "type": "attribute", - "tooltip": "the case statement that comes after this case, or undefined if there are no more case statements", - "children": [ - { - "type": "case", - "name": "nextCase" - }] - }, - { - "type": "attribute", - "tooltip": "the first statement that is not a case that will be executed by this case statement", - "children": [ - { - "type": "statement", - "name": "nextInstruction" - }] - }, - { - "type": "attribute", - "tooltip": "the values that the case statement will match. It can return zero (e.g., 'default:'), one (e.g., 'case 1:') or two (e.g., 'case 2...4:') expressions, depending on the format of the case", - "children": [ - { - "type": "expression[]", - "name": "values" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "cast", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "fromType" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Use expr.implicitCast instead]", - "children": [ - { - "type": "Boolean", - "name": "isImplicitCast" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "subExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "toType" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "cilkFor", - "defaultAttr": "kind", - "extends": "loop" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "body" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop condition", - "children": [ - { - "type": "statement", - "name": "cond" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Relation", - "name": "condRelation" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "controlVar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "varref", - "name": "controlVarref" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the last value of the control variable (e.g. 'length' in 'i < length;')", - "children": [ - { - "type": "String", - "name": "endValue" - }] - }, - { - "type": "attribute", - "tooltip": "True if the condition of the loop in the canonical format, and is one of: <, <=, >, >=", - "children": [ - { - "type": "Boolean", - "name": "hasCondRelation" - }] - }, - { - "type": "attribute", - "tooltip": "Uniquely identifies the loop inside the program", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop initialization", - "children": [ - { - "type": "statement", - "name": "init" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;')", - "children": [ - { - "type": "String", - "name": "initValue" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isInnermost" - }] - }, - { - "type": "attribute", - "tooltip": "Tests whether the loops are interchangeable. This is a conservative test.", - "children": [ - { - "type": "Boolean", - "name": "isInterchangeable" - }, - { - "type": "loop", - "name": "otherLoop", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isOutermost" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isParallel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "iterations" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "iterationsExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[for| while| dowhile| foreach]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "nestedLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "rank" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop step", - "children": [ - { - "type": "statement", - "name": "step" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the iteration step", - "children": [ - { - "type": "String", - "name": "stepValue" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "statement", - "alias": "init" - }, - { - "type": "select", - "clazz": "statement", - "alias": "cond" - }, - { - "type": "select", - "clazz": "statement", - "alias": "step" - }, - { - "type": "select", - "clazz": "scope", - "alias": "body" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Interchanges two for loops, if possible", - "children": [ - { - "type": "void", - "name": "interchange" - }, - { - "type": "loop", - "name": "otherLoop", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the body of the loop", - "children": [ - { - "type": "void", - "name": "setBody" - }, - { - "type": "scope", - "name": "body", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the conditional statement of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setCond" - }, - { - "type": "String", - "name": "condCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge", - "children": [ - { - "type": "void", - "name": "setCondRelation" - }, - { - "type": "Relation", - "name": "operator", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the end value of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setEndValue" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the init statement of the loop", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the init value of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setInitValue" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the attribute 'isParallel' of the loop", - "children": [ - { - "type": "void", - "name": "setIsParallel" - }, - { - "type": "Boolean", - "name": "isParallel", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the kind of the loop", - "children": [ - { - "type": "void", - "name": "setKind" - }, - { - "type": "String", - "name": "kind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the step statement of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setStep" - }, - { - "type": "String", - "name": "stepCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Applies loop tiling to this loop.", - "children": [ - { - "type": "statement", - "name": "tile" - }, - { - "type": "String", - "name": "blockSize", - "defaultValue": "" - }, - { - "type": "statement", - "name": "reference", - "defaultValue": "" - }, - { - "type": "Boolean", - "name": "useTernary", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "cilkSpawn", - "defaultAttr": "name", - "extends": "call" , - "children": [ - { - "type": "attribute", - "tooltip": "an alias for 'args'", - "children": [ - { - "type": "expression[]", - "name": "argList" - }] - }, - { - "type": "attribute", - "tooltip": "an array with the arguments of the call", - "children": [ - { - "type": "expression[]", - "name": "args" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found", - "children": [ - { - "type": "function", - "name": "declaration" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found", - "children": [ - { - "type": "function", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function)", - "children": [ - { - "type": "function", - "name": "directCallee" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration", - "children": [ - { - "type": "function", - "name": "function" - }] - }, - { - "type": "attribute", - "tooltip": "the function type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "getArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isMemberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isStmtCall" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "memberAccess", - "name": "memberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "memberNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "numArgs" - }] - }, - { - "type": "attribute", - "tooltip": "the return type of the call", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "callee" - }, - { - "type": "select", - "clazz": "expression", - "alias": "arg" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "argCode", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating a literal 'type' from the type string", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "arg", - "defaultValue": "" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Tries to inline this call", - "children": [ - { - "type": "boolean", - "name": "inline" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "expression", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArgFromString" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the name of the call", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Wraps this call with a possibly new wrapping function", - "children": [ - { - "type": "void", - "name": "wrap" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "cilkSync", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "class", - "defaultAttr": "name", - "extends": "record" , - "tooltip": "Represents a C++ class", - "children": [ - { - "type": "attribute", - "tooltip": "All the classes this class inherits from", - "children": [ - { - "type": "class[]", - "name": "allBases" - }] - }, - { - "type": "attribute", - "tooltip": "All the methods of this class, including inherited ones", - "children": [ - { - "type": "method[]", - "name": "allMethods" - }] - }, - { - "type": "attribute", - "tooltip": "The classes this class directly inherits from", - "children": [ - { - "type": "class[]", - "name": "bases" - }] - }, - { - "type": "attribute", - "tooltip": "Class join points can either represent declarations or definitions, returns the definition of this class, if present, or the first declaration, if only declarations are present", - "children": [ - { - "type": "class", - "name": "canonical" - }] - }, - { - "type": "attribute", - "tooltip": "The implementation (or definition) of this class present in the AST, or undefined if none is found", - "children": [ - { - "type": "class", - "name": "implementation" - }] - }, - { - "type": "attribute", - "tooltip": "True, if contains at least one pure function", - "children": [ - { - "type": "boolean", - "name": "isAbstract" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is the class returned by the 'canonical' attribute", - "children": [ - { - "type": "Boolean", - "name": "isCanonical" - }] - }, - { - "type": "attribute", - "tooltip": "True, if all functions are pure", - "children": [ - { - "type": "boolean", - "name": "isInterface" - }] - }, - { - "type": "attribute", - "tooltip": "The methods declared by this class", - "children": [ - { - "type": "method[]", - "name": "methods" - }] - }, - { - "type": "attribute", - "tooltip": "The prototypes (or declarations) of this class present in the AST, if any", - "children": [ - { - "type": "class[]", - "name": "prototypes" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "field[]", - "name": "fields" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "function[]", - "name": "functions" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is an implementation (i.e. has its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isImplementation" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isPrototype" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "method", - "alias": "" - }, - { - "type": "select", - "clazz": "field", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a method to a class. If the given method has a definition, creates an equivalent declaration and adds it to the class, otherwise simply added the declaration to the class. In both cases, the declaration is only added to the class if there is no declaration already with the same signature.", - "children": [ - { - "type": "void", - "name": "addMethod" - }, - { - "type": "method", - "name": "method", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a field to a record (struct, class).", - "children": [ - { - "type": "void", - "name": "addField" - }, - { - "type": "field", - "name": "field", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "clavaException", - "extends": "joinpoint" , - "tooltip": "Utility joinpoint, to represent certain problems when generating join points", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Object", - "name": "exception" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "exceptionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "message" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "comment", - "extends": "joinpoint" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "text" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setText" - }, - { - "type": "String", - "name": "text", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "continue", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "cudaKernelCall", - "defaultAttr": "name", - "extends": "call" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression[]", - "name": "config" - }] - }, - { - "type": "attribute", - "tooltip": "an alias for 'args'", - "children": [ - { - "type": "expression[]", - "name": "argList" - }] - }, - { - "type": "attribute", - "tooltip": "an array with the arguments of the call", - "children": [ - { - "type": "expression[]", - "name": "args" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found", - "children": [ - { - "type": "function", - "name": "declaration" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found", - "children": [ - { - "type": "function", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function)", - "children": [ - { - "type": "function", - "name": "directCallee" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration", - "children": [ - { - "type": "function", - "name": "function" - }] - }, - { - "type": "attribute", - "tooltip": "the function type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "getArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isMemberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isStmtCall" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "memberAccess", - "name": "memberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "memberNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "numArgs" - }] - }, - { - "type": "attribute", - "tooltip": "the return type of the call", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "callee" - }, - { - "type": "select", - "clazz": "expression", - "alias": "arg" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setConfig" - }, - { - "type": "expression[]", - "name": "args", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setConfigFromStrings" - }, - { - "type": "String[]", - "name": "args", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "argCode", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating a literal 'type' from the type string", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "arg", - "defaultValue": "" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Tries to inline this call", - "children": [ - { - "type": "boolean", - "name": "inline" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "expression", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArgFromString" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the name of the call", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Wraps this call with a possibly new wrapping function", - "children": [ - { - "type": "void", - "name": "wrap" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "decl", - "extends": "joinpoint" , - "tooltip": "Represents one declaration (e.g., int foo(){return 0;}) or definition (e.g., int foo();) in the code", - "children": [ - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "declStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "tooltip": "The declarations in this statement", - "children": [ - { - "type": "decl[]", - "name": "decls" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "declarator", - "defaultAttr": "name", - "extends": "namedDecl" , - "tooltip": "Represents a decl that comes from a declarator (e.g., function, field, variable)", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "default", - "extends": "switchCase" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "deleteExpr", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "elaboratedType", - "extends": "type" , - "tooltip": "Represents a type that was referred to using an elaborated type keyword, e.g., struct S, or via a qualified name, e.g., N::M::type, or both. This type is used to keep track of a type name as written in the source code, including tag keywords and any nested-name-specifiers. The type itself is always 'sugar', used to express what was written in the source code but containing no additional semantic information.", - "children": [ - { - "type": "attribute", - "tooltip": "the keyword of this elaborated type, if present. Can be one of: struct, interface, union, class, enum, typename", - "children": [ - { - "type": "String", - "name": "keyword" - }] - }, - { - "type": "attribute", - "tooltip": "the type that is being prefixed with the qualifier", - "children": [ - { - "type": "type", - "name": "namedType" - }] - }, - { - "type": "attribute", - "tooltip": "the qualifier of this elaborated type, if present (e.g., A::)", - "children": [ - { - "type": "String", - "name": "qualifier" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "empty", - "extends": "joinpoint" , - "tooltip": "Utility joinpoint, to represent empty nodes when directly accessing the tree", - "children": [ - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "emptyStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "enumDecl", - "defaultAttr": "name", - "extends": "namedDecl" , - "tooltip": "Represents an enum", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "enumeratorDecl[]", - "name": "enumerators" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "enumeratorDecl", - "alias": "enumerator" - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "enumType", - "extends": "tagType" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "integerType" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration of this tag type", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "enumeratorDecl", - "defaultAttr": "name", - "extends": "namedDecl" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "exprStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "tooltip": "The expression join point associated to this exprStmt", - "children": [ - { - "type": "expression", - "name": "expr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "expression", - "extends": "joinpoint" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "field", - "defaultAttr": "name", - "extends": "declarator" , - "tooltip": "Represents a member of a struct/union/class", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "file", - "defaultAttr": "name", - "extends": "joinpoint" , - "tooltip": "Represents a source file (.c, .cpp., .cl, etc)", - "children": [ - { - "type": "attribute", - "tooltip": "the path to the source folder that was given as the base folder of this file", - "children": [ - { - "type": "String", - "name": "baseSourcePath" - }] - }, - { - "type": "attribute", - "tooltip": "the output of the parser if there were errors during parsing", - "children": [ - { - "type": "String", - "name": "errorOutput" - }] - }, - { - "type": "attribute", - "tooltip": "a Java file to the file that originated this translation unit", - "children": [ - { - "type": "Object", - "name": "file" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file that will be generated by the weaver, given a destination folder", - "children": [ - { - "type": "String", - "name": "getDestinationFilepath" - }, - { - "type": "String", - "name": "destinationFolderpath", - "defaultValue": "null" - }] - }, - { - "type": "attribute", - "tooltip": "true if this file contains a 'main' method", - "children": [ - { - "type": "Boolean", - "name": "hasMain" - }] - }, - { - "type": "attribute", - "tooltip": "true if there were errors during parsing", - "children": [ - { - "type": "Boolean", - "name": "hasParsingErrors" - }] - }, - { - "type": "attribute", - "tooltip": "the includes of this file", - "children": [ - { - "type": "include[]", - "name": "includes" - }] - }, - { - "type": "attribute", - "tooltip": "true if this file is considered a C++ file", - "children": [ - { - "type": "Boolean", - "name": "isCxx" - }] - }, - { - "type": "attribute", - "tooltip": "true if this file is considered a header file", - "children": [ - { - "type": "Boolean", - "name": "isHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if this file is an OpenCL filetype", - "children": [ - { - "type": "Boolean", - "name": "isOpenCL" - }] - }, - { - "type": "attribute", - "tooltip": "the name of the file", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "the folder of the source file", - "children": [ - { - "type": "String", - "name": "path" - }] - }, - { - "type": "attribute", - "tooltip": "the path to the file relative to the base source path", - "children": [ - { - "type": "String", - "name": "relativeFilepath" - }] - }, - { - "type": "attribute", - "tooltip": "the path to the folder of the source file relative to the base source path", - "children": [ - { - "type": "String", - "name": "relativeFolderpath" - }] - }, - { - "type": "attribute", - "tooltip": "the name of the source folder of this file, or undefined if it has none", - "children": [ - { - "type": "String", - "name": "sourceFoldername" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "statement", - "alias": "stmt" - }, - { - "type": "select", - "clazz": "statement", - "alias": "childStmt" - }, - { - "type": "select", - "clazz": "function", - "alias": "" - }, - { - "type": "select", - "clazz": "method", - "alias": "" - }, - { - "type": "select", - "clazz": "record", - "alias": "" - }, - { - "type": "select", - "clazz": "struct", - "alias": "" - }, - { - "type": "select", - "clazz": "class", - "alias": "" - }, - { - "type": "select", - "clazz": "pragma", - "alias": "" - }, - { - "type": "select", - "clazz": "marker", - "alias": "" - }, - { - "type": "select", - "clazz": "tag", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "comment", - "alias": "" - }, - { - "type": "select", - "clazz": "include", - "alias": "" - }, - { - "type": "select", - "clazz": "typedefDecl", - "alias": "" - }, - { - "type": "select", - "clazz": "decl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a C include to the current file. If the file already has the include, it does nothing", - "children": [ - { - "type": "void", - "name": "addCInclude" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "boolean", - "name": "isAngled", - "defaultValue": "false" - }] - }, - { - "type": "action", - "tooltip": "Adds a function to the file that returns void and has no parameters", - "children": [ - { - "type": "joinpoint", - "name": "addFunction" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a global variable to this file", - "children": [ - { - "type": "vardecl", - "name": "addGlobal" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "joinpoint", - "name": "type", - "defaultValue": "" - }, - { - "type": "String", - "name": "initValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds an include to the current file. If the file already has the include, it does nothing", - "children": [ - { - "type": "void", - "name": "addInclude" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "boolean", - "name": "isAngled", - "defaultValue": "false" - }] - }, - { - "type": "action", - "tooltip": "Overload of addInclude which accepts a join point", - "children": [ - { - "type": "void", - "name": "addIncludeJp" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds the node in the join point to the start of the file", - "children": [ - { - "type": "void", - "name": "insertBegin" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds the String as a Decl to the end of the file", - "children": [ - { - "type": "void", - "name": "insertBegin" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds the node in the join point to the end of the file", - "children": [ - { - "type": "void", - "name": "insertEnd" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds the String as a Decl to the end of the file", - "children": [ - { - "type": "void", - "name": "insertEnd" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Recompiles only this file, returns a join point to the new recompiled file, or throws an exception if a problem happens", - "children": [ - { - "type": "file", - "name": "rebuild" - }] - }, - { - "type": "action", - "tooltip": "Recompiles only this file, returns a join point to the new recompiled file, or returns a clavaException join point if a problem happens", - "children": [ - { - "type": "joinpoint", - "name": "rebuildTry" - }] - }, - { - "type": "action", - "tooltip": "Changes the name of the file", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "filename", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the path to the folder of the source file relative to the base source path", - "children": [ - { - "type": "void", - "name": "setRelativeFolderpath" - }, - { - "type": "String", - "name": "path", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Writes the code of this file to a given folder", - "children": [ - { - "type": "String", - "name": "write" - }, - { - "type": "String", - "name": "destinationFoldername", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "floatLiteral", - "extends": "literal" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Double", - "name": "value" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "function", - "defaultAttr": "name", - "extends": "declarator" , - "tooltip": "Represents a function declaration or definition", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "body" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "call[]", - "name": "calls" - }] - }, - { - "type": "attribute", - "tooltip": "Function join points can either represent declarations or definitions, returns the definition of this function, if present, or the first declaration, if only declarations are present", - "children": [ - { - "type": "function", - "name": "canonical" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first prototype of this function that could be found, or undefined if there is none", - "children": [ - { - "type": "function", - "name": "declarationJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the prototypes of this function that are present in the code. If there are none, returns an empty array", - "children": [ - { - "type": "function[]", - "name": "declarationJps" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the implementation of this function if there is one, or undefined otherwise", - "children": [ - { - "type": "function", - "name": "definitionJp" - }] - }, - { - "type": "attribute", - "tooltip": "the type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "getDeclaration" - }, - { - "type": "Boolean", - "name": "withReturnType", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Use .isImplementation instead] True if this particular function join point has a body, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasDefinition" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this is the function returned by the 'canonical' attribute", - "children": [ - { - "type": "Boolean", - "name": "isCanonical" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isCudaKernel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isDelete" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular function join point is an implementation (i.e. has a body), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isImplementation" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isInline" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isModulePrivate" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular function join point is a prototype (i.e. does not have a body), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isPrototype" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPure" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isVirtual" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "paramNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "param[]", - "name": "params" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "a string with the signature of this function (e.g., name of the function, plus the parameters types)", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC)", - "children": [ - { - "type": "StorageClass", - "name": "storageClass" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "body", - "alias": "" - }, - { - "type": "select", - "clazz": "param", - "alias": "" - }, - { - "type": "select", - "clazz": "decl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a new parameter to the function", - "children": [ - { - "type": "void", - "name": "addParam" - }, - { - "type": "param", - "name": "param", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a new parameter to the function", - "children": [ - { - "type": "void", - "name": "addParam" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class", - "children": [ - { - "type": "function", - "name": "clone" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "Boolean", - "name": "insert", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided).", - "children": [ - { - "type": "function", - "name": "cloneOnFile" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "String", - "name": "fileName", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Generates a clone of the provided function on a new file (with the provided join point).", - "children": [ - { - "type": "function", - "name": "cloneOnFile" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "file", - "name": "fileName", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "joinpoint", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts code as a literal statement before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Creates a new call to this function", - "children": [ - { - "type": "call", - "name": "newCall" - }, - { - "type": "joinpoint[]", - "name": "args", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the body of the function", - "children": [ - { - "type": "void", - "name": "setBody" - }, - { - "type": "scope", - "name": "body", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of the function", - "children": [ - { - "type": "void", - "name": "setFunctionType" - }, - { - "type": "functionType", - "name": "functionType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameter of the function at the given position", - "children": [ - { - "type": "void", - "name": "setParam" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "param", - "name": "param", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameter of the function at the given position", - "children": [ - { - "type": "void", - "name": "setParam" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a parameter of the function", - "children": [ - { - "type": "void", - "name": "setParamType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "newType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameters of the function", - "children": [ - { - "type": "void", - "name": "setParams" - }, - { - "type": "param[]", - "name": "params", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload that accepts strings that represent type-varname pairs (e.g., int param1)", - "children": [ - { - "type": "void", - "name": "setParamsFromStrings" - }, - { - "type": "String[]", - "name": "params", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the return type of the function", - "children": [ - { - "type": "void", - "name": "setReturnType" - }, - { - "type": "type", - "name": "returnType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise.", - "children": [ - { - "type": "boolean", - "name": "setStorageClass" - }, - { - "type": "StorageClass", - "name": "storageClass", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "functionType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "paramTypes" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a parameter of the FunctionType. Be careful that if you directly change the type of a paramemter and the function type is associated with a function declaration, this change will not be reflected in the function. If you want to change the type of a parameter of a function declaration, use $function.setParaType", - "children": [ - { - "type": "void", - "name": "setParamType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "newType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the return type of the FunctionType", - "children": [ - { - "type": "void", - "name": "setReturnType" - }, - { - "type": "type", - "name": "newType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "gotoStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "labelDecl", - "name": "label" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "sets the label of the goto", - "children": [ - { - "type": "void", - "name": "setLabel" - }, - { - "type": "labelDecl", - "name": "label", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "if", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "cond" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "condDecl" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "else" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "then" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "cond" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "condDecl" - }, - { - "type": "select", - "clazz": "scope", - "alias": "then" - }, - { - "type": "select", - "clazz": "scope", - "alias": "else" - }, - { - "type": "select", - "clazz": "scope", - "alias": "body" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "sets the condition of the if", - "children": [ - { - "type": "void", - "name": "setCond" - }, - { - "type": "expression", - "name": "cond", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "sets the body of the else", - "children": [ - { - "type": "void", - "name": "setElse" - }, - { - "type": "statement", - "name": "else", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "sets the body of the if", - "children": [ - { - "type": "void", - "name": "setThen" - }, - { - "type": "statement", - "name": "then", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "implicitValue", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "include", - "defaultAttr": "name", - "extends": "decl" , - "tooltip": "Represents an include directive (e.g., #include )", - "children": [ - { - "type": "attribute", - "tooltip": "true if this is an angled include (i.e., system include)", - "children": [ - { - "type": "Boolean", - "name": "isAngled" - }] - }, - { - "type": "attribute", - "tooltip": "the name of the include", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "the path to the folder of the source file of the include, relative to the name of the include", - "children": [ - { - "type": "String", - "name": "relativeFolderpath" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "incompleteArrayType", - "extends": "arrayType" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "elementType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the element type of the array", - "children": [ - { - "type": "void", - "name": "setElementType" - }, - { - "type": "type", - "name": "arrayElementType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "initList", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "[May be undefined] If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements", - "children": [ - { - "type": "expression", - "name": "arrayFiller" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "intLiteral", - "extends": "literal" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Long", - "name": "value" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "labelDecl", - "defaultAttr": "name", - "extends": "namedDecl" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "labelStmt", - "name": "labelStmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "labelStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "labelDecl", - "name": "decl" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "sets the label of the label statement", - "children": [ - { - "type": "void", - "name": "setDecl" - }, - { - "type": "labelDecl", - "name": "label", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "literal", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "loop", - "defaultAttr": "kind", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "body" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop condition", - "children": [ - { - "type": "statement", - "name": "cond" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Relation", - "name": "condRelation" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "controlVar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "varref", - "name": "controlVarref" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the last value of the control variable (e.g. 'length' in 'i < length;')", - "children": [ - { - "type": "String", - "name": "endValue" - }] - }, - { - "type": "attribute", - "tooltip": "True if the condition of the loop in the canonical format, and is one of: <, <=, >, >=", - "children": [ - { - "type": "Boolean", - "name": "hasCondRelation" - }] - }, - { - "type": "attribute", - "tooltip": "Uniquely identifies the loop inside the program", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop initialization", - "children": [ - { - "type": "statement", - "name": "init" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;')", - "children": [ - { - "type": "String", - "name": "initValue" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isInnermost" - }] - }, - { - "type": "attribute", - "tooltip": "Tests whether the loops are interchangeable. This is a conservative test.", - "children": [ - { - "type": "Boolean", - "name": "isInterchangeable" - }, - { - "type": "loop", - "name": "otherLoop", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isOutermost" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isParallel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "iterations" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "iterationsExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[for| while| dowhile| foreach]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "nestedLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "rank" - }] - }, - { - "type": "attribute", - "tooltip": "The statement of the loop step", - "children": [ - { - "type": "statement", - "name": "step" - }] - }, - { - "type": "attribute", - "tooltip": "The expression of the iteration step", - "children": [ - { - "type": "String", - "name": "stepValue" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "statement", - "alias": "init" - }, - { - "type": "select", - "clazz": "statement", - "alias": "cond" - }, - { - "type": "select", - "clazz": "statement", - "alias": "step" - }, - { - "type": "select", - "clazz": "scope", - "alias": "body" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Interchanges two for loops, if possible", - "children": [ - { - "type": "void", - "name": "interchange" - }, - { - "type": "loop", - "name": "otherLoop", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the body of the loop", - "children": [ - { - "type": "void", - "name": "setBody" - }, - { - "type": "scope", - "name": "body", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the conditional statement of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setCond" - }, - { - "type": "String", - "name": "condCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge", - "children": [ - { - "type": "void", - "name": "setCondRelation" - }, - { - "type": "Relation", - "name": "operator", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the end value of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setEndValue" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the init statement of the loop", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the init value of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setInitValue" - }, - { - "type": "String", - "name": "initCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the attribute 'isParallel' of the loop", - "children": [ - { - "type": "void", - "name": "setIsParallel" - }, - { - "type": "Boolean", - "name": "isParallel", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the kind of the loop", - "children": [ - { - "type": "void", - "name": "setKind" - }, - { - "type": "String", - "name": "kind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the step statement of the loop. Works with loops of kind 'for'", - "children": [ - { - "type": "void", - "name": "setStep" - }, - { - "type": "String", - "name": "stepCode", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Applies loop tiling to this loop.", - "children": [ - { - "type": "statement", - "name": "tile" - }, - { - "type": "String", - "name": "blockSize", - "defaultValue": "" - }, - { - "type": "statement", - "name": "reference", - "defaultValue": "" - }, - { - "type": "Boolean", - "name": "useTernary", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "marker", - "defaultAttr": "id", - "extends": "pragma" , - "tooltip": "Special pragma that can be used to mark scopes (e.g., #pragma lara marker loop1)", - "children": [ - { - "type": "attribute", - "tooltip": "A scope, associated with this marker", - "children": [ - { - "type": "joinpoint", - "name": "contents" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "Everything that is after the name of the pragma", - "children": [ - { - "type": "String", - "name": "content" - }] - }, - { - "type": "attribute", - "tooltip": "All the nodes below the target node, including the target node, up until a pragma with the name given by argument 'endPragma'. If no end pragma is found, returns the same result as if not providing the argument", - "children": [ - { - "type": "joinpoint[]", - "name": "getTargetNodes" - }, - { - "type": "String", - "name": "endPragma", - "defaultValue": "null" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the pragma. E.g. for #pragma foo bar, returns 'foo'", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations", - "children": [ - { - "type": "joinpoint", - "name": "target" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "scope", - "alias": "contents" - }, - { - "type": "select", - "clazz": "joinpoint", - "alias": "target" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setContent" - }, - { - "type": "String", - "name": "content", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "memberAccess", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "true if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar)", - "children": [ - { - "type": "Boolean", - "name": "arrow" - }] - }, - { - "type": "attribute", - "tooltip": "expression of the base of this member access", - "children": [ - { - "type": "expression", - "name": "base" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression[]", - "name": "memberChain" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "memberChainNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArrow" - }, - { - "type": "Boolean", - "name": "isArrow", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "memberCall", - "defaultAttr": "name", - "extends": "call" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "base" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "rootBase" - }] - }, - { - "type": "attribute", - "tooltip": "an alias for 'args'", - "children": [ - { - "type": "expression[]", - "name": "argList" - }] - }, - { - "type": "attribute", - "tooltip": "an array with the arguments of the call", - "children": [ - { - "type": "expression[]", - "name": "args" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found", - "children": [ - { - "type": "function", - "name": "declaration" - }] - }, - { - "type": "attribute", - "tooltip": "a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found", - "children": [ - { - "type": "function", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function)", - "children": [ - { - "type": "function", - "name": "directCallee" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration", - "children": [ - { - "type": "function", - "name": "function" - }] - }, - { - "type": "attribute", - "tooltip": "the function type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "getArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isMemberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "boolean", - "name": "isStmtCall" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "memberAccess", - "name": "memberAccess" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "memberNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "numArgs" - }] - }, - { - "type": "attribute", - "tooltip": "the return type of the call", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "callee" - }, - { - "type": "select", - "clazz": "expression", - "alias": "arg" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "argCode", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds an argument at the end of the call, creating a literal 'type' from the type string", - "children": [ - { - "type": "void", - "name": "addArg" - }, - { - "type": "String", - "name": "arg", - "defaultValue": "" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Tries to inline this call", - "children": [ - { - "type": "boolean", - "name": "inline" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArg" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "expression", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArgFromString" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "expr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes the name of the call", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Wraps this call with a possibly new wrapping function", - "children": [ - { - "type": "void", - "name": "wrap" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "method", - "defaultAttr": "name", - "extends": "function" , - "tooltip": "Represents a C++ class method declaration or definition", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "class", - "name": "record" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "scope", - "name": "body" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "call[]", - "name": "calls" - }] - }, - { - "type": "attribute", - "tooltip": "Function join points can either represent declarations or definitions, returns the definition of this function, if present, or the first declaration, if only declarations are present", - "children": [ - { - "type": "function", - "name": "canonical" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first prototype of this function that could be found, or undefined if there is none", - "children": [ - { - "type": "function", - "name": "declarationJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the prototypes of this function that are present in the code. If there are none, returns an empty array", - "children": [ - { - "type": "function[]", - "name": "declarationJps" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the implementation of this function if there is one, or undefined otherwise", - "children": [ - { - "type": "function", - "name": "definitionJp" - }] - }, - { - "type": "attribute", - "tooltip": "the type of the call, which includes the return type and the types of the parameters", - "children": [ - { - "type": "functionType", - "name": "functionType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "getDeclaration" - }, - { - "type": "Boolean", - "name": "withReturnType", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Use .isImplementation instead] True if this particular function join point has a body, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasDefinition" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this is the function returned by the 'canonical' attribute", - "children": [ - { - "type": "Boolean", - "name": "isCanonical" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isCudaKernel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isDelete" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular function join point is an implementation (i.e. has a body), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isImplementation" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isInline" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isModulePrivate" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular function join point is a prototype (i.e. does not have a body), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isPrototype" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPure" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isVirtual" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "paramNames" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "param[]", - "name": "params" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "returnType" - }] - }, - { - "type": "attribute", - "tooltip": "a string with the signature of this function (e.g., name of the function, plus the parameters types)", - "children": [ - { - "type": "String", - "name": "signature" - }] - }, - { - "type": "attribute", - "tooltip": "The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC)", - "children": [ - { - "type": "StorageClass", - "name": "storageClass" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "body", - "alias": "" - }, - { - "type": "select", - "clazz": "param", - "alias": "" - }, - { - "type": "select", - "clazz": "decl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Removes the of the method", - "children": [ - { - "type": "void", - "name": "removeRecord" - }] - }, - { - "type": "action", - "tooltip": "Adds a new parameter to the function", - "children": [ - { - "type": "void", - "name": "addParam" - }, - { - "type": "param", - "name": "param", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a new parameter to the function", - "children": [ - { - "type": "void", - "name": "addParam" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class", - "children": [ - { - "type": "function", - "name": "clone" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "Boolean", - "name": "insert", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided).", - "children": [ - { - "type": "function", - "name": "cloneOnFile" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "String", - "name": "fileName", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Generates a clone of the provided function on a new file (with the provided join point).", - "children": [ - { - "type": "function", - "name": "cloneOnFile" - }, - { - "type": "String", - "name": "newName", - "defaultValue": "" - }, - { - "type": "file", - "name": "fileName", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "joinpoint", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts code as a literal statement before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Creates a new call to this function", - "children": [ - { - "type": "call", - "name": "newCall" - }, - { - "type": "joinpoint[]", - "name": "args", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the body of the function", - "children": [ - { - "type": "void", - "name": "setBody" - }, - { - "type": "scope", - "name": "body", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of the function", - "children": [ - { - "type": "void", - "name": "setFunctionType" - }, - { - "type": "functionType", - "name": "functionType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameter of the function at the given position", - "children": [ - { - "type": "void", - "name": "setParam" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "param", - "name": "param", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameter of the function at the given position", - "children": [ - { - "type": "void", - "name": "setParam" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "type", - "name": "type", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a parameter of the function", - "children": [ - { - "type": "void", - "name": "setParamType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "newType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the parameters of the function", - "children": [ - { - "type": "void", - "name": "setParams" - }, - { - "type": "param[]", - "name": "params", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload that accepts strings that represent type-varname pairs (e.g., int param1)", - "children": [ - { - "type": "void", - "name": "setParamsFromStrings" - }, - { - "type": "String[]", - "name": "params", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the return type of the function", - "children": [ - { - "type": "void", - "name": "setReturnType" - }, - { - "type": "type", - "name": "returnType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise.", - "children": [ - { - "type": "boolean", - "name": "setStorageClass" - }, - { - "type": "StorageClass", - "name": "storageClass", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "namedDecl", - "defaultAttr": "name", - "extends": "decl" , - "tooltip": "Represents a decl with a name", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "newExpr", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "omp", - "defaultAttr": "kind", - "extends": "pragma" , - "tooltip": "Represents an OpenMP pragma (e.g., #pragma omp parallel)", - "children": [ - { - "type": "attribute", - "tooltip": "The names of the kinds of all clauses in the pragma, or empty array if no clause is defined", - "children": [ - { - "type": "String[]", - "name": "clauseKinds" - }] - }, - { - "type": "attribute", - "tooltip": "An integer expression, or undefined if no 'collapse' clause is defined", - "children": [ - { - "type": "String", - "name": "collapse" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names of all copyin clauses, or empty array if no copyin clause is defined", - "children": [ - { - "type": "String[]", - "name": "copyin" - }] - }, - { - "type": "attribute", - "tooltip": "One of 'shared' or 'none', or undefined if no 'default' clause is defined", - "children": [ - { - "type": "String", - "name": "default" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names of all firstprivate clauses, or empty array if no firstprivate clause is defined", - "children": [ - { - "type": "String[]", - "name": "firstprivate" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names for the given reduction kind, or empty array if no reduction of that kind is defined", - "children": [ - { - "type": "String[]", - "name": "getReduction" - }, - { - "type": "String", - "name": "kind", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "True if the directive has at least one clause of the given clause kind, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasClause" - }, - { - "type": "String", - "name": "clauseName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "True if it is legal to use the given clause kind in this directive, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isClauseLegal" - }, - { - "type": "String", - "name": "clauseName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The kind of the directive", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names of all lastprivate clauses, or empty array if no lastprivate clause is defined", - "children": [ - { - "type": "String[]", - "name": "lastprivate" - }] - }, - { - "type": "attribute", - "tooltip": "An integer expression, or undefined if no 'num_threads' clause is defined", - "children": [ - { - "type": "String", - "name": "numThreads" - }] - }, - { - "type": "attribute", - "tooltip": "An integer expression, or undefined if no 'ordered' clause with a parameter is defined", - "children": [ - { - "type": "String", - "name": "ordered" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names of all private clauses, or empty array if no private clause is defined", - "children": [ - { - "type": "String[]", - "name": "private" - }] - }, - { - "type": "attribute", - "tooltip": "One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined", - "children": [ - { - "type": "String", - "name": "procBind" - }] - }, - { - "type": "attribute", - "tooltip": "The reduction kinds in the reductions clauses of the this pragma, or empty array if no reduction is defined", - "children": [ - { - "type": "String[]", - "name": "reductionKinds" - }] - }, - { - "type": "attribute", - "tooltip": "An integer expression, or undefined if no 'schedule' clause with chunk size is defined", - "children": [ - { - "type": "String", - "name": "scheduleChunkSize" - }] - }, - { - "type": "attribute", - "tooltip": "One of 'static', 'dynamic', 'guided', 'auto' or 'runtime', or undefined if no 'schedule' clause is defined", - "children": [ - { - "type": "String", - "name": "scheduleKind" - }] - }, - { - "type": "attribute", - "tooltip": "A list with possible values of 'monotonic', 'nonmonotonic' or 'simd', or undefined if no 'schedule' clause with modifiers is defined", - "children": [ - { - "type": "String[]", - "name": "scheduleModifiers" - }] - }, - { - "type": "attribute", - "tooltip": "The variable names of all shared clauses, or empty array if no shared clause is defined", - "children": [ - { - "type": "String[]", - "name": "shared" - }] - }, - { - "type": "attribute", - "tooltip": "Everything that is after the name of the pragma", - "children": [ - { - "type": "String", - "name": "content" - }] - }, - { - "type": "attribute", - "tooltip": "All the nodes below the target node, including the target node, up until a pragma with the name given by argument 'endPragma'. If no end pragma is found, returns the same result as if not providing the argument", - "children": [ - { - "type": "joinpoint[]", - "name": "getTargetNodes" - }, - { - "type": "String", - "name": "endPragma", - "defaultValue": "null" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the pragma. E.g. for #pragma foo bar, returns 'foo'", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations", - "children": [ - { - "type": "joinpoint", - "name": "target" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "joinpoint", - "alias": "target" - }, - { - "type": "action", - "tooltip": "Removes any clause of the given kind from the OpenMP pragma", - "children": [ - { - "type": "void", - "name": "removeClause" - }, - { - "type": "String", - "name": "clauseKind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the collapse clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setCollapse" - }, - { - "type": "String", - "name": "newExpr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the collapse clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setCollapse" - }, - { - "type": "int", - "name": "newExpr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables of a copyin clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setCopyin" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the default clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setDefault" - }, - { - "type": "String", - "name": "newDefault", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables of a firstprivate clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setFirstprivate" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the directive kind of the OpenMP pragma. Any unsupported clauses will be discarded", - "children": [ - { - "type": "void", - "name": "setKind" - }, - { - "type": "String", - "name": "directiveKind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables of a lastprivate clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setLastprivate" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the num_threads clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setNumThreads" - }, - { - "type": "String", - "name": "newExpr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the ordered clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setOrdered" - }, - { - "type": "String", - "name": "parameters", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables of a private clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setPrivate" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the proc_bind clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setProcBind" - }, - { - "type": "String", - "name": "newBind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables for a given kind of a reduction clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setReduction" - }, - { - "type": "String", - "name": "kind", - "defaultValue": "" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception", - "children": [ - { - "type": "void", - "name": "setScheduleChunkSize" - }, - { - "type": "String", - "name": "chunkSize", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception", - "children": [ - { - "type": "void", - "name": "setScheduleChunkSize" - }, - { - "type": "int", - "name": "chunkSize", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the schedule clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setScheduleKind" - }, - { - "type": "String", - "name": "scheduleKind", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value of the modifiers in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception", - "children": [ - { - "type": "void", - "name": "setScheduleModifiers" - }, - { - "type": "String[]", - "name": "modifiers", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the variables of a shared clause of an OpenMP pragma", - "children": [ - { - "type": "void", - "name": "setShared" - }, - { - "type": "String[]", - "name": "newVariables", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setContent" - }, - { - "type": "String", - "name": "content", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "op", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBitwise" - }] - }, - { - "type": "attribute", - "tooltip": "The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary'", - "children": [ - { - "type": "[ptr_mem_d| ptr_mem_i| mul| div| rem| add| sub| shl| shr| cmp| lt| gt| le| ge| eq| ne| and| xor| or| l_and| l_or| assign| mul_assign| div_assign| rem_assign| add_assign| sub_assign| shl_assign| shr_assign| and_assign| xor_assign| or_assign| comma| post_inc| post_dec| pre_inc| pre_dec| addr_of| deref| plus| minus| not| l_not| real| imag| extension| cowait| ternary]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "operator" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "param", - "defaultAttr": "name", - "extends": "vardecl" , - "children": [ - { - "type": "attribute", - "tooltip": "The vardecl corresponding to the actual definition. For global variables, returns the vardecl of the file where it is actually defined (instead of the vardecl that defines an external link to the variable)", - "children": [ - { - "type": "vardecl", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "true, if vardecl has an initialization value", - "children": [ - { - "type": "Boolean", - "name": "hasInit" - }] - }, - { - "type": "attribute", - "tooltip": "If vardecl has an initialization value, returns an expression with that value", - "children": [ - { - "type": "expression", - "name": "init" - }] - }, - { - "type": "attribute", - "tooltip": "The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit", - "children": [ - { - "type": "String", - "name": "initStyle" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this variable does not have local storage. This includes all global variables as well as static variables declared within a function.", - "children": [ - { - "type": "Boolean", - "name": "isGlobal" - }] - }, - { - "type": "attribute", - "tooltip": "true, if vardecl is a function parameter", - "children": [ - { - "type": "Boolean", - "name": "isParam" - }] - }, - { - "type": "attribute", - "tooltip": "Storage class specifier, which can be none, extern, static, __private_extern__, auto, register", - "children": [ - { - "type": "StorageClass", - "name": "storageClass" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "init" - }, - { - "type": "action", - "tooltip": "If vardecl already has an initialization, removes it.", - "children": [ - { - "type": "void", - "name": "removeInit" - }, - { - "type": "boolean", - "name": "removeConst", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "expression", - "name": "init", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Converts the given string to a literal expression and sets it as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "String", - "name": "init", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl", - "children": [ - { - "type": "void", - "name": "setStorageClass" - }, - { - "type": "StorageClass", - "name": "storageClass", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Creates a new varref based on this vardecl", - "children": [ - { - "type": "varref", - "name": "varref" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "parenExpr", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "Returns the expression inside this parenthesis expression", - "children": [ - { - "type": "expression", - "name": "subExpr" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "parenType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "innerType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the inner type of this paren type", - "children": [ - { - "type": "void", - "name": "setInnerType" - }, - { - "type": "type", - "name": "innerType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "pointerType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "pointee" - }] - }, - { - "type": "attribute", - "tooltip": "Number of pointer levels from this pointer", - "children": [ - { - "type": "int", - "name": "pointerLevels" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the pointee type of this pointer type", - "children": [ - { - "type": "void", - "name": "setPointee" - }, - { - "type": "type", - "name": "pointeeType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "pragma", - "defaultAttr": "name", - "extends": "joinpoint" , - "tooltip": "Represents a pragma in the code (e.g., #pragma kernel)", - "children": [ - { - "type": "attribute", - "tooltip": "Everything that is after the name of the pragma", - "children": [ - { - "type": "String", - "name": "content" - }] - }, - { - "type": "attribute", - "tooltip": "All the nodes below the target node, including the target node, up until a pragma with the name given by argument 'endPragma'. If no end pragma is found, returns the same result as if not providing the argument", - "children": [ - { - "type": "joinpoint[]", - "name": "getTargetNodes" - }, - { - "type": "String", - "name": "endPragma", - "defaultValue": "null" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the pragma. E.g. for #pragma foo bar, returns 'foo'", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations", - "children": [ - { - "type": "joinpoint", - "name": "target" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "joinpoint", - "alias": "target" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setContent" - }, - { - "type": "String", - "name": "content", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "program", - "defaultAttr": "name", - "extends": "joinpoint" , - "tooltip": "Represents the complete program and is the top-most joinpoint in the hierarchy", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "baseFolder" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "defaultFlags" - }] - }, - { - "type": "attribute", - "tooltip": "paths to includes that the current program depends on", - "children": [ - { - "type": "String[]", - "name": "extraIncludes" - }] - }, - { - "type": "attribute", - "tooltip": "link libraries of external projects the current program depends on", - "children": [ - { - "type": "String[]", - "name": "extraLibs" - }] - }, - { - "type": "attribute", - "tooltip": "paths to folders of projects that the current program depends on", - "children": [ - { - "type": "String[]", - "name": "extraProjects" - }] - }, - { - "type": "attribute", - "tooltip": "paths to sources that the current program depends on", - "children": [ - { - "type": "String[]", - "name": "extraSources" - }] - }, - { - "type": "attribute", - "tooltip": "the source files in this program", - "children": [ - { - "type": "file[]", - "name": "files" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "includeFolders" - }] - }, - { - "type": "attribute", - "tooltip": "true if the program was compiled with a C++ standard", - "children": [ - { - "type": "Boolean", - "name": "isCxx" - }] - }, - { - "type": "attribute", - "tooltip": "a function join point with the main function of the program, if one is available", - "children": [ - { - "type": "function", - "name": "main" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the standard (e.g., c99, c++11)", - "children": [ - { - "type": "String", - "name": "standard" - }] - }, - { - "type": "attribute", - "tooltip": "The flag of the standard (e.g., -std=c++11)", - "children": [ - { - "type": "String", - "name": "stdFlag" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "userFlags" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "weavingFolder" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "file", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a path to an include that the current program depends on", - "children": [ - { - "type": "void", - "name": "addExtraInclude" - }, - { - "type": "String", - "name": "path", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a path based on a git repository to an include that the current program depends on", - "children": [ - { - "type": "void", - "name": "addExtraIncludeFromGit" - }, - { - "type": "String", - "name": "gitRepo", - "defaultValue": "" - }, - { - "type": "String", - "name": "path", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds a library (e.g., -pthreads) that the current program depends on", - "children": [ - { - "type": "void", - "name": "addExtraLib" - }, - { - "type": "String", - "name": "lib", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a path to a source that the current program depends on", - "children": [ - { - "type": "void", - "name": "addExtraSource" - }, - { - "type": "String", - "name": "path", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a path based on a git repository to a source that the current program depends on", - "children": [ - { - "type": "void", - "name": "addExtraSourceFromGit" - }, - { - "type": "String", - "name": "gitRepo", - "defaultValue": "" - }, - { - "type": "String", - "name": "path", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Adds a file join point to the current program", - "children": [ - { - "type": "joinpoint", - "name": "addFile" - }, - { - "type": "file", - "name": "file", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a file join point to the current program, from the given path, which can be either a Java File or a String", - "children": [ - { - "type": "joinpoint", - "name": "addFileFromPath" - }, - { - "type": "Object", - "name": "filepath", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a path based on a git repository to a project that the current program depends on", - "children": [ - { - "type": "void", - "name": "addProjectFromGit" - }, - { - "type": "String", - "name": "gitRepo", - "defaultValue": "" - }, - { - "type": "String[]", - "name": "libs", - "defaultValue": "" - }, - { - "type": "String", - "name": "path", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "Registers a function to be executed when the program exits", - "children": [ - { - "type": "void", - "name": "atexit" - }, - { - "type": "function", - "name": "function", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Discards the AST at the top of the ASt stack", - "children": [ - { - "type": "void", - "name": "pop" - }] - }, - { - "type": "action", - "tooltip": "Creates a copy of the current AST and pushes it to the top of the AST stack", - "children": [ - { - "type": "void", - "name": "push" - }] - }, - { - "type": "action", - "tooltip": "Recompiles the program currently represented by the AST, transforming literal code into AST nodes. Returns true if all files could be parsed correctly, or false otherwise", - "children": [ - { - "type": "boolean", - "name": "rebuild" - }] - }, - { - "type": "action", - "tooltip": "Similar to rebuild, but tries to fix compilation errors. Resulting program may not represent the originally intended functionality", - "children": [ - { - "type": "void", - "name": "rebuildFuzzy" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "qualType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "qualifiers" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "unqualifiedType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "record", - "defaultAttr": "name", - "extends": "namedDecl" , - "tooltip": "Common class of struct, union and class", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "field[]", - "name": "fields" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "function[]", - "name": "functions" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is an implementation (i.e. has its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isImplementation" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isPrototype" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "field", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a field to a record (struct, class).", - "children": [ - { - "type": "void", - "name": "addField" - }, - { - "type": "field", - "name": "field", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "returnStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "returnExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "returnExpr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "scope", - "extends": "statement" , - "tooltip": "Represents a group of statements", - "children": [ - { - "type": "attribute", - "tooltip": "Returns the descendant statements of this scope, excluding other scopes, loops, ifs and wrapper statements", - "children": [ - { - "type": "statement[]", - "name": "allStmts" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "statement", - "name": "firstStmt" - }] - }, - { - "type": "attribute", - "tooltip": "The number of statements in the scope, including the statements inside the declaration and bodies of structures such as ifs and loops, and not considering comments and pragmas. If flat is true, does not consider the statements inside structures such as ifs and loops (e.g., a loop counts as one statement)", - "children": [ - { - "type": "Long", - "name": "getNumStatements" - }, - { - "type": "Boolean", - "name": "flat", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "statement", - "name": "lastStmt" - }] - }, - { - "type": "attribute", - "tooltip": "true if the scope does not have curly braces", - "children": [ - { - "type": "Boolean", - "name": "naked" - }] - }, - { - "type": "attribute", - "tooltip": "The statement that owns the scope (e.g., function, loop...)", - "children": [ - { - "type": "joinpoint", - "name": "owner" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the direct (children) statements of this scope", - "children": [ - { - "type": "statement[]", - "name": "stmts" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "statement", - "alias": "stmt" - }, - { - "type": "select", - "clazz": "statement", - "alias": "childStmt" - }, - { - "type": "select", - "clazz": "scope", - "alias": "" - }, - { - "type": "select", - "clazz": "if", - "alias": "" - }, - { - "type": "select", - "clazz": "loop", - "alias": "" - }, - { - "type": "select", - "clazz": "pragma", - "alias": "" - }, - { - "type": "select", - "clazz": "marker", - "alias": "" - }, - { - "type": "select", - "clazz": "tag", - "alias": "" - }, - { - "type": "select", - "clazz": "omp", - "alias": "" - }, - { - "type": "select", - "clazz": "comment", - "alias": "" - }, - { - "type": "select", - "clazz": "returnStmt", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkFor", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSync", - "alias": "" - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a new local variable to this scope", - "children": [ - { - "type": "joinpoint", - "name": "addLocal" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }, - { - "type": "joinpoint", - "name": "type", - "defaultValue": "" - }, - { - "type": "String", - "name": "initValue", - "defaultValue": "null" - }] - }, - { - "type": "action", - "tooltip": "CFG tester", - "children": [ - { - "type": "String", - "name": "cfg" - }] - }, - { - "type": "action", - "tooltip": "Clears the contents of this scope (untested)", - "children": [ - { - "type": "void", - "name": "clear" - }] - }, - { - "type": "action", - "tooltip": "DFG tester", - "children": [ - { - "type": "String", - "name": "dfg" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertBegin" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertBegin" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertEnd" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "joinpoint", - "name": "insertEnd" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "joinpoint", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node", - "children": [ - { - "type": "joinpoint", - "name": "insertReturn" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces)", - "children": [ - { - "type": "void", - "name": "setNaked" - }, - { - "type": "Boolean", - "name": "isNaked", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "statement", - "extends": "joinpoint" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "struct", - "defaultAttr": "name", - "extends": "record" , - "tooltip": "Represets a struct declaration", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "field[]", - "name": "fields" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "function[]", - "name": "functions" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is an implementation (i.e. has its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isImplementation" - }] - }, - { - "type": "attribute", - "tooltip": "true if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise", - "children": [ - { - "type": "Boolean", - "name": "isPrototype" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "field", - "alias": "" - }, - { - "type": "action", - "tooltip": "Adds a field to a record (struct, class).", - "children": [ - { - "type": "void", - "name": "addField" - }, - { - "type": "field", - "name": "field", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "switch", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "tooltip": "the case statements inside this switch", - "children": [ - { - "type": "case[]", - "name": "cases" - }] - }, - { - "type": "attribute", - "tooltip": "the condition of this switch statement", - "children": [ - { - "type": "expression", - "name": "condition" - }] - }, - { - "type": "attribute", - "tooltip": "the default case statement of this switch statement or undefined if it does not have a default case", - "children": [ - { - "type": "case", - "name": "getDefaultCase" - }] - }, - { - "type": "attribute", - "tooltip": "true if there is a default case in this switch statement, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasDefaultCase" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "switchCase", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "tag", - "defaultAttr": "id", - "extends": "pragma" , - "tooltip": "A pragma that references a point in the code and sticks to it", - "children": [ - { - "type": "attribute", - "tooltip": "The ID of the pragma", - "children": [ - { - "type": "String", - "name": "id" - }] - }, - { - "type": "attribute", - "tooltip": "Everything that is after the name of the pragma", - "children": [ - { - "type": "String", - "name": "content" - }] - }, - { - "type": "attribute", - "tooltip": "All the nodes below the target node, including the target node, up until a pragma with the name given by argument 'endPragma'. If no end pragma is found, returns the same result as if not providing the argument", - "children": [ - { - "type": "joinpoint[]", - "name": "getTargetNodes" - }, - { - "type": "String", - "name": "endPragma", - "defaultValue": "null" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the pragma. E.g. for #pragma foo bar, returns 'foo'", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations", - "children": [ - { - "type": "joinpoint", - "name": "target" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "joinpoint", - "alias": "target" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setContent" - }, - { - "type": "String", - "name": "content", - "defaultValue": "" - }] - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "tagType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration of this tag type", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "templateSpecializationType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "args" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "firstArgType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "numArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "templateName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "ternaryOp", - "extends": "op" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "cond" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "falseExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "trueExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBitwise" - }] - }, - { - "type": "attribute", - "tooltip": "The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary'", - "children": [ - { - "type": "[ptr_mem_d| ptr_mem_i| mul| div| rem| add| sub| shl| shr| cmp| lt| gt| le| ge| eq| ne| and| xor| or| l_and| l_or| assign| mul_assign| div_assign| rem_assign| add_assign| sub_assign| shl_assign| shr_assign| and_assign| xor_assign| or_assign| comma| post_inc| post_dec| pre_inc| pre_dec| addr_of| deref| plus| minus| not| l_not| real| imag| extension| cowait| ternary]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "operator" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "cond" - }, - { - "type": "select", - "clazz": "expression", - "alias": "trueExpr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "falseExpr" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "this", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "type", - "extends": "joinpoint" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "typedefDecl", - "defaultAttr": "name", - "extends": "typedefNameDecl" , - "tooltip": "Declaration of a typedef-name via the 'typedef' type specifier", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "typedefNameDecl", - "defaultAttr": "name", - "extends": "namedDecl" , - "tooltip": "Base node for declarations which introduce a typedef-name", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "typedefType", - "extends": "type" , - "tooltip": "Represents the type of a typedef.", - "children": [ - { - "type": "attribute", - "tooltip": "the typedef declaration associated with this typedef type", - "children": [ - { - "type": "typedefNameDecl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "the type that is being typedef'd", - "children": [ - { - "type": "type", - "name": "underlyingType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "unaryExprOrType", - "extends": "expression" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "argExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "argType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasArgExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTypeExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setArgType" - }, - { - "type": "type", - "name": "argType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "unaryOp", - "extends": "op" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointerDeref" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "operand" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBitwise" - }] - }, - { - "type": "attribute", - "tooltip": "The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary'", - "children": [ - { - "type": "[ptr_mem_d| ptr_mem_i| mul| div| rem| add| sub| shl| shr| cmp| lt| gt| le| ge| eq| ne| and| xor| or| l_and| l_or| assign| mul_assign| div_assign| rem_assign| add_assign| sub_assign| shl_assign| shr_assign| and_assign| xor_assign| or_assign| comma| post_inc| post_dec| pre_inc| pre_dec| addr_of| deref| plus| minus| not| l_not| real| imag| extension| cowait| ternary]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "operator" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "operand" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "undefinedType", - "extends": "type" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "vardecl", - "defaultAttr": "name", - "extends": "declarator" , - "tooltip": "Represents a variable declaration or definition", - "children": [ - { - "type": "attribute", - "tooltip": "The vardecl corresponding to the actual definition. For global variables, returns the vardecl of the file where it is actually defined (instead of the vardecl that defines an external link to the variable)", - "children": [ - { - "type": "vardecl", - "name": "definition" - }] - }, - { - "type": "attribute", - "tooltip": "true, if vardecl has an initialization value", - "children": [ - { - "type": "Boolean", - "name": "hasInit" - }] - }, - { - "type": "attribute", - "tooltip": "If vardecl has an initialization value, returns an expression with that value", - "children": [ - { - "type": "expression", - "name": "init" - }] - }, - { - "type": "attribute", - "tooltip": "The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit", - "children": [ - { - "type": "String", - "name": "initStyle" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this variable does not have local storage. This includes all global variables as well as static variables declared within a function.", - "children": [ - { - "type": "Boolean", - "name": "isGlobal" - }] - }, - { - "type": "attribute", - "tooltip": "true, if vardecl is a function parameter", - "children": [ - { - "type": "Boolean", - "name": "isParam" - }] - }, - { - "type": "attribute", - "tooltip": "Storage class specifier, which can be none, extern, static, __private_extern__, auto, register", - "children": [ - { - "type": "StorageClass", - "name": "storageClass" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPublic" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedName" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "qualifiedPrefix" - }] - }, - { - "type": "attribute", - "tooltip": "The attributes (e.g. Pure, CUDAGlobal) associated to this decl", - "children": [ - { - "type": "attribute[]", - "name": "attrs" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "init" - }, - { - "type": "action", - "tooltip": "If vardecl already has an initialization, removes it.", - "children": [ - { - "type": "void", - "name": "removeInit" - }, - { - "type": "boolean", - "name": "removeConst", - "defaultValue": "true" - }] - }, - { - "type": "action", - "tooltip": "Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "expression", - "name": "init", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Converts the given string to a literal expression and sets it as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization", - "children": [ - { - "type": "void", - "name": "setInit" - }, - { - "type": "String", - "name": "init", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl", - "children": [ - { - "type": "void", - "name": "setStorageClass" - }, - { - "type": "StorageClass", - "name": "storageClass", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Creates a new varref based on this vardecl", - "children": [ - { - "type": "varref", - "name": "varref" - }] - }, - { - "type": "action", - "tooltip": "Sets the name of this namedDecl", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified name of this namedDecl (changes both the name and qualified prefix)", - "children": [ - { - "type": "void", - "name": "setQualifiedName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the qualified prefix of this namedDecl", - "children": [ - { - "type": "void", - "name": "setQualifiedPrefix" - }, - { - "type": "String", - "name": "qualifiedPrefix", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "variableArrayType", - "extends": "arrayType" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "expression", - "name": "sizeExpr" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "elementType" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int[]", - "name": "arrayDims" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "int", - "name": "arraySize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "constant" - }] - }, - { - "type": "attribute", - "tooltip": "Single-step desugar. Returns the type itself if it does not have sugar", - "children": [ - { - "type": "type", - "name": "desugar" - }] - }, - { - "type": "attribute", - "tooltip": "Completely desugars the type", - "children": [ - { - "type": "type", - "name": "desugarAll" - }] - }, - { - "type": "attribute", - "tooltip": "A tree representation of the fields of this type", - "children": [ - { - "type": "String", - "name": "fieldTree" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasSugar" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "hasTemplateArgs" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isArray" - }] - }, - { - "type": "attribute", - "tooltip": "True if this is a type declared with the 'auto' keyword", - "children": [ - { - "type": "Boolean", - "name": "isAuto" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isBuiltin" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isPointer" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isTopLevel" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "tooltip": "Ignores certain types (e.g., DecayedType)", - "children": [ - { - "type": "type", - "name": "normalize" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String[]", - "name": "templateArgsStrings" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type[]", - "name": "templateArgsTypes" - }] - }, - { - "type": "attribute", - "tooltip": "Maps names of join point fields that represent type join points, to their respective values", - "children": [ - { - "type": "Map", - "name": "typeFields" - }] - }, - { - "type": "attribute", - "tooltip": "If the type encapsulates another type, returns the encapsulated type", - "children": [ - { - "type": "type", - "name": "unwrap" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "action", - "tooltip": "Sets the size expression of this variable array type", - "children": [ - { - "type": "void", - "name": "setSizeExpr" - }, - { - "type": "expression", - "name": "sizeExpr", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the element type of the array", - "children": [ - { - "type": "void", - "name": "setElementType" - }, - { - "type": "type", - "name": "arrayElementType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Returns a new node based on this type with the qualifier const", - "children": [ - { - "type": "type", - "name": "asConst" - }] - }, - { - "type": "action", - "tooltip": "Sets the desugared type of this type", - "children": [ - { - "type": "void", - "name": "setDesugar" - }, - { - "type": "type", - "name": "desugaredType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets a single template argument type of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgType" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }, - { - "type": "type", - "name": "templateArgType", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the template argument types of a template type", - "children": [ - { - "type": "void", - "name": "setTemplateArgsTypes" - }, - { - "type": "type[]", - "name": "templateArgTypes", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change", - "children": [ - { - "type": "boolean", - "name": "setTypeFieldByValueRecursive" - }, - { - "type": "Object", - "name": "currentValue", - "defaultValue": "" - }, - { - "type": "Object", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes", - "children": [ - { - "type": "type", - "name": "setUnderlyingType" - }, - { - "type": "type", - "name": "oldValue", - "defaultValue": "" - }, - { - "type": "type", - "name": "newValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "varref", - "defaultAttr": "name", - "extends": "expression" , - "tooltip": "A reference to a variable", - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "declarator", - "name": "declaration" - }] - }, - { - "type": "attribute", - "tooltip": "true if this variable reference has a MS-style property, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasProperty" - }] - }, - { - "type": "attribute", - "tooltip": "true if this varref represents a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionCall" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "String", - "name": "name" - }] - }, - { - "type": "attribute", - "tooltip": "if this variable reference has a MS-style property, returns the property name. Returns undefined otherwise", - "children": [ - { - "type": "String", - "name": "property" - }] - }, - { - "type": "attribute", - "tooltip": "expression from where the attribute 'use' is calculated. In certain cases (e.g., array access, pointer dereference) the 'use' attribute is not calculated on the node itself, but on an ancestor of the node. This attribute returns that node", - "children": [ - { - "type": "expression", - "name": "useExpr" - }] - }, - { - "type": "attribute", - "tooltip": "a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none", - "children": [ - { - "type": "decl", - "name": "decl" - }] - }, - { - "type": "attribute", - "tooltip": "returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise", - "children": [ - { - "type": "cast", - "name": "implicitCast" - }] - }, - { - "type": "attribute", - "tooltip": "true if the expression is part of an argument of a function call", - "children": [ - { - "type": "Boolean", - "name": "isFunctionArgument" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[read| write| readwrite]", - "name": "use" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "vardecl", - "name": "vardecl" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "action", - "children": [ - { - "type": "void", - "name": "setName" - }, - { - "type": "String", - "name": "name", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "joinpoint", - "name": "wrapperStmt", - "extends": "statement" , - "children": [ - { - "type": "attribute", - "children": [ - { - "type": "joinpoint", - "name": "content" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "[comment| pragma]", - "name": "kind" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isFirst" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "Boolean", - "name": "isLast" - }] - }, - { - "type": "attribute", - "tooltip": "String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump'", - "children": [ - { - "type": "String", - "name": "ast" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, considering null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "astChildren" - }] - }, - { - "type": "attribute", - "tooltip": "String that uniquely identifies this node", - "children": [ - { - "type": "String", - "name": "astId" - }] - }, - { - "type": "attribute", - "tooltip": "true, if this node is a Java instance of the given name, which corresponds to a simple Java class name of an AST node. For an equivalent function for join point names, use 'instanceOf(joinPointName)'", - "children": [ - { - "type": "Boolean", - "name": "astIsInstance" - }, - { - "type": "String", - "name": "className", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the Java class of this node, which is similar to the equivalent node in Clang AST", - "children": [ - { - "type": "String", - "name": "astName" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, considering null nodes", - "children": [ - { - "type": "int", - "name": "astNumChildren" - }] - }, - { - "type": "attribute", - "tooltip": "The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit", - "children": [ - { - "type": "int", - "name": "bitWidth" - }] - }, - { - "type": "attribute", - "tooltip": "String list of the names of the join points that form a path from the root to this node", - "children": [ - { - "type": "String[]", - "name": "chain" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the children of the node, ignoring null nodes", - "children": [ - { - "type": "joinpoint[]", - "name": "children" - }] - }, - { - "type": "attribute", - "tooltip": "String with the code represented by this node", - "children": [ - { - "type": "String", - "name": "code" - }] - }, - { - "type": "attribute", - "tooltip": "The starting column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "column" - }] - }, - { - "type": "attribute", - "tooltip": "true if the given node is a descendant of this node", - "children": [ - { - "type": "Boolean", - "name": "contains" - }, - { - "type": "joinpoint", - "name": "jp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "currentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds.", - "children": [ - { - "type": "Object", - "name": "data" - }] - }, - { - "type": "attribute", - "tooltip": "the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc.", - "children": [ - { - "type": "int", - "name": "depth" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves all descendants of the join point", - "children": [ - { - "type": "joinpoint[]", - "name": "descendants" - }] - }, - { - "type": "attribute", - "tooltip": "The ending column of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endColumn" - }] - }, - { - "type": "attribute", - "tooltip": "The ending line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "endLine" - }] - }, - { - "type": "attribute", - "tooltip": "The name of the file where the code of this node is located, if available", - "children": [ - { - "type": "String", - "name": "filename" - }] - }, - { - "type": "attribute", - "tooltip": "the complete path to the file where the code of this node comes from", - "children": [ - { - "type": "String", - "name": "filepath" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the first child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "firstChild" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the AST", - "children": [ - { - "type": "joinpoint", - "name": "getAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: Looks for an ancestor AST name, walking back on the AST]", - "children": [ - { - "type": "joinpoint", - "name": "getAstAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, considering null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getAstChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks for an ancestor joinpoint name, walking back on the joinpoint chain", - "children": [ - { - "type": "joinpoint", - "name": "getChainAncestor" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the child of the node at the given index, ignoring null nodes", - "children": [ - { - "type": "joinpoint", - "name": "getChild" - }, - { - "type": "int", - "name": "index", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendants" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrieves the descendants of the given type, including the node itself", - "children": [ - { - "type": "joinpoint[]", - "name": "getDescendantsAndSelf" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Looks in the descendants for the first node of the given type", - "children": [ - { - "type": "joinpoint", - "name": "getFirstJp" - }, - { - "type": "String", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "String with the full Java class name of the type of the Java field with the provided name", - "children": [ - { - "type": "String", - "name": "getJavaFieldType" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Java Class instance with the type of the given key", - "children": [ - { - "type": "Object", - "name": "getKeyType" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "Retrives values that have been associated to nodes of the AST with 'setUserField'", - "children": [ - { - "type": "Object", - "name": "getUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "The value associated with the given property key", - "children": [ - { - "type": "Object", - "name": "getValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if the node has children, false otherwise", - "children": [ - { - "type": "Boolean", - "name": "hasChildren" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the given join point or AST node is the same (== test) as the current join point AST node", - "children": [ - { - "type": "Boolean", - "name": "hasNode" - }, - { - "type": "Object", - "name": "nodeOrJp", - "defaultValue": "" - }] - }, - { - "type": "attribute", - "tooltip": "true if this node has a parent", - "children": [ - { - "type": "boolean", - "name": "hasParent" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point has a type", - "children": [ - { - "type": "Boolean", - "name": "hasType" - }] - }, - { - "type": "attribute", - "tooltip": "Returns comments that are not explicitly in the AST, but embedded in other nodes", - "children": [ - { - "type": "comment[]", - "name": "inlineComments" - }] - }, - { - "type": "attribute", - "tooltip": "true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for)", - "children": [ - { - "type": "Boolean", - "name": "isCilk" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is part of a system header file", - "children": [ - { - "type": "Boolean", - "name": "isInSystemHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a header (e.g., if condition, for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true, if the join point is inside a loop header (e.g., for, while)", - "children": [ - { - "type": "Boolean", - "name": "isInsideLoopHeader" - }] - }, - { - "type": "attribute", - "tooltip": "true if any descendant or the node itself was defined as a macro", - "children": [ - { - "type": "Boolean", - "name": "isMacro" - }] - }, - { - "type": "attribute", - "tooltip": "[DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue'", - "children": [ - { - "type": "String[]", - "name": "javaFields" - }] - }, - { - "type": "attribute", - "tooltip": "List with the values of fields that are join points, recursively", - "children": [ - { - "type": "joinpoint[]", - "name": "jpFields" - }, - { - "type": "Boolean", - "name": "recursive", - "defaultValue": "false" - }] - }, - { - "type": "attribute", - "tooltip": "Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it)", - "children": [ - { - "type": "String", - "name": "jpId" - }] - }, - { - "type": "attribute", - "tooltip": "A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue'", - "children": [ - { - "type": "String[]", - "name": "keys" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the last child of this node, or undefined if it has no child", - "children": [ - { - "type": "joinpoint", - "name": "lastChild" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that came before this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "leftJp" - }] - }, - { - "type": "attribute", - "tooltip": "The starting line of the current node in the original code", - "children": [ - { - "type": "int", - "name": "line" - }] - }, - { - "type": "attribute", - "tooltip": "A string with information about the file and code position of this node, if available", - "children": [ - { - "type": "String", - "name": "location" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the number of children of the node, ignoring null nodes", - "children": [ - { - "type": "int", - "name": "numChildren" - }] - }, - { - "type": "attribute", - "tooltip": "If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin", - "children": [ - { - "type": "joinpoint", - "name": "originNode" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the parent node in the AST, or undefined if it is the root node", - "children": [ - { - "type": "joinpoint", - "name": "parent" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that declares the scope that is a parent of the scope of this node", - "children": [ - { - "type": "joinpoint", - "name": "parentRegion" - }] - }, - { - "type": "attribute", - "tooltip": "The pragmas associated with this node", - "children": [ - { - "type": "pragma[]", - "name": "pragmas" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the node that comes after this node, or undefined if there is none", - "children": [ - { - "type": "joinpoint", - "name": "rightJp" - }] - }, - { - "type": "attribute", - "tooltip": "Returns the 'program' joinpoint", - "children": [ - { - "type": "program", - "name": "root" - }] - }, - { - "type": "attribute", - "tooltip": "the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array", - "children": [ - { - "type": "joinpoint[]", - "name": "scopeNodes" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that came before this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsLeft" - }] - }, - { - "type": "attribute", - "tooltip": "Returns an array with the siblings that come after this node", - "children": [ - { - "type": "joinpoint[]", - "name": "siblingsRight" - }] - }, - { - "type": "attribute", - "tooltip": "Converts this join point to a statement, or returns undefined if it was not possible", - "children": [ - { - "type": "statement", - "name": "stmt" - }] - }, - { - "type": "attribute", - "children": [ - { - "type": "type", - "name": "type" - }] - }, - { - "type": "select", - "clazz": "expression", - "alias": "expr" - }, - { - "type": "select", - "clazz": "expression", - "alias": "childExpr" - }, - { - "type": "select", - "clazz": "call", - "alias": "" - }, - { - "type": "select", - "clazz": "call", - "alias": "stmtCall" - }, - { - "type": "select", - "clazz": "memberCall", - "alias": "" - }, - { - "type": "select", - "clazz": "memberAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "arrayAccess", - "alias": "" - }, - { - "type": "select", - "clazz": "vardecl", - "alias": "" - }, - { - "type": "select", - "clazz": "varref", - "alias": "" - }, - { - "type": "select", - "clazz": "op", - "alias": "" - }, - { - "type": "select", - "clazz": "binaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "unaryOp", - "alias": "" - }, - { - "type": "select", - "clazz": "newExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "deleteExpr", - "alias": "" - }, - { - "type": "select", - "clazz": "cilkSpawn", - "alias": "" - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, but not of the nodes in its fields", - "children": [ - { - "type": "joinpoint", - "name": "copy" - }] - }, - { - "type": "action", - "tooltip": "Clears all properties from the .data object", - "children": [ - { - "type": "void", - "name": "dataClear" - }] - }, - { - "type": "action", - "tooltip": "Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive)", - "children": [ - { - "type": "joinpoint", - "name": "deepCopy" - }] - }, - { - "type": "action", - "tooltip": "Removes the node associated to this joinpoint from the AST", - "children": [ - { - "type": "joinpoint", - "name": "detach" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point after this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertAfter" - }, - { - "type": "String", - "name": "code", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Inserts the given join point before this join point", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "insertBefore" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Adds a message that will be printed to the user after weaving finishes. Identical messages are removed", - "children": [ - { - "type": "void", - "name": "messageToUser" - }, - { - "type": "String", - "name": "message", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Removes the children of this node", - "children": [ - { - "type": "void", - "name": "removeChildren" - }] - }, - { - "type": "action", - "tooltip": "Replaces this node with the given node", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a string", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "String", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of join points", - "children": [ - { - "type": "joinpoint", - "name": "replaceWith" - }, - { - "type": "joinpoint[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a list of strings", - "children": [ - { - "type": "joinpoint", - "name": "replaceWithStrings" - }, - { - "type": "String[]", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Setting data directly is not supported, this action just emits a warning and does nothing", - "children": [ - { - "type": "void", - "name": "setData" - }, - { - "type": "Object", - "name": "source", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setFirstChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String[]", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the commented that are embedded in a node", - "children": [ - { - "type": "void", - "name": "setInlineComments" - }, - { - "type": "String", - "name": "comments", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present.", - "children": [ - { - "type": "joinpoint", - "name": "setLastChild" - }, - { - "type": "joinpoint", - "name": "node", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the type of a node, if it has a type", - "children": [ - { - "type": "void", - "name": "setType" - }, - { - "type": "type", - "name": "type", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Associates arbitrary values to nodes of the AST", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "String", - "name": "fieldName", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Overload which accepts a map", - "children": [ - { - "type": "Object", - "name": "setUserField" - }, - { - "type": "Map", - "name": "fieldNameAndValue", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Sets the value associated with the given property key", - "children": [ - { - "type": "joinpoint", - "name": "setValue" - }, - { - "type": "String", - "name": "key", - "defaultValue": "" - }, - { - "type": "Object", - "name": "value", - "defaultValue": "" - }] - }, - { - "type": "action", - "tooltip": "Replaces this join point with a comment with the same contents as .code", - "children": [ - { - "type": "joinpoint", - "name": "toComment" - }, - { - "type": "String", - "name": "prefix", - "defaultValue": "\"\"" - }, - { - "type": "String", - "name": "suffix", - "defaultValue": "\"\"" - }] - }] - }, - { - "type": "enum", - "name": "StorageClass" - , - "children": [ - { - "string": "null", - "value": "AUTO" - }, - { - "string": "null", - "value": "EXTERN" - }, - { - "string": "null", - "value": "NONE" - }, - { - "string": "null", - "value": "PRIVATE_EXTERN" - }, - { - "string": "null", - "value": "REGISTER" - }, - { - "string": "null", - "value": "STATIC" - }] - }, - { - "type": "enum", - "name": "Relation" - , - "children": [ - { - "string": "null", - "value": "EQ" - }, - { - "string": "null", - "value": "GE" - }, - { - "string": "null", - "value": "GT" - }, - { - "string": "null", - "value": "LE" - }, - { - "string": "null", - "value": "LT" - }, - { - "string": "null", - "value": "NE" - }] - }] -} \ No newline at end of file diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.png b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.png deleted file mode 100644 index 55500c7673..0000000000 Binary files a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.png and /dev/null differ diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.svg b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.svg deleted file mode 100644 index 0eaea2476e..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaver.svg +++ /dev/null @@ -1,1087 +0,0 @@ - - - - - - -CxxWeaver_join_point_hierarchy_join_point_hierarchy - - - -accessSpecifier - -accessSpecifier - - - -decl - -decl - - - -accessSpecifier->decl - - - - - -joinpoint - -joinpoint - - - -decl->joinpoint - - - - - -adjustedType - -adjustedType - - - -type - -type - - - -adjustedType->type - - - - - -type->joinpoint - - - - - -arrayAccess - -arrayAccess - - - -expression - -expression - - - -arrayAccess->expression - - - - - -expression->joinpoint - - - - - -arrayType - -arrayType - - - -arrayType->type - - - - - -asmStmt - -asmStmt - - - -statement - -statement - - - -asmStmt->statement - - - - - -statement->joinpoint - - - - - -attribute - -attribute - - - -attribute->joinpoint - - - - - -binaryOp - -binaryOp - - - -op - -op - - - -binaryOp->op - - - - - -op->expression - - - - - -body - -body - - - -scope - -scope - - - -body->scope - - - - - -scope->statement - - - - - -boolLiteral - -boolLiteral - - - -literal - -literal - - - -boolLiteral->literal - - - - - -literal->expression - - - - - -break - -break - - - -break->statement - - - - - -builtinType - -builtinType - - - -builtinType->type - - - - - -call - -call - - - -call->expression - - - - - -case - -case - - - -switchCase - -switchCase - - - -case->switchCase - - - - - -switchCase->statement - - - - - -cast - -cast - - - -cast->expression - - - - - -cilkFor - -cilkFor - - - -loop - -loop - - - -cilkFor->loop - - - - - -loop->statement - - - - - -cilkSpawn - -cilkSpawn - - - -cilkSpawn->call - - - - - -cilkSync - -cilkSync - - - -cilkSync->statement - - - - - -class - -class - - - -record - -record - - - -class->record - - - - - -namedDecl - -namedDecl - - - -record->namedDecl - - - - - -clavaException - -clavaException - - - -clavaException->joinpoint - - - - - -comment - -comment - - - -comment->joinpoint - - - - - -continue - -continue - - - -continue->statement - - - - - -cudaKernelCall - -cudaKernelCall - - - -cudaKernelCall->call - - - - - -declStmt - -declStmt - - - -declStmt->statement - - - - - -declarator - -declarator - - - -declarator->namedDecl - - - - - -namedDecl->decl - - - - - -default - -default - - - -default->switchCase - - - - - -deleteExpr - -deleteExpr - - - -deleteExpr->expression - - - - - -elaboratedType - -elaboratedType - - - -elaboratedType->type - - - - - -empty - -empty - - - -empty->joinpoint - - - - - -emptyStmt - -emptyStmt - - - -emptyStmt->statement - - - - - -enumDecl - -enumDecl - - - -enumDecl->namedDecl - - - - - -enumType - -enumType - - - -tagType - -tagType - - - -enumType->tagType - - - - - -tagType->type - - - - - -enumeratorDecl - -enumeratorDecl - - - -enumeratorDecl->namedDecl - - - - - -exprStmt - -exprStmt - - - -exprStmt->statement - - - - - -field - -field - - - -field->declarator - - - - - -file - -file - - - -file->joinpoint - - - - - -floatLiteral - -floatLiteral - - - -floatLiteral->literal - - - - - -function - -function - - - -function->declarator - - - - - -functionType - -functionType - - - -functionType->type - - - - - -gotoStmt - -gotoStmt - - - -gotoStmt->statement - - - - - -if - -if - - - -if->statement - - - - - -implicitValue - -implicitValue - - - -implicitValue->expression - - - - - -include - -include - - - -include->decl - - - - - -incompleteArrayType - -incompleteArrayType - - - -incompleteArrayType->arrayType - - - - - -initList - -initList - - - -initList->expression - - - - - -intLiteral - -intLiteral - - - -intLiteral->literal - - - - - -labelDecl - -labelDecl - - - -labelDecl->namedDecl - - - - - -labelStmt - -labelStmt - - - -labelStmt->statement - - - - - -marker - -marker - - - -pragma - -pragma - - - -marker->pragma - - - - - -pragma->joinpoint - - - - - -memberAccess - -memberAccess - - - -memberAccess->expression - - - - - -memberCall - -memberCall - - - -memberCall->call - - - - - -method - -method - - - -method->function - - - - - -newExpr - -newExpr - - - -newExpr->expression - - - - - -omp - -omp - - - -omp->pragma - - - - - -param - -param - - - -vardecl - -vardecl - - - -param->vardecl - - - - - -vardecl->declarator - - - - - -parenExpr - -parenExpr - - - -parenExpr->expression - - - - - -parenType - -parenType - - - -parenType->type - - - - - -pointerType - -pointerType - - - -pointerType->type - - - - - -program - -program - - - -program->joinpoint - - - - - -qualType - -qualType - - - -qualType->type - - - - - -returnStmt - -returnStmt - - - -returnStmt->statement - - - - - -struct - -struct - - - -struct->record - - - - - -switch - -switch - - - -switch->statement - - - - - -tag - -tag - - - -tag->pragma - - - - - -templateSpecializationType - -templateSpecializationType - - - -templateSpecializationType->type - - - - - -ternaryOp - -ternaryOp - - - -ternaryOp->op - - - - - -this - -this - - - -this->expression - - - - - -typedefDecl - -typedefDecl - - - -typedefNameDecl - -typedefNameDecl - - - -typedefDecl->typedefNameDecl - - - - - -typedefNameDecl->namedDecl - - - - - -typedefType - -typedefType - - - -typedefType->type - - - - - -unaryExprOrType - -unaryExprOrType - - - -unaryExprOrType->expression - - - - - -unaryOp - -unaryOp - - - -unaryOp->op - - - - - -undefinedType - -undefinedType - - - -undefinedType->type - - - - - -variableArrayType - -variableArrayType - - - -variableArrayType->arrayType - - - - - -varref - -varref - - - -varref->expression - - - - - -wrapperStmt - -wrapperStmt - - - -wrapperStmt->statement - - - - - diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaverApi.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaverApi.java index 540f350753..e2c9135caf 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaverApi.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/CxxWeaverApi.java @@ -24,51 +24,6 @@ public class CxxWeaverApi { - /* - public static Optional findJp(ClavaNode node) { - // Get translation unit - TranslationUnit tu = node.getAncestorTry(TranslationUnit.class).orElse(null); - if (tu == null) { - return Optional.empty(); - } - - String id = node.getExtendedId().orElse(null); - if (id == null) { - return Optional.empty(); - } - - ACxxWeaverJoinPoint jp = findJp(tu.getFile().getPath(), id); - if (jp == null) { - return Optional.empty(); - } - - return Optional.of(jp.getNode()); - } - */ - - /* - public static ACxxWeaverJoinPoint findJp(String filepath, String astId) { - // Get AST at the top of the stack - App topAst = CxxWeaver.getCxxWeaver().getApp(); - - File originalFilepath = new File(filepath); - TranslationUnit tu = topAst.getTranslationUnits().stream() - .filter(node -> node.getFile().equals(originalFilepath)) - .findFirst() - .orElse(null); - - if (tu == null) { - return null; - } - - return tu.getDescendantsAndSelfStream() - // Filter nodes that do not have an id equal to the given id - .filter(node -> node.getExtendedId().map(astId::equals).orElse(false)) - .findFirst() - .map(node -> CxxJoinpoints.create(node, null)) - .orElse(null); - } - */ public static ACxxWeaverJoinPoint findJp(String filepath, String astId) { // Get AST at the top of the stack App topAst = CxxWeaver.getCxxWeaver().getApp(); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/ACxxWeaverJoinPoint.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/ACxxWeaverJoinPoint.java index 890c1bcc7e..59da608d6f 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/ACxxWeaverJoinPoint.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/ACxxWeaverJoinPoint.java @@ -1,9 +1,7 @@ package pt.up.fe.specs.clava.weaver.abstracts; import com.google.common.base.Preconditions; -import org.lara.interpreter.utils.DefMap; import org.lara.interpreter.weaver.interf.JoinPoint; -import org.lara.interpreter.weaver.interf.SelectOp; import org.suikasoft.jOptions.Datakey.DataKey; import org.suikasoft.jOptions.storedefinition.StoreDefinition; import pt.up.fe.specs.clava.ClavaLog; @@ -137,7 +135,7 @@ public JoinPoint getJpParent() { @Override public AJoinPoint getAncestorImpl(String type) { - Preconditions.checkNotNull(type, "Missing type of ancestor in attribute 'ancestor'"); + Objects.requireNonNull(type, () -> "Missing type of ancestor in attribute 'ancestor'"); if (type.equals("program")) { ClavaLog.warning("Consider using attribute .root, instead of .ancestor('program')"); @@ -160,7 +158,7 @@ public AJoinPoint getAncestorImpl(String type) { @Override public AJoinPoint[] getDescendantsArrayImpl(String type) { - Preconditions.checkNotNull(type, "Missing type of descendants in attribute 'descendants'"); + Objects.requireNonNull(type, () -> "Missing type of descendants in attribute 'descendants'"); return CxxSelects.selectedNodesToJps(getNode().getDescendantsStream(), jp -> jp.instanceOf(type), getWeaverEngine()); @@ -173,7 +171,7 @@ public AJoinPoint[] getDescendantsArrayImpl() { @Override public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - Preconditions.checkNotNull(type, "Missing type of descendants in attribute 'descendants'"); + Objects.requireNonNull(type, () -> "Missing type of descendants in attribute 'descendants'"); return CxxSelects.selectedNodesToJps(getNode().getDescendantsAndSelfStream(), jp -> jp.instanceOf(type), getWeaverEngine()); @@ -181,7 +179,7 @@ public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { @Override public AJoinPoint getChainAncestorImpl(String type) { - Preconditions.checkNotNull(type, "Missing type of ancestor in attribute 'chainAncestor'"); + Objects.requireNonNull(type, () -> "Missing type of ancestor in attribute 'chainAncestor'"); if (type.equals("program")) { ClavaLog.warning("Consider using attribute .root, instead of .chainAncestor('program')"); @@ -203,7 +201,7 @@ public AJoinPoint getChainAncestorImpl(String type) { @Override public AJoinPoint getAstAncestorImpl(String type) { - Preconditions.checkNotNull(type, "Missing type of ancestor in attribute 'astAncestor'"); + Objects.requireNonNull(type, () -> "Missing type of ancestor in attribute 'astAncestor'"); // Obtain ClavaNode class from type Class nodeClass = ClassesService.getClavaClass(type); @@ -241,7 +239,7 @@ public String getCodeImpl() { @Override public Integer getLineImpl() { // ClavaNode node = getNode(); - // Preconditions.checkNotNull(node); + // Objects.requireNonNull(node); // int line = getNode().getLocation().getStartLine(); // return line != SourceLocation.getInvalidLoc() ? line : null; SourceRange location = getNode().getLocation(); @@ -301,8 +299,7 @@ public AJoinPoint[] insertImpl(String position, JoinPoint JoinPoint) { } @Override - public void defTypeImpl(AType type) { - + public void setTypeImpl(AType type) { // Check if node has a type ClavaNode node = getNode(); @@ -313,12 +310,6 @@ public void defTypeImpl(AType type) { } ((Typable) node).setType((Type) type.getNode()); - - } - - @Override - public void setTypeImpl(AType type) { - defTypeImpl(type); } @Override @@ -571,35 +562,6 @@ public Boolean containsImpl(AJoinPoint jp) { .findFirst().isPresent(); } - /* - @Override - public void defImpl(String attribute, Object value) { - // Get def map - DefMap defMap = getDefMap(); - - if (defMap == null) { - SpecsLogs - .msgInfo("Joinpoint '" + getJoinpointType() + "' does not have 'def' defined for any attribute"); - return; - } - - if (!defMap.hasAttribute(attribute)) { - List keys = new ArrayList<>(defMap.keys()); - Collections.sort(keys); - SpecsLogs - .msgInfo("'def' of attribute '" + attribute + "' not defined for joinpoint " + getJoinpointType()); - SpecsLogs.msgInfo("Available attributes: " + keys); - return; - } - - defMap.apply(attribute, this, value); - } - */ - - protected DefMap getDefMap() { - return null; - } - /** * Ignores certain nodes, such as ImplicitCastExpr. * @@ -681,41 +643,7 @@ public AJoinPoint[] getScopeNodesArrayImpl() { .stream(); return CxxSelects.selectedNodesToJps(stream, getWeaverEngine()); - /* - AJoinPoint[] scopeChildren = ((NodeWithScope) node).getNodeScope() - .map(scope -> scope.getChildren()).orElse(Collections.emptyList()) - .stream() - .filter(child -> !(child instanceof NullNode)) - .map(child -> CxxJoinpoints.create(child)) - .collect(Collectors.toList()) - .toArray(new AJoinPoint[0]); - - // Count as selected nodes - getWeaverEngine().getWeavingReport().inc(ReportField.JOIN_POINTS, scopeChildren.length); - getWeaverEngine().getWeavingReport().inc(ReportField.FILTERED_JOIN_POINTS, scopeChildren.length); - - // Count as a select - getWeaverEngine().getWeavingReport().inc(ReportField.SELECTS); - - return scopeChildren; - */ - } - - /* - public List getDirectNodes() { - var node = getNode(); - - if (node instanceof LoopStmt) { - return ((LoopStmt) node).getBody().getChildren(); - } - - if (node instanceof FunctionDecl) { - return ((FunctionDecl) node).getBody().map(body -> body.getChildren()).orElse(Collections.emptyList()); - } - - return node.getChildren(); } - */ @Override public Stream getJpChildrenStream() { @@ -726,23 +654,6 @@ public Stream getJpChildrenStream() { @Override public AJoinPoint[] getChildrenArrayImpl() { return CxxSelects.selectedNodesToJps(getNode().getChildren().stream(), getWeaverEngine()); - /* - AJoinPoint[] children = getNode().getChildren().stream() - // AJoinPoint[] children = getChildrenPrivate().stream() - .filter(node -> !(node instanceof NullNode)) - .map(node -> CxxJoinpoints.create(node)) - .collect(Collectors.toList()) - .toArray(new AJoinPoint[0]); - - // Count as selected nodes - getWeaverEngine().getWeavingReport().inc(ReportField.JOIN_POINTS, children.length); - getWeaverEngine().getWeavingReport().inc(ReportField.FILTERED_JOIN_POINTS, children.length); - - // Count as a select - getWeaverEngine().getWeavingReport().inc(ReportField.SELECTS); - - return children; - */ } @Override @@ -1077,11 +988,6 @@ public Object getDataImpl() { return ClavaData.getCacheData(getNode()); } - @Override - public void defDataImpl(Object source) { - setDataImpl(source); - } - @Override public void setDataImpl(Object source) { var dataPragma = ClavaData.getClavaData(getNode()); @@ -1199,15 +1105,6 @@ public void messageToUserImpl(String message) { getWeaverEngine().addMessageToUser(message); } - /** - * Generic select function, used by the default select implementations. - */ - @Override - public List select(Class joinPointClass, SelectOp op) { - throw new RuntimeException( - "Generic select function not implemented yet. Implement it in order to use the default implementations of select"); - } - /** * Generic select function, used by the default select implementations. * @@ -1246,11 +1143,6 @@ public AJoinPoint getFirstChildImpl() { return CxxJoinpoints.create(node.getChild(0)); } - @Override - public void defFirstChildImpl(AJoinPoint value) { - setFirstChildImpl(value); - } - @Override public AJoinPoint setFirstChildImpl(AJoinPoint value) { // If no children, just insert the node @@ -1278,11 +1170,6 @@ public AJoinPoint getLastChildImpl() { return children[children.length - 1]; } - @Override - public void defLastChildImpl(AJoinPoint value) { - setLastChildImpl(value); - } - @Override public AJoinPoint setLastChildImpl(AJoinPoint value) { // If no children, just insert the node @@ -1373,41 +1260,27 @@ public AComment[] getInlineCommentsArrayImpl() { // } @Override - public void defInlineCommentsImpl(String[] value) { - - if (value == null || value.length == 0) { + public void setInlineCommentsImpl(String[] comments) { + if (comments == null || comments.length == 0) { getNode().removeInlineComments(); return; } - // sArrays.stream(value).map(comment -> (Com)) - - var comments = Arrays.stream(value) + var newComments = Arrays.stream( + comments) .map(comment -> getFactory().inlineComment(comment, false)) .collect(Collectors.toList()); - getNode().set(ClavaNode.INLINE_COMMENTS, comments); + getNode().set(ClavaNode.INLINE_COMMENTS, newComments); } - @Override - public void setInlineCommentsImpl(String[] comments) { - defInlineCommentsImpl(comments); - } - - @Override - public void defInlineCommentsImpl(String value) { - - if (value == null || value.isBlank()) { - defInlineCommentsImpl(new String[0]); + public void setInlineCommentsImpl(String comment) { + if (comment == null || comment.isBlank()) { + setInlineCommentsImpl(new String[0]); return; } - defInlineCommentsImpl(new String[]{value}); - } - - @Override - public void setInlineCommentsImpl(String comment) { - defInlineCommentsImpl(comment); + setInlineCommentsImpl(new String[] { comment }); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAccessSpecifier.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAccessSpecifier.java deleted file mode 100644 index 91244c0b16..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAccessSpecifier.java +++ /dev/null @@ -1,1077 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AAccessSpecifier - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AAccessSpecifier extends ADecl { - - protected ADecl aDecl; - - /** - * - */ - public AAccessSpecifier(ADecl aDecl){ - this.aDecl = aDecl; - } - /** - * the type of specifier. Can return 'public', 'protected', 'private' or 'none' - */ - public abstract String getKindImpl(); - - /** - * the type of specifier. Can return 'public', 'protected', 'private' or 'none' - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDecl.getAttrsArrayImpl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDecl.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aDecl.fillWithAttributes(attributes); - attributes.add("kind"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "accessSpecifier"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum AccessSpecifierAttributes { - KIND("kind"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private AccessSpecifierAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(AccessSpecifierAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAdjustedType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAdjustedType.java deleted file mode 100644 index 048f8b6288..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAdjustedType.java +++ /dev/null @@ -1,1341 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AAdjustedType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AAdjustedType extends AType { - - protected AType aType; - - /** - * - */ - public AAdjustedType(AType aType){ - this.aType = aType; - } - /** - * the type that is being adjusted - */ - public abstract AType getOriginalTypeImpl(); - - /** - * the type that is being adjusted - */ - public final Object getOriginalType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "originalType", Optional.empty()); - } - AType result = this.getOriginalTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "originalType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "originalType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("originalType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "adjustedType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum AdjustedTypeAttributes { - ORIGINALTYPE("originalType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private AdjustedTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(AdjustedTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayAccess.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayAccess.java deleted file mode 100644 index 6e52d74214..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayAccess.java +++ /dev/null @@ -1,1264 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AArrayAccess - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AArrayAccess extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AArrayAccess(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * expression representing the variable of the array access (can be a varref, memberAccess...) - */ - public abstract AExpression getArrayVarImpl(); - - /** - * expression representing the variable of the array access (can be a varref, memberAccess...) - */ - public final Object getArrayVar() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "arrayVar", Optional.empty()); - } - AExpression result = this.getArrayVarImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "arrayVar", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "arrayVar", e); - } - } - - /** - * If the array access is done over a variable, returns the name of the variable. Equivalent to $arrayAccess.arrayVar.name - */ - public abstract String getNameImpl(); - - /** - * If the array access is done over a variable, returns the name of the variable. Equivalent to $arrayAccess.arrayVar.name - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * The number of subscripts of this array access - */ - public abstract Integer getNumSubscriptsImpl(); - - /** - * The number of subscripts of this array access - */ - public final Object getNumSubscripts() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "numSubscripts", Optional.empty()); - } - Integer result = this.getNumSubscriptsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "numSubscripts", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "numSubscripts", e); - } - } - - /** - * A view of the current arrayAccess without the last subscript, or undefined if this arrayAccess only has one subscript - */ - public abstract AArrayAccess getParentAccessImpl(); - - /** - * A view of the current arrayAccess without the last subscript, or undefined if this arrayAccess only has one subscript - */ - public final Object getParentAccess() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "parentAccess", Optional.empty()); - } - AArrayAccess result = this.getParentAccessImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "parentAccess", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "parentAccess", e); - } - } - - /** - * Get value on attribute subscript - * @return the attribute's value - */ - public abstract AExpression[] getSubscriptArrayImpl(); - - /** - * expression of the array access subscript - */ - public Object getSubscriptImpl() { - AExpression[] aExpressionArrayImpl0 = getSubscriptArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * expression of the array access subscript - */ - public final Object getSubscript() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "subscript", Optional.empty()); - } - Object result = this.getSubscriptImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "subscript", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "subscript", e); - } - } - - /** - * varref to the variable of the array access - * @return - */ - public List selectArrayVar() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * expression of the array access subscript - * @return - */ - public List selectSubscript() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "arrayVar": - joinPointList = selectArrayVar(); - break; - case "subscript": - joinPointList = selectSubscript(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("arrayVar"); - attributes.add("name"); - attributes.add("numSubscripts"); - attributes.add("parentAccess"); - attributes.add("subscript"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - selects.add("arrayVar"); - selects.add("subscript"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "arrayAccess"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ArrayAccessAttributes { - ARRAYVAR("arrayVar"), - NAME("name"), - NUMSUBSCRIPTS("numSubscripts"), - PARENTACCESS("parentAccess"), - SUBSCRIPT("subscript"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ArrayAccessAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ArrayAccessAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayType.java deleted file mode 100644 index d09cfb8aa1..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AArrayType.java +++ /dev/null @@ -1,1385 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AArrayType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AArrayType extends AType { - - protected AType aType; - - /** - * - */ - public AArrayType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute elementType - * @return the attribute's value - */ - public abstract AType getElementTypeImpl(); - - /** - * Get value on attribute elementType - * @return the attribute's value - */ - public final Object getElementType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "elementType", Optional.empty()); - } - AType result = this.getElementTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "elementType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "elementType", e); - } - } - - /** - * - */ - public void defElementTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def elementType with type AType not implemented "); - } - - /** - * Sets the element type of the array - * @param arrayElementType - */ - public void setElementTypeImpl(AType arrayElementType) { - throw new UnsupportedOperationException(get_class()+": Action setElementType not implemented "); - } - - /** - * Sets the element type of the array - * @param arrayElementType - */ - public final void setElementType(AType arrayElementType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setElementType", this, Optional.empty(), arrayElementType); - } - this.setElementTypeImpl(arrayElementType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setElementType", this, Optional.empty(), arrayElementType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setElementType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "elementType": { - if(value instanceof AType){ - this.defElementTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("elementType"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - actions.add("void setElementType(type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "arrayType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ArrayTypeAttributes { - ELEMENTTYPE("elementType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ArrayTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ArrayTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAsmStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAsmStmt.java deleted file mode 100644 index c76409d044..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAsmStmt.java +++ /dev/null @@ -1,1333 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AAsmStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AAsmStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AAsmStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute clobbers - * @return the attribute's value - */ - public abstract String[] getClobbersArrayImpl(); - - /** - * Get value on attribute clobbers - * @return the attribute's value - */ - public Object getClobbersImpl() { - String[] stringArrayImpl0 = getClobbersArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute clobbers - * @return the attribute's value - */ - public final Object getClobbers() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "clobbers", Optional.empty()); - } - Object result = this.getClobbersImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "clobbers", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "clobbers", e); - } - } - - /** - * Get value on attribute isSimple - * @return the attribute's value - */ - public abstract Boolean getIsSimpleImpl(); - - /** - * Get value on attribute isSimple - * @return the attribute's value - */ - public final Object getIsSimple() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isSimple", Optional.empty()); - } - Boolean result = this.getIsSimpleImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isSimple", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isSimple", e); - } - } - - /** - * Get value on attribute isVolatile - * @return the attribute's value - */ - public abstract Boolean getIsVolatileImpl(); - - /** - * Get value on attribute isVolatile - * @return the attribute's value - */ - public final Object getIsVolatile() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isVolatile", Optional.empty()); - } - Boolean result = this.getIsVolatileImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isVolatile", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isVolatile", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("clobbers"); - attributes.add("isSimple"); - attributes.add("isVolatile"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "asmStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum AsmStmtAttributes { - CLOBBERS("clobbers"), - ISSIMPLE("isSimple"), - ISVOLATILE("isVolatile"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private AsmStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(AsmStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAttribute.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAttribute.java deleted file mode 100644 index 3deb796ca1..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AAttribute.java +++ /dev/null @@ -1,239 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AAttribute - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AAttribute extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("kind"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "attribute"; - } - /** - * - */ - protected enum AttributeAttributes { - KIND("kind"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private AttributeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(AttributeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABinaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABinaryOp.java deleted file mode 100644 index efac1fcf83..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABinaryOp.java +++ /dev/null @@ -1,1324 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ABinaryOp - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ABinaryOp extends AOp { - - protected AOp aOp; - - /** - * - */ - public ABinaryOp(AOp aOp){ - super(aOp); - this.aOp = aOp; - } - /** - * Get value on attribute isAssignment - * @return the attribute's value - */ - public abstract Boolean getIsAssignmentImpl(); - - /** - * Get value on attribute isAssignment - * @return the attribute's value - */ - public final Object getIsAssignment() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isAssignment", Optional.empty()); - } - Boolean result = this.getIsAssignmentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isAssignment", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isAssignment", e); - } - } - - /** - * Get value on attribute left - * @return the attribute's value - */ - public abstract AExpression getLeftImpl(); - - /** - * Get value on attribute left - * @return the attribute's value - */ - public final Object getLeft() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "left", Optional.empty()); - } - AExpression result = this.getLeftImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "left", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "left", e); - } - } - - /** - * - */ - public void defLeftImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def left with type AExpression not implemented "); - } - - /** - * Get value on attribute right - * @return the attribute's value - */ - public abstract AExpression getRightImpl(); - - /** - * Get value on attribute right - * @return the attribute's value - */ - public final Object getRight() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "right", Optional.empty()); - } - AExpression result = this.getRightImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "right", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "right", e); - } - } - - /** - * - */ - public void defRightImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def right with type AExpression not implemented "); - } - - /** - * Default implementation of the method used by the lara interpreter to select lefts - * @return - */ - public List selectLeft() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select rights - * @return - */ - public List selectRight() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * - * @param left - */ - public void setLeftImpl(AExpression left) { - throw new UnsupportedOperationException(get_class()+": Action setLeft not implemented "); - } - - /** - * - * @param left - */ - public final void setLeft(AExpression left) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setLeft", this, Optional.empty(), left); - } - this.setLeftImpl(left); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setLeft", this, Optional.empty(), left); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setLeft", e); - } - } - - /** - * - * @param right - */ - public void setRightImpl(AExpression right) { - throw new UnsupportedOperationException(get_class()+": Action setRight not implemented "); - } - - /** - * - * @param right - */ - public final void setRight(AExpression right) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setRight", this, Optional.empty(), right); - } - this.setRightImpl(right); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setRight", this, Optional.empty(), right); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setRight", e); - } - } - - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - @Override - public Boolean getIsBitwiseImpl() { - return this.aOp.getIsBitwiseImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aOp.getKindImpl(); - } - - /** - * Get value on attribute operator - * @return the attribute's value - */ - @Override - public String getOperatorImpl() { - return this.aOp.getOperatorImpl(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aOp.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aOp.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aOp.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aOp.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aOp.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aOp.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aOp.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aOp.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aOp.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aOp.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aOp.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aOp.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aOp.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aOp.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aOp.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aOp.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aOp.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aOp.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aOp.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aOp.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aOp.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aOp.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aOp.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aOp.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aOp.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aOp.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aOp.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aOp.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aOp.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aOp.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aOp.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aOp.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aOp.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aOp.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aOp.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aOp.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aOp.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aOp.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aOp.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aOp.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aOp.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aOp.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aOp.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aOp.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aOp.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aOp.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aOp.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aOp.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aOp.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aOp.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aOp.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aOp.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aOp.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aOp.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aOp.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aOp.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aOp.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aOp.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aOp.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aOp.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aOp.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aOp.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aOp.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aOp.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aOp.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aOp.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aOp.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aOp.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aOp.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aOp.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aOp.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aOp.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aOp.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aOp.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aOp.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aOp.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aOp.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aOp.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aOp.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aOp.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aOp.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aOp.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aOp.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aOp.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aOp.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aOp.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aOp.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aOp.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aOp); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "left": - joinPointList = selectLeft(); - break; - case "right": - joinPointList = selectRight(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aOp.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "left": { - if(value instanceof AExpression){ - this.defLeftImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "right": { - if(value instanceof AExpression){ - this.defRightImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aOp.fillWithAttributes(attributes); - attributes.add("isAssignment"); - attributes.add("left"); - attributes.add("right"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aOp.fillWithSelects(selects); - selects.add("left"); - selects.add("right"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aOp.fillWithActions(actions); - actions.add("void setLeft(expression)"); - actions.add("void setRight(expression)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "binaryOp"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aOp.instanceOf(joinpointClass); - } - /** - * - */ - protected enum BinaryOpAttributes { - ISASSIGNMENT("isAssignment"), - LEFT("left"), - RIGHT("right"), - ISBITWISE("isBitwise"), - KIND("kind"), - OPERATOR("operator"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private BinaryOpAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(BinaryOpAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABody.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABody.java deleted file mode 100644 index e816873bed..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABody.java +++ /dev/null @@ -1,1579 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ABody - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ABody extends AScope { - - protected AScope aScope; - - /** - * - */ - public ABody(AScope aScope){ - super(aScope); - this.aScope = aScope; - } - /** - * Get value on attribute allStmtsArrayImpl - * @return the attribute's value - */ - @Override - public AStatement[] getAllStmtsArrayImpl() { - return this.aScope.getAllStmtsArrayImpl(); - } - - /** - * Get value on attribute firstStmt - * @return the attribute's value - */ - @Override - public AStatement getFirstStmtImpl() { - return this.aScope.getFirstStmtImpl(); - } - - /** - * Get value on attribute getNumStatements - * @return the attribute's value - */ - @Override - public Long getNumStatementsImpl(Boolean flat) { - return this.aScope.getNumStatementsImpl(flat); - } - - /** - * Get value on attribute lastStmt - * @return the attribute's value - */ - @Override - public AStatement getLastStmtImpl() { - return this.aScope.getLastStmtImpl(); - } - - /** - * Get value on attribute naked - * @return the attribute's value - */ - @Override - public Boolean getNakedImpl() { - return this.aScope.getNakedImpl(); - } - - /** - * Get value on attribute owner - * @return the attribute's value - */ - @Override - public AJoinPoint getOwnerImpl() { - return this.aScope.getOwnerImpl(); - } - - /** - * Get value on attribute stmtsArrayImpl - * @return the attribute's value - */ - @Override - public AStatement[] getStmtsArrayImpl() { - return this.aScope.getStmtsArrayImpl(); - } - - /** - * Method used by the lara interpreter to select stmts - * @return - */ - @Override - public List selectStmt() { - return this.aScope.selectStmt(); - } - - /** - * Method used by the lara interpreter to select childStmts - * @return - */ - @Override - public List selectChildStmt() { - return this.aScope.selectChildStmt(); - } - - /** - * Method used by the lara interpreter to select scopes - * @return - */ - @Override - public List selectScope() { - return this.aScope.selectScope(); - } - - /** - * Method used by the lara interpreter to select ifs - * @return - */ - @Override - public List selectIf() { - return this.aScope.selectIf(); - } - - /** - * Method used by the lara interpreter to select loops - * @return - */ - @Override - public List selectLoop() { - return this.aScope.selectLoop(); - } - - /** - * Method used by the lara interpreter to select pragmas - * @return - */ - @Override - public List selectPragma() { - return this.aScope.selectPragma(); - } - - /** - * Method used by the lara interpreter to select markers - * @return - */ - @Override - public List selectMarker() { - return this.aScope.selectMarker(); - } - - /** - * Method used by the lara interpreter to select tags - * @return - */ - @Override - public List selectTag() { - return this.aScope.selectTag(); - } - - /** - * Method used by the lara interpreter to select omps - * @return - */ - @Override - public List selectOmp() { - return this.aScope.selectOmp(); - } - - /** - * Method used by the lara interpreter to select comments - * @return - */ - @Override - public List selectComment() { - return this.aScope.selectComment(); - } - - /** - * Method used by the lara interpreter to select returnStmts - * @return - */ - @Override - public List selectReturnStmt() { - return this.aScope.selectReturnStmt(); - } - - /** - * Method used by the lara interpreter to select cilkFors - * @return - */ - @Override - public List selectCilkFor() { - return this.aScope.selectCilkFor(); - } - - /** - * Method used by the lara interpreter to select cilkSyncs - * @return - */ - @Override - public List selectCilkSync() { - return this.aScope.selectCilkSync(); - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aScope.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aScope.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aScope.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aScope.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aScope.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aScope.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aScope.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aScope.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aScope.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aScope.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aScope.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aScope.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aScope.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aScope.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aScope.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aScope.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aScope.selectCilkSpawn(); - } - - /** - * - */ - public void defNakedImpl(Boolean value) { - this.aScope.defNakedImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aScope.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aScope.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aScope.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aScope.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aScope.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aScope.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aScope.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aScope.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aScope.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aScope.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aScope.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aScope.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aScope.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aScope.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aScope.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aScope.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aScope.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aScope.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aScope.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aScope.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aScope.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aScope.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aScope.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aScope.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aScope.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aScope.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aScope.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aScope.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aScope.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aScope.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aScope.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aScope.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aScope.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aScope.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aScope.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aScope.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aScope.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aScope.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aScope.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aScope.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aScope.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aScope.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aScope.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aScope.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aScope.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aScope.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aScope.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aScope.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aScope.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aScope.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aScope.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aScope.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aScope.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aScope.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aScope.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aScope.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aScope.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aScope.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aScope.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aScope.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aScope.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aScope.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aScope.getTypeImpl(); - } - - /** - * Adds a new local variable to this scope - * @param name - * @param type - * @param initValue - */ - @Override - public AJoinPoint addLocalImpl(String name, AJoinPoint type, String initValue) { - return this.aScope.addLocalImpl(name, type, initValue); - } - - /** - * CFG tester - */ - @Override - public String cfgImpl() { - return this.aScope.cfgImpl(); - } - - /** - * Clears the contents of this scope (untested) - */ - @Override - public void clearImpl() { - this.aScope.clearImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aScope.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aScope.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aScope.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aScope.detachImpl(); - } - - /** - * DFG tester - */ - @Override - public String dfgImpl() { - return this.aScope.dfgImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aScope.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aScope.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aScope.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aScope.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aScope.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aScope.insertBeforeImpl(node); - } - - /** - * - * @param node - */ - @Override - public AJoinPoint insertBeginImpl(AJoinPoint node) { - return this.aScope.insertBeginImpl(node); - } - - /** - * - * @param code - */ - @Override - public AJoinPoint insertBeginImpl(String code) { - return this.aScope.insertBeginImpl(code); - } - - /** - * - * @param node - */ - @Override - public AJoinPoint insertEndImpl(AJoinPoint node) { - return this.aScope.insertEndImpl(node); - } - - /** - * - * @param code - */ - @Override - public AJoinPoint insertEndImpl(String code) { - return this.aScope.insertEndImpl(code); - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - @Override - public AJoinPoint insertReturnImpl(AJoinPoint code) { - return this.aScope.insertReturnImpl(code); - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - @Override - public AJoinPoint insertReturnImpl(String code) { - return this.aScope.insertReturnImpl(code); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aScope.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aScope.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aScope.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aScope.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aScope.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aScope.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aScope.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aScope.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aScope.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aScope.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aScope.setLastChildImpl(node); - } - - /** - * Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces) - * @param isNaked - */ - @Override - public void setNakedImpl(Boolean isNaked) { - this.aScope.setNakedImpl(isNaked); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aScope.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aScope.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aScope.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aScope.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aScope.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aScope); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "stmt": - joinPointList = selectStmt(); - break; - case "childStmt": - joinPointList = selectChildStmt(); - break; - case "scope": - joinPointList = selectScope(); - break; - case "if": - joinPointList = selectIf(); - break; - case "loop": - joinPointList = selectLoop(); - break; - case "pragma": - joinPointList = selectPragma(); - break; - case "marker": - joinPointList = selectMarker(); - break; - case "tag": - joinPointList = selectTag(); - break; - case "omp": - joinPointList = selectOmp(); - break; - case "comment": - joinPointList = selectComment(); - break; - case "returnStmt": - joinPointList = selectReturnStmt(); - break; - case "cilkFor": - joinPointList = selectCilkFor(); - break; - case "cilkSync": - joinPointList = selectCilkSync(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aScope.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "naked": { - if(value instanceof Boolean){ - this.defNakedImpl((Boolean)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aScope.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aScope.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aScope.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "body"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aScope.instanceOf(joinpointClass); - } - /** - * - */ - protected enum BodyAttributes { - ALLSTMTS("allStmts"), - FIRSTSTMT("firstStmt"), - GETNUMSTATEMENTS("getNumStatements"), - LASTSTMT("lastStmt"), - NAKED("naked"), - OWNER("owner"), - STMTS("stmts"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private BodyAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(BodyAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABoolLiteral.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABoolLiteral.java deleted file mode 100644 index c7af6ce1e5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABoolLiteral.java +++ /dev/null @@ -1,1132 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ABoolLiteral - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ABoolLiteral extends ALiteral { - - protected ALiteral aLiteral; - - /** - * - */ - public ABoolLiteral(ALiteral aLiteral){ - super(aLiteral); - this.aLiteral = aLiteral; - } - /** - * Get value on attribute value - * @return the attribute's value - */ - public abstract Boolean getValueImpl(); - - /** - * Get value on attribute value - * @return the attribute's value - */ - public final Object getValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "value", Optional.empty()); - } - Boolean result = this.getValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "value", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "value", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aLiteral.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aLiteral.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aLiteral.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aLiteral.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aLiteral.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aLiteral.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aLiteral.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aLiteral.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aLiteral.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aLiteral.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aLiteral.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aLiteral.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aLiteral.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aLiteral.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aLiteral.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aLiteral.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aLiteral.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aLiteral.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aLiteral.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aLiteral.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aLiteral.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aLiteral.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aLiteral.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aLiteral.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aLiteral.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aLiteral.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aLiteral.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aLiteral.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aLiteral.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aLiteral.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aLiteral.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aLiteral.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aLiteral.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aLiteral.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aLiteral.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aLiteral.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aLiteral.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aLiteral.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aLiteral.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aLiteral.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aLiteral.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aLiteral.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aLiteral.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aLiteral.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aLiteral.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aLiteral.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aLiteral.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aLiteral.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aLiteral.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aLiteral.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aLiteral.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aLiteral.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aLiteral.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aLiteral.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aLiteral.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aLiteral.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aLiteral.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aLiteral.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aLiteral.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aLiteral.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aLiteral.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aLiteral.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aLiteral.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aLiteral.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aLiteral.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aLiteral.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aLiteral.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aLiteral.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aLiteral.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aLiteral.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aLiteral.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aLiteral.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aLiteral.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aLiteral.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aLiteral.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aLiteral.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aLiteral.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aLiteral.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aLiteral.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aLiteral.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aLiteral.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aLiteral.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aLiteral.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aLiteral.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aLiteral.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aLiteral.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aLiteral); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aLiteral.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aLiteral.fillWithAttributes(attributes); - attributes.add("value"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aLiteral.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aLiteral.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "boolLiteral"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aLiteral.instanceOf(joinpointClass); - } - /** - * - */ - protected enum BoolLiteralAttributes { - VALUE("value"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private BoolLiteralAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(BoolLiteralAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABreak.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABreak.java deleted file mode 100644 index bcca7f4ec4..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABreak.java +++ /dev/null @@ -1,1267 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ABreak - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ABreak extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ABreak(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * The enclosing statement related to this break. It should be either a loop or a switch statement. - */ - public abstract AStatement getEnclosingStmtImpl(); - - /** - * The enclosing statement related to this break. It should be either a loop or a switch statement. - */ - public final Object getEnclosingStmt() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "enclosingStmt", Optional.empty()); - } - AStatement result = this.getEnclosingStmtImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "enclosingStmt", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "enclosingStmt", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("enclosingStmt"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "break"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum BreakAttributes { - ENCLOSINGSTMT("enclosingStmt"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private BreakAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(BreakAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABuiltinType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABuiltinType.java deleted file mode 100644 index fc5e6f2cdb..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ABuiltinType.java +++ /dev/null @@ -1,1468 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ABuiltinType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ABuiltinType extends AType { - - protected AType aType; - - /** - * - */ - public ABuiltinType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute builtinKind - * @return the attribute's value - */ - public abstract String getBuiltinKindImpl(); - - /** - * Get value on attribute builtinKind - * @return the attribute's value - */ - public final Object getBuiltinKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "builtinKind", Optional.empty()); - } - String result = this.getBuiltinKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "builtinKind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "builtinKind", e); - } - } - - /** - * true, if ot is a floating type (e.g., float, double) - */ - public abstract Boolean getIsFloatImpl(); - - /** - * true, if ot is a floating type (e.g., float, double) - */ - public final Object getIsFloat() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isFloat", Optional.empty()); - } - Boolean result = this.getIsFloatImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isFloat", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isFloat", e); - } - } - - /** - * true, if it is an integer type - */ - public abstract Boolean getIsIntegerImpl(); - - /** - * true, if it is an integer type - */ - public final Object getIsInteger() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInteger", Optional.empty()); - } - Boolean result = this.getIsIntegerImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInteger", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInteger", e); - } - } - - /** - * true, if it is a signed integer type - */ - public abstract Boolean getIsSignedImpl(); - - /** - * true, if it is a signed integer type - */ - public final Object getIsSigned() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isSigned", Optional.empty()); - } - Boolean result = this.getIsSignedImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isSigned", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isSigned", e); - } - } - - /** - * true, if it is an unsigned integer type - */ - public abstract Boolean getIsUnsignedImpl(); - - /** - * true, if it is an unsigned integer type - */ - public final Object getIsUnsigned() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isUnsigned", Optional.empty()); - } - Boolean result = this.getIsUnsignedImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isUnsigned", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isUnsigned", e); - } - } - - /** - * true, if it is the type 'void' - */ - public abstract Boolean getIsVoidImpl(); - - /** - * true, if it is the type 'void' - */ - public final Object getIsVoid() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isVoid", Optional.empty()); - } - Boolean result = this.getIsVoidImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isVoid", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isVoid", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("builtinKind"); - attributes.add("isFloat"); - attributes.add("isInteger"); - attributes.add("isSigned"); - attributes.add("isUnsigned"); - attributes.add("isVoid"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "builtinType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum BuiltinTypeAttributes { - BUILTINKIND("builtinKind"), - ISFLOAT("isFloat"), - ISINTEGER("isInteger"), - ISSIGNED("isSigned"), - ISUNSIGNED("isUnsigned"), - ISVOID("isVoid"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private BuiltinTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(BuiltinTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACall.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACall.java deleted file mode 100644 index b6eab7a679..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACall.java +++ /dev/null @@ -1,1786 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACall - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACall extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public ACall(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute argList - * @return the attribute's value - */ - public abstract AExpression[] getArgListArrayImpl(); - - /** - * an alias for 'args' - */ - public Object getArgListImpl() { - AExpression[] aExpressionArrayImpl0 = getArgListArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * an alias for 'args' - */ - public final Object getArgList() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "argList", Optional.empty()); - } - Object result = this.getArgListImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "argList", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "argList", e); - } - } - - /** - * Get value on attribute args - * @return the attribute's value - */ - public abstract AExpression[] getArgsArrayImpl(); - - /** - * an array with the arguments of the call - */ - public Object getArgsImpl() { - AExpression[] aExpressionArrayImpl0 = getArgsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * an array with the arguments of the call - */ - public final Object getArgs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "args", Optional.empty()); - } - Object result = this.getArgsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "args", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "args", e); - } - } - - /** - * a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found - */ - public abstract AFunction getDeclarationImpl(); - - /** - * a 'function' join point that represents the function of the call that was found, it can return either an implementation or a function prototype; 'undefined' if no declaration was found - */ - public final Object getDeclaration() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "declaration", Optional.empty()); - } - AFunction result = this.getDeclarationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "declaration", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "declaration", e); - } - } - - /** - * a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found - */ - public abstract AFunction getDefinitionImpl(); - - /** - * a 'function' join point that represents the function definition of the call; 'undefined' if no definition was found - */ - public final Object getDefinition() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "definition", Optional.empty()); - } - AFunction result = this.getDefinitionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "definition", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "definition", e); - } - } - - /** - * a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function) - */ - public abstract AFunction getDirectCalleeImpl(); - - /** - * a function join point that represents the 'raw' function of the call (e.g. if this is a call to a templated function, returns a declaration representing the template specialization, instead of the original function) - */ - public final Object getDirectCallee() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "directCallee", Optional.empty()); - } - AFunction result = this.getDirectCalleeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "directCallee", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "directCallee", e); - } - } - - /** - * a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration - */ - public abstract AFunction getFunctionImpl(); - - /** - * a function join point associated with this call. If a definition is present, it is given priority over returning a declaration. If only declarations are present, returns a declaration - */ - public final Object getFunction() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "function", Optional.empty()); - } - AFunction result = this.getFunctionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "function", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "function", e); - } - } - - /** - * the function type of the call, which includes the return type and the types of the parameters - */ - public abstract AFunctionType getFunctionTypeImpl(); - - /** - * the function type of the call, which includes the return type and the types of the parameters - */ - public final Object getFunctionType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "functionType", Optional.empty()); - } - AFunctionType result = this.getFunctionTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "functionType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "functionType", e); - } - } - - /** - * - * @param index - * @return - */ - public abstract AExpression getArgImpl(int index); - - /** - * - * @param index - * @return - */ - public final Object getArg(int index) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getArg", Optional.empty(), index); - } - AExpression result = this.getArgImpl(index); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getArg", Optional.ofNullable(result), index); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getArg", e); - } - } - - /** - * Get value on attribute isMemberAccess - * @return the attribute's value - */ - public abstract Boolean getIsMemberAccessImpl(); - - /** - * Get value on attribute isMemberAccess - * @return the attribute's value - */ - public final Object getIsMemberAccess() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isMemberAccess", Optional.empty()); - } - Boolean result = this.getIsMemberAccessImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isMemberAccess", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isMemberAccess", e); - } - } - - /** - * Get value on attribute isStmtCall - * @return the attribute's value - */ - public abstract Boolean getIsStmtCallImpl(); - - /** - * Get value on attribute isStmtCall - * @return the attribute's value - */ - public final Object getIsStmtCall() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isStmtCall", Optional.empty()); - } - Boolean result = this.getIsStmtCallImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isStmtCall", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isStmtCall", e); - } - } - - /** - * Get value on attribute memberAccess - * @return the attribute's value - */ - public abstract AMemberAccess getMemberAccessImpl(); - - /** - * Get value on attribute memberAccess - * @return the attribute's value - */ - public final Object getMemberAccess() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "memberAccess", Optional.empty()); - } - AMemberAccess result = this.getMemberAccessImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "memberAccess", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "memberAccess", e); - } - } - - /** - * Get value on attribute memberNames - * @return the attribute's value - */ - public abstract String[] getMemberNamesArrayImpl(); - - /** - * Get value on attribute memberNames - * @return the attribute's value - */ - public Object getMemberNamesImpl() { - String[] stringArrayImpl0 = getMemberNamesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute memberNames - * @return the attribute's value - */ - public final Object getMemberNames() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "memberNames", Optional.empty()); - } - Object result = this.getMemberNamesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "memberNames", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "memberNames", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * - */ - public void defNameImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def name with type String not implemented "); - } - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - public abstract Integer getNumArgsImpl(); - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - public final Object getNumArgs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "numArgs", Optional.empty()); - } - Integer result = this.getNumArgsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "numArgs", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "numArgs", e); - } - } - - /** - * the return type of the call - */ - public abstract AType getReturnTypeImpl(); - - /** - * the return type of the call - */ - public final Object getReturnType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "returnType", Optional.empty()); - } - AType result = this.getReturnTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "returnType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "returnType", e); - } - } - - /** - * similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function - */ - public abstract String getSignatureImpl(); - - /** - * similar to $function.signature, but if no function decl could be found (e.g., function from system include), returns a signature based on just the name of the function - */ - public final Object getSignature() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "signature", Optional.empty()); - } - String result = this.getSignatureImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "signature", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "signature", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select callees - * @return - */ - public List selectCallee() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select args - * @return - */ - public List selectArg() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - * @param argCode - * @param type - */ - public void addArgImpl(String argCode, AType type) { - throw new UnsupportedOperationException(get_class()+": Action addArg not implemented "); - } - - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - * @param argCode - * @param type - */ - public final void addArg(String argCode, AType type) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addArg", this, Optional.empty(), argCode, type); - } - this.addArgImpl(argCode, type); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addArg", this, Optional.empty(), argCode, type); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addArg", e); - } - } - - /** - * Adds an argument at the end of the call, creating a literal 'type' from the type string - * @param arg - * @param type - */ - public void addArgImpl(String arg, String type) { - throw new UnsupportedOperationException(get_class()+": Action addArg not implemented "); - } - - /** - * Adds an argument at the end of the call, creating a literal 'type' from the type string - * @param arg - * @param type - */ - public final void addArg(String arg, String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addArg", this, Optional.empty(), arg, type); - } - this.addArgImpl(arg, type); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addArg", this, Optional.empty(), arg, type); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addArg", e); - } - } - - /** - * Tries to inline this call - */ - public boolean inlineImpl() { - throw new UnsupportedOperationException(get_class()+": Action inline not implemented "); - } - - /** - * Tries to inline this call - */ - public final Object inline() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "inline", this, Optional.empty()); - } - boolean result = this.inlineImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "inline", this, Optional.ofNullable(result)); - } - return result; - } catch(Exception e) { - throw new ActionException(get_class(), "inline", e); - } - } - - /** - * - * @param index - * @param expr - */ - public void setArgImpl(int index, AExpression expr) { - throw new UnsupportedOperationException(get_class()+": Action setArg not implemented "); - } - - /** - * - * @param index - * @param expr - */ - public final void setArg(int index, AExpression expr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setArg", this, Optional.empty(), index, expr); - } - this.setArgImpl(index, expr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setArg", this, Optional.empty(), index, expr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setArg", e); - } - } - - /** - * - * @param index - * @param expr - */ - public void setArgFromStringImpl(int index, String expr) { - throw new UnsupportedOperationException(get_class()+": Action setArgFromString not implemented "); - } - - /** - * - * @param index - * @param expr - */ - public final void setArgFromString(int index, String expr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setArgFromString", this, Optional.empty(), index, expr); - } - this.setArgFromStringImpl(index, expr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setArgFromString", this, Optional.empty(), index, expr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setArgFromString", e); - } - } - - /** - * Changes the name of the call - * @param name - */ - public void setNameImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action setName not implemented "); - } - - /** - * Changes the name of the call - * @param name - */ - public final void setName(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setName", this, Optional.empty(), name); - } - this.setNameImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setName", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setName", e); - } - } - - /** - * Wraps this call with a possibly new wrapping function - * @param name - */ - public void wrapImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action wrap not implemented "); - } - - /** - * Wraps this call with a possibly new wrapping function - * @param name - */ - public final void wrap(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "wrap", this, Optional.empty(), name); - } - this.wrapImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "wrap", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "wrap", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "callee": - joinPointList = selectCallee(); - break; - case "arg": - joinPointList = selectArg(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("argList"); - attributes.add("args"); - attributes.add("declaration"); - attributes.add("definition"); - attributes.add("directCallee"); - attributes.add("function"); - attributes.add("functionType"); - attributes.add("getArg"); - attributes.add("isMemberAccess"); - attributes.add("isStmtCall"); - attributes.add("memberAccess"); - attributes.add("memberNames"); - attributes.add("name"); - attributes.add("numArgs"); - attributes.add("returnType"); - attributes.add("signature"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - selects.add("callee"); - selects.add("arg"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - actions.add("void addArg(String, type)"); - actions.add("void addArg(String, String)"); - actions.add("boolean inline()"); - actions.add("void setArg(int, expression)"); - actions.add("void setArgFromString(int, String)"); - actions.add("void setName(String)"); - actions.add("void wrap(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "call"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CallAttributes { - ARGLIST("argList"), - ARGS("args"), - DECLARATION("declaration"), - DEFINITION("definition"), - DIRECTCALLEE("directCallee"), - FUNCTION("function"), - FUNCTIONTYPE("functionType"), - GETARG("getArg"), - ISMEMBERACCESS("isMemberAccess"), - ISSTMTCALL("isStmtCall"), - MEMBERACCESS("memberAccess"), - MEMBERNAMES("memberNames"), - NAME("name"), - NUMARGS("numArgs"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CallAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CallAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACase.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACase.java deleted file mode 100644 index aeba2f56f1..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACase.java +++ /dev/null @@ -1,1413 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACase - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACase extends ASwitchCase { - - protected ASwitchCase aSwitchCase; - - /** - * - */ - public ACase(ASwitchCase aSwitchCase){ - super(aSwitchCase); - this.aSwitchCase = aSwitchCase; - } - /** - * Get value on attribute instructions - * @return the attribute's value - */ - public abstract AStatement[] getInstructionsArrayImpl(); - - /** - * the instructions that are associated with this case in the source code. This does not represent what instructions are actually executed (e.g., if a case does not have a break, does not show instructions of the next case) - */ - public Object getInstructionsImpl() { - AStatement[] aStatementArrayImpl0 = getInstructionsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aStatementArrayImpl0); - return nativeArray0; - } - - /** - * the instructions that are associated with this case in the source code. This does not represent what instructions are actually executed (e.g., if a case does not have a break, does not show instructions of the next case) - */ - public final Object getInstructions() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "instructions", Optional.empty()); - } - Object result = this.getInstructionsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "instructions", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "instructions", e); - } - } - - /** - * true if this is a default case, false otherwise - */ - public abstract Boolean getIsDefaultImpl(); - - /** - * true if this is a default case, false otherwise - */ - public final Object getIsDefault() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isDefault", Optional.empty()); - } - Boolean result = this.getIsDefaultImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isDefault", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isDefault", e); - } - } - - /** - * true if this case does not contain instructions (i.e., it is directly above another case), false otherwise - */ - public abstract Boolean getIsEmptyImpl(); - - /** - * true if this case does not contain instructions (i.e., it is directly above another case), false otherwise - */ - public final Object getIsEmpty() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isEmpty", Optional.empty()); - } - Boolean result = this.getIsEmptyImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isEmpty", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isEmpty", e); - } - } - - /** - * the case statement that comes after this case, or undefined if there are no more case statements - */ - public abstract ACase getNextCaseImpl(); - - /** - * the case statement that comes after this case, or undefined if there are no more case statements - */ - public final Object getNextCase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "nextCase", Optional.empty()); - } - ACase result = this.getNextCaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "nextCase", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "nextCase", e); - } - } - - /** - * the first statement that is not a case that will be executed by this case statement - */ - public abstract AStatement getNextInstructionImpl(); - - /** - * the first statement that is not a case that will be executed by this case statement - */ - public final Object getNextInstruction() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "nextInstruction", Optional.empty()); - } - AStatement result = this.getNextInstructionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "nextInstruction", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "nextInstruction", e); - } - } - - /** - * Get value on attribute values - * @return the attribute's value - */ - public abstract AExpression[] getValuesArrayImpl(); - - /** - * the values that the case statement will match. It can return zero (e.g., 'default:'), one (e.g., 'case 1:') or two (e.g., 'case 2...4:') expressions, depending on the format of the case - */ - public Object getValuesImpl() { - AExpression[] aExpressionArrayImpl0 = getValuesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * the values that the case statement will match. It can return zero (e.g., 'default:'), one (e.g., 'case 1:') or two (e.g., 'case 2...4:') expressions, depending on the format of the case - */ - public final Object getValues() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "values", Optional.empty()); - } - Object result = this.getValuesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "values", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "values", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aSwitchCase.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aSwitchCase.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aSwitchCase.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aSwitchCase.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aSwitchCase.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aSwitchCase.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aSwitchCase.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aSwitchCase.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aSwitchCase.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aSwitchCase.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aSwitchCase.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aSwitchCase.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aSwitchCase.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aSwitchCase.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aSwitchCase.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aSwitchCase.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aSwitchCase.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aSwitchCase.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aSwitchCase.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aSwitchCase.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aSwitchCase.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aSwitchCase.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aSwitchCase.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aSwitchCase.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aSwitchCase.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aSwitchCase.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aSwitchCase.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aSwitchCase.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aSwitchCase.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aSwitchCase.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aSwitchCase.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aSwitchCase.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aSwitchCase.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aSwitchCase.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aSwitchCase.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aSwitchCase.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aSwitchCase.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aSwitchCase.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aSwitchCase.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aSwitchCase.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aSwitchCase.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aSwitchCase.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aSwitchCase.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aSwitchCase.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aSwitchCase.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aSwitchCase.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aSwitchCase.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aSwitchCase.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aSwitchCase.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aSwitchCase.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aSwitchCase.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aSwitchCase.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aSwitchCase.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aSwitchCase.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aSwitchCase.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aSwitchCase.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aSwitchCase.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aSwitchCase.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aSwitchCase.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aSwitchCase.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aSwitchCase.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aSwitchCase.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aSwitchCase.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aSwitchCase.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aSwitchCase.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aSwitchCase.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aSwitchCase.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aSwitchCase.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aSwitchCase.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aSwitchCase.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aSwitchCase.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aSwitchCase.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aSwitchCase.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aSwitchCase.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aSwitchCase.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aSwitchCase.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aSwitchCase.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aSwitchCase.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aSwitchCase.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aSwitchCase.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aSwitchCase.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aSwitchCase.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aSwitchCase.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aSwitchCase.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aSwitchCase.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aSwitchCase.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aSwitchCase.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aSwitchCase.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aSwitchCase.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aSwitchCase.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aSwitchCase.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aSwitchCase.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aSwitchCase.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aSwitchCase.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aSwitchCase.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aSwitchCase.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aSwitchCase.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aSwitchCase.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aSwitchCase.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aSwitchCase.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aSwitchCase.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aSwitchCase.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aSwitchCase.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aSwitchCase); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aSwitchCase.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aSwitchCase.fillWithAttributes(attributes); - attributes.add("instructions"); - attributes.add("isDefault"); - attributes.add("isEmpty"); - attributes.add("nextCase"); - attributes.add("nextInstruction"); - attributes.add("values"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aSwitchCase.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aSwitchCase.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "case"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aSwitchCase.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CaseAttributes { - INSTRUCTIONS("instructions"), - ISDEFAULT("isDefault"), - ISEMPTY("isEmpty"), - NEXTCASE("nextCase"), - NEXTINSTRUCTION("nextInstruction"), - VALUES("values"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CaseAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CaseAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACast.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACast.java deleted file mode 100644 index 7e67749b1a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACast.java +++ /dev/null @@ -1,1210 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACast - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACast extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public ACast(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute fromType - * @return the attribute's value - */ - public abstract AType getFromTypeImpl(); - - /** - * Get value on attribute fromType - * @return the attribute's value - */ - public final Object getFromType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "fromType", Optional.empty()); - } - AType result = this.getFromTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "fromType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "fromType", e); - } - } - - /** - * [DEPRECATED: Use expr.implicitCast instead] - */ - public abstract Boolean getIsImplicitCastImpl(); - - /** - * [DEPRECATED: Use expr.implicitCast instead] - */ - public final Object getIsImplicitCast() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isImplicitCast", Optional.empty()); - } - Boolean result = this.getIsImplicitCastImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isImplicitCast", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isImplicitCast", e); - } - } - - /** - * Get value on attribute subExpr - * @return the attribute's value - */ - public abstract AExpression getSubExprImpl(); - - /** - * Get value on attribute subExpr - * @return the attribute's value - */ - public final Object getSubExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "subExpr", Optional.empty()); - } - AExpression result = this.getSubExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "subExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "subExpr", e); - } - } - - /** - * Get value on attribute toType - * @return the attribute's value - */ - public abstract AType getToTypeImpl(); - - /** - * Get value on attribute toType - * @return the attribute's value - */ - public final Object getToType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "toType", Optional.empty()); - } - AType result = this.getToTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "toType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "toType", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("fromType"); - attributes.add("isImplicitCast"); - attributes.add("subExpr"); - attributes.add("toType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "cast"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CastAttributes { - FROMTYPE("fromType"), - ISIMPLICITCAST("isImplicitCast"), - SUBEXPR("subExpr"), - TOTYPE("toType"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CastAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CastAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkFor.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkFor.java deleted file mode 100644 index e1f257fed5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkFor.java +++ /dev/null @@ -1,1681 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACilkFor - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACilkFor extends ALoop { - - protected ALoop aLoop; - - /** - * - */ - public ACilkFor(ALoop aLoop){ - super(aLoop); - this.aLoop = aLoop; - } - /** - * Get value on attribute body - * @return the attribute's value - */ - @Override - public AScope getBodyImpl() { - return this.aLoop.getBodyImpl(); - } - - /** - * Get value on attribute cond - * @return the attribute's value - */ - @Override - public AStatement getCondImpl() { - return this.aLoop.getCondImpl(); - } - - /** - * Get value on attribute condRelation - * @return the attribute's value - */ - @Override - public String getCondRelationImpl() { - return this.aLoop.getCondRelationImpl(); - } - - /** - * Get value on attribute controlVar - * @return the attribute's value - */ - @Override - public String getControlVarImpl() { - return this.aLoop.getControlVarImpl(); - } - - /** - * Get value on attribute controlVarref - * @return the attribute's value - */ - @Override - public AVarref getControlVarrefImpl() { - return this.aLoop.getControlVarrefImpl(); - } - - /** - * Get value on attribute endValue - * @return the attribute's value - */ - @Override - public String getEndValueImpl() { - return this.aLoop.getEndValueImpl(); - } - - /** - * Get value on attribute hasCondRelation - * @return the attribute's value - */ - @Override - public Boolean getHasCondRelationImpl() { - return this.aLoop.getHasCondRelationImpl(); - } - - /** - * Get value on attribute id - * @return the attribute's value - */ - @Override - public String getIdImpl() { - return this.aLoop.getIdImpl(); - } - - /** - * Get value on attribute init - * @return the attribute's value - */ - @Override - public AStatement getInitImpl() { - return this.aLoop.getInitImpl(); - } - - /** - * Get value on attribute initValue - * @return the attribute's value - */ - @Override - public String getInitValueImpl() { - return this.aLoop.getInitValueImpl(); - } - - /** - * Get value on attribute isInnermost - * @return the attribute's value - */ - @Override - public Boolean getIsInnermostImpl() { - return this.aLoop.getIsInnermostImpl(); - } - - /** - * Get value on attribute isInterchangeable - * @return the attribute's value - */ - @Override - public Boolean isInterchangeableImpl(ALoop otherLoop) { - return this.aLoop.isInterchangeableImpl(otherLoop); - } - - /** - * Get value on attribute isOutermost - * @return the attribute's value - */ - @Override - public Boolean getIsOutermostImpl() { - return this.aLoop.getIsOutermostImpl(); - } - - /** - * Get value on attribute isParallel - * @return the attribute's value - */ - @Override - public Boolean getIsParallelImpl() { - return this.aLoop.getIsParallelImpl(); - } - - /** - * Get value on attribute iterations - * @return the attribute's value - */ - @Override - public Integer getIterationsImpl() { - return this.aLoop.getIterationsImpl(); - } - - /** - * Get value on attribute iterationsExpr - * @return the attribute's value - */ - @Override - public AExpression getIterationsExprImpl() { - return this.aLoop.getIterationsExprImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aLoop.getKindImpl(); - } - - /** - * Get value on attribute nestedLevel - * @return the attribute's value - */ - @Override - public Integer getNestedLevelImpl() { - return this.aLoop.getNestedLevelImpl(); - } - - /** - * Get value on attribute rankArrayImpl - * @return the attribute's value - */ - @Override - public int[] getRankArrayImpl() { - return this.aLoop.getRankArrayImpl(); - } - - /** - * Get value on attribute step - * @return the attribute's value - */ - @Override - public AStatement getStepImpl() { - return this.aLoop.getStepImpl(); - } - - /** - * Get value on attribute stepValue - * @return the attribute's value - */ - @Override - public String getStepValueImpl() { - return this.aLoop.getStepValueImpl(); - } - - /** - * Method used by the lara interpreter to select inits - * @return - */ - @Override - public List selectInit() { - return this.aLoop.selectInit(); - } - - /** - * Method used by the lara interpreter to select conds - * @return - */ - @Override - public List selectCond() { - return this.aLoop.selectCond(); - } - - /** - * Method used by the lara interpreter to select steps - * @return - */ - @Override - public List selectStep() { - return this.aLoop.selectStep(); - } - - /** - * Method used by the lara interpreter to select bodys - * @return - */ - @Override - public List selectBody() { - return this.aLoop.selectBody(); - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aLoop.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aLoop.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aLoop.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aLoop.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aLoop.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aLoop.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aLoop.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aLoop.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aLoop.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aLoop.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aLoop.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aLoop.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aLoop.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aLoop.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aLoop.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aLoop.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aLoop.selectCilkSpawn(); - } - - /** - * - */ - public void defBodyImpl(AScope value) { - this.aLoop.defBodyImpl(value); - } - - /** - * - */ - public void defCondRelationImpl(String value) { - this.aLoop.defCondRelationImpl(value); - } - - /** - * - */ - public void defInitImpl(String value) { - this.aLoop.defInitImpl(value); - } - - /** - * - */ - public void defInitValueImpl(String value) { - this.aLoop.defInitValueImpl(value); - } - - /** - * - */ - public void defIsParallelImpl(Boolean value) { - this.aLoop.defIsParallelImpl(value); - } - - /** - * - */ - public void defIsParallelImpl(String value) { - this.aLoop.defIsParallelImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aLoop.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aLoop.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aLoop.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aLoop.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aLoop.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aLoop.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aLoop.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aLoop.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aLoop.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aLoop.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aLoop.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aLoop.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aLoop.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aLoop.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aLoop.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aLoop.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aLoop.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aLoop.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aLoop.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aLoop.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aLoop.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aLoop.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aLoop.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aLoop.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aLoop.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aLoop.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aLoop.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aLoop.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aLoop.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aLoop.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aLoop.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aLoop.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aLoop.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aLoop.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aLoop.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aLoop.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aLoop.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aLoop.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aLoop.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aLoop.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aLoop.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aLoop.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aLoop.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aLoop.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aLoop.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aLoop.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aLoop.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aLoop.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aLoop.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aLoop.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aLoop.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aLoop.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aLoop.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aLoop.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aLoop.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aLoop.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aLoop.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aLoop.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aLoop.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aLoop.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aLoop.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aLoop.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aLoop.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aLoop.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aLoop.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aLoop.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aLoop.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aLoop.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aLoop.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aLoop.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aLoop.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aLoop.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aLoop.insertBeforeImpl(node); - } - - /** - * Interchanges two for loops, if possible - * @param otherLoop - */ - @Override - public void interchangeImpl(ALoop otherLoop) { - this.aLoop.interchangeImpl(otherLoop); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aLoop.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aLoop.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aLoop.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aLoop.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aLoop.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aLoop.replaceWithStringsImpl(node); - } - - /** - * Sets the body of the loop - * @param body - */ - @Override - public void setBodyImpl(AScope body) { - this.aLoop.setBodyImpl(body); - } - - /** - * Sets the conditional statement of the loop. Works with loops of kind 'for' - * @param condCode - */ - @Override - public void setCondImpl(String condCode) { - this.aLoop.setCondImpl(condCode); - } - - /** - * Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge - * @param operator - */ - @Override - public void setCondRelationImpl(String operator) { - this.aLoop.setCondRelationImpl(operator); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aLoop.setDataImpl(source); - } - - /** - * Sets the end value of the loop. Works with loops of kind 'for' - * @param initCode - */ - @Override - public void setEndValueImpl(String initCode) { - this.aLoop.setEndValueImpl(initCode); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aLoop.setFirstChildImpl(node); - } - - /** - * Sets the init statement of the loop - * @param initCode - */ - @Override - public void setInitImpl(String initCode) { - this.aLoop.setInitImpl(initCode); - } - - /** - * Sets the init value of the loop. Works with loops of kind 'for' - * @param initCode - */ - @Override - public void setInitValueImpl(String initCode) { - this.aLoop.setInitValueImpl(initCode); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aLoop.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aLoop.setInlineCommentsImpl(comments); - } - - /** - * Sets the attribute 'isParallel' of the loop - * @param isParallel - */ - @Override - public void setIsParallelImpl(Boolean isParallel) { - this.aLoop.setIsParallelImpl(isParallel); - } - - /** - * Sets the kind of the loop - * @param kind - */ - @Override - public void setKindImpl(String kind) { - this.aLoop.setKindImpl(kind); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aLoop.setLastChildImpl(node); - } - - /** - * Sets the step statement of the loop. Works with loops of kind 'for' - * @param stepCode - */ - @Override - public void setStepImpl(String stepCode) { - this.aLoop.setStepImpl(stepCode); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aLoop.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aLoop.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aLoop.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aLoop.setValueImpl(key, value); - } - - /** - * Applies loop tiling to this loop. - * @param blockSize - * @param reference - * @param useTernary - */ - @Override - public AStatement tileImpl(String blockSize, AStatement reference, Boolean useTernary) { - return this.aLoop.tileImpl(blockSize, reference, useTernary); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aLoop.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aLoop); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "init": - joinPointList = selectInit(); - break; - case "cond": - joinPointList = selectCond(); - break; - case "step": - joinPointList = selectStep(); - break; - case "body": - joinPointList = selectBody(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aLoop.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "body": { - if(value instanceof AScope){ - this.defBodyImpl((AScope)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "condRelation": { - if(value instanceof String){ - this.defCondRelationImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "init": { - if(value instanceof String){ - this.defInitImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "initValue": { - if(value instanceof String){ - this.defInitValueImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "isParallel": { - if(value instanceof Boolean){ - this.defIsParallelImpl((Boolean)value); - return; - } - if(value instanceof String){ - this.defIsParallelImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aLoop.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aLoop.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aLoop.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "cilkFor"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aLoop.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CilkForAttributes { - BODY("body"), - COND("cond"), - CONDRELATION("condRelation"), - CONTROLVAR("controlVar"), - CONTROLVARREF("controlVarref"), - ENDVALUE("endValue"), - HASCONDRELATION("hasCondRelation"), - ID("id"), - INIT("init"), - INITVALUE("initValue"), - ISINNERMOST("isInnermost"), - ISINTERCHANGEABLE("isInterchangeable"), - ISOUTERMOST("isOutermost"), - ISPARALLEL("isParallel"), - ITERATIONS("iterations"), - ITERATIONSEXPR("iterationsExpr"), - KIND("kind"), - NESTEDLEVEL("nestedLevel"), - RANK("rank"), - STEP("step"), - STEPVALUE("stepValue"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CilkForAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CilkForAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSpawn.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSpawn.java deleted file mode 100644 index e61fb148cc..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSpawn.java +++ /dev/null @@ -1,1367 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACilkSpawn - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACilkSpawn extends ACall { - - protected ACall aCall; - - /** - * - */ - public ACilkSpawn(ACall aCall){ - super(aCall); - this.aCall = aCall; - } - /** - * Get value on attribute argListArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgListArrayImpl() { - return this.aCall.getArgListArrayImpl(); - } - - /** - * Get value on attribute argsArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgsArrayImpl() { - return this.aCall.getArgsArrayImpl(); - } - - /** - * Get value on attribute declaration - * @return the attribute's value - */ - @Override - public AFunction getDeclarationImpl() { - return this.aCall.getDeclarationImpl(); - } - - /** - * Get value on attribute definition - * @return the attribute's value - */ - @Override - public AFunction getDefinitionImpl() { - return this.aCall.getDefinitionImpl(); - } - - /** - * Get value on attribute directCallee - * @return the attribute's value - */ - @Override - public AFunction getDirectCalleeImpl() { - return this.aCall.getDirectCalleeImpl(); - } - - /** - * Get value on attribute function - * @return the attribute's value - */ - @Override - public AFunction getFunctionImpl() { - return this.aCall.getFunctionImpl(); - } - - /** - * Get value on attribute functionType - * @return the attribute's value - */ - @Override - public AFunctionType getFunctionTypeImpl() { - return this.aCall.getFunctionTypeImpl(); - } - - /** - * Get value on attribute getArg - * @return the attribute's value - */ - @Override - public AExpression getArgImpl(int index) { - return this.aCall.getArgImpl(index); - } - - /** - * Get value on attribute isMemberAccess - * @return the attribute's value - */ - @Override - public Boolean getIsMemberAccessImpl() { - return this.aCall.getIsMemberAccessImpl(); - } - - /** - * Get value on attribute isStmtCall - * @return the attribute's value - */ - @Override - public Boolean getIsStmtCallImpl() { - return this.aCall.getIsStmtCallImpl(); - } - - /** - * Get value on attribute memberAccess - * @return the attribute's value - */ - @Override - public AMemberAccess getMemberAccessImpl() { - return this.aCall.getMemberAccessImpl(); - } - - /** - * Get value on attribute memberNamesArrayImpl - * @return the attribute's value - */ - @Override - public String[] getMemberNamesArrayImpl() { - return this.aCall.getMemberNamesArrayImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aCall.getNameImpl(); - } - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - @Override - public Integer getNumArgsImpl() { - return this.aCall.getNumArgsImpl(); - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - @Override - public AType getReturnTypeImpl() { - return this.aCall.getReturnTypeImpl(); - } - - /** - * Get value on attribute signature - * @return the attribute's value - */ - @Override - public String getSignatureImpl() { - return this.aCall.getSignatureImpl(); - } - - /** - * Method used by the lara interpreter to select callees - * @return - */ - @Override - public List selectCallee() { - return this.aCall.selectCallee(); - } - - /** - * Method used by the lara interpreter to select args - * @return - */ - @Override - public List selectArg() { - return this.aCall.selectArg(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aCall.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aCall.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aCall.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aCall.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aCall.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aCall.selectVardecl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aCall.defNameImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aCall.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aCall.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aCall.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aCall.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aCall.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aCall.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aCall.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aCall.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aCall.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aCall.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aCall.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aCall.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aCall.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aCall.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aCall.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aCall.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aCall.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aCall.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aCall.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aCall.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aCall.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aCall.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aCall.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aCall.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aCall.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aCall.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aCall.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aCall.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aCall.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aCall.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aCall.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aCall.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aCall.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aCall.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aCall.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aCall.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aCall.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aCall.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aCall.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aCall.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aCall.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aCall.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aCall.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aCall.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aCall.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aCall.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aCall.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aCall.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aCall.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aCall.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aCall.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aCall.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aCall.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aCall.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aCall.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aCall.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aCall.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aCall.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aCall.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aCall.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aCall.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aCall.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aCall.getTypeImpl(); - } - - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - * @param argCode - * @param type - */ - @Override - public void addArgImpl(String argCode, AType type) { - this.aCall.addArgImpl(argCode, type); - } - - /** - * Adds an argument at the end of the call, creating a literal 'type' from the type string - * @param arg - * @param type - */ - @Override - public void addArgImpl(String arg, String type) { - this.aCall.addArgImpl(arg, type); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aCall.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aCall.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aCall.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aCall.detachImpl(); - } - - /** - * Tries to inline this call - */ - @Override - public boolean inlineImpl() { - return this.aCall.inlineImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aCall.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aCall.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aCall.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aCall.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aCall.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aCall.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aCall.replaceWithStringsImpl(node); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgImpl(int index, AExpression expr) { - this.aCall.setArgImpl(index, expr); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgFromStringImpl(int index, String expr) { - this.aCall.setArgFromStringImpl(index, expr); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aCall.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aCall.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aCall.setLastChildImpl(node); - } - - /** - * Changes the name of the call - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aCall.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aCall.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aCall.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aCall.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aCall.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aCall.toCommentImpl(prefix, suffix); - } - - /** - * Wraps this call with a possibly new wrapping function - * @param name - */ - @Override - public void wrapImpl(String name) { - this.aCall.wrapImpl(name); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aCall); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "callee": - joinPointList = selectCallee(); - break; - case "arg": - joinPointList = selectArg(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aCall.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aCall.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aCall.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aCall.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "cilkSpawn"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aCall.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CilkSpawnAttributes { - ARGLIST("argList"), - ARGS("args"), - DECLARATION("declaration"), - DEFINITION("definition"), - DIRECTCALLEE("directCallee"), - FUNCTION("function"), - FUNCTIONTYPE("functionType"), - GETARG("getArg"), - ISMEMBERACCESS("isMemberAccess"), - ISSTMTCALL("isStmtCall"), - MEMBERACCESS("memberAccess"), - MEMBERNAMES("memberNames"), - NAME("name"), - NUMARGS("numArgs"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CilkSpawnAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CilkSpawnAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSync.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSync.java deleted file mode 100644 index c9cfe00131..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACilkSync.java +++ /dev/null @@ -1,1240 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACilkSync - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACilkSync extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ACilkSync(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "cilkSync"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CilkSyncAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CilkSyncAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CilkSyncAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClass.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClass.java deleted file mode 100644 index 1269676b9e..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClass.java +++ /dev/null @@ -1,1574 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AClass - * This class is overwritten by the Weaver Generator. - * - * Represents a C++ class - * @author Lara Weaver Generator - */ -public abstract class AClass extends ARecord { - - protected ARecord aRecord; - - /** - * - */ - public AClass(ARecord aRecord){ - super(aRecord); - this.aRecord = aRecord; - } - /** - * Get value on attribute allBases - * @return the attribute's value - */ - public abstract AClass[] getAllBasesArrayImpl(); - - /** - * All the classes this class inherits from - */ - public Object getAllBasesImpl() { - AClass[] aClassArrayImpl0 = getAllBasesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aClassArrayImpl0); - return nativeArray0; - } - - /** - * All the classes this class inherits from - */ - public final Object getAllBases() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "allBases", Optional.empty()); - } - Object result = this.getAllBasesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "allBases", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "allBases", e); - } - } - - /** - * Get value on attribute allMethods - * @return the attribute's value - */ - public abstract AMethod[] getAllMethodsArrayImpl(); - - /** - * All the methods of this class, including inherited ones - */ - public Object getAllMethodsImpl() { - AMethod[] aMethodArrayImpl0 = getAllMethodsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aMethodArrayImpl0); - return nativeArray0; - } - - /** - * All the methods of this class, including inherited ones - */ - public final Object getAllMethods() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "allMethods", Optional.empty()); - } - Object result = this.getAllMethodsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "allMethods", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "allMethods", e); - } - } - - /** - * Get value on attribute bases - * @return the attribute's value - */ - public abstract AClass[] getBasesArrayImpl(); - - /** - * The classes this class directly inherits from - */ - public Object getBasesImpl() { - AClass[] aClassArrayImpl0 = getBasesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aClassArrayImpl0); - return nativeArray0; - } - - /** - * The classes this class directly inherits from - */ - public final Object getBases() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "bases", Optional.empty()); - } - Object result = this.getBasesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "bases", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "bases", e); - } - } - - /** - * Class join points can either represent declarations or definitions, returns the definition of this class, if present, or the first declaration, if only declarations are present - */ - public abstract AClass getCanonicalImpl(); - - /** - * Class join points can either represent declarations or definitions, returns the definition of this class, if present, or the first declaration, if only declarations are present - */ - public final Object getCanonical() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "canonical", Optional.empty()); - } - AClass result = this.getCanonicalImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "canonical", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "canonical", e); - } - } - - /** - * The implementation (or definition) of this class present in the AST, or undefined if none is found - */ - public abstract AClass getImplementationImpl(); - - /** - * The implementation (or definition) of this class present in the AST, or undefined if none is found - */ - public final Object getImplementation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "implementation", Optional.empty()); - } - AClass result = this.getImplementationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "implementation", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "implementation", e); - } - } - - /** - * True, if contains at least one pure function - */ - public abstract Boolean getIsAbstractImpl(); - - /** - * True, if contains at least one pure function - */ - public final Object getIsAbstract() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isAbstract", Optional.empty()); - } - Boolean result = this.getIsAbstractImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isAbstract", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isAbstract", e); - } - } - - /** - * true if this is the class returned by the 'canonical' attribute - */ - public abstract Boolean getIsCanonicalImpl(); - - /** - * true if this is the class returned by the 'canonical' attribute - */ - public final Object getIsCanonical() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCanonical", Optional.empty()); - } - Boolean result = this.getIsCanonicalImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCanonical", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCanonical", e); - } - } - - /** - * True, if all functions are pure - */ - public abstract Boolean getIsInterfaceImpl(); - - /** - * True, if all functions are pure - */ - public final Object getIsInterface() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInterface", Optional.empty()); - } - Boolean result = this.getIsInterfaceImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInterface", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInterface", e); - } - } - - /** - * Get value on attribute methods - * @return the attribute's value - */ - public abstract AMethod[] getMethodsArrayImpl(); - - /** - * The methods declared by this class - */ - public Object getMethodsImpl() { - AMethod[] aMethodArrayImpl0 = getMethodsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aMethodArrayImpl0); - return nativeArray0; - } - - /** - * The methods declared by this class - */ - public final Object getMethods() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "methods", Optional.empty()); - } - Object result = this.getMethodsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "methods", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "methods", e); - } - } - - /** - * Get value on attribute prototypes - * @return the attribute's value - */ - public abstract AClass[] getPrototypesArrayImpl(); - - /** - * The prototypes (or declarations) of this class present in the AST, if any - */ - public Object getPrototypesImpl() { - AClass[] aClassArrayImpl0 = getPrototypesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aClassArrayImpl0); - return nativeArray0; - } - - /** - * The prototypes (or declarations) of this class present in the AST, if any - */ - public final Object getPrototypes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "prototypes", Optional.empty()); - } - Object result = this.getPrototypesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "prototypes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "prototypes", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select methods - * @return - */ - public List selectMethod() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMethod.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a method to a class. If the given method has a definition, creates an equivalent declaration and adds it to the class, otherwise simply added the declaration to the class. In both cases, the declaration is only added to the class if there is no declaration already with the same signature. - * @param method - */ - public void addMethodImpl(AMethod method) { - throw new UnsupportedOperationException(get_class()+": Action addMethod not implemented "); - } - - /** - * Adds a method to a class. If the given method has a definition, creates an equivalent declaration and adds it to the class, otherwise simply added the declaration to the class. In both cases, the declaration is only added to the class if there is no declaration already with the same signature. - * @param method - */ - public final void addMethod(AMethod method) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addMethod", this, Optional.empty(), method); - } - this.addMethodImpl(method); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addMethod", this, Optional.empty(), method); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addMethod", e); - } - } - - /** - * Get value on attribute fieldsArrayImpl - * @return the attribute's value - */ - @Override - public AField[] getFieldsArrayImpl() { - return this.aRecord.getFieldsArrayImpl(); - } - - /** - * Get value on attribute functionsArrayImpl - * @return the attribute's value - */ - @Override - public AFunction[] getFunctionsArrayImpl() { - return this.aRecord.getFunctionsArrayImpl(); - } - - /** - * Get value on attribute isImplementation - * @return the attribute's value - */ - @Override - public Boolean getIsImplementationImpl() { - return this.aRecord.getIsImplementationImpl(); - } - - /** - * Get value on attribute isPrototype - * @return the attribute's value - */ - @Override - public Boolean getIsPrototypeImpl() { - return this.aRecord.getIsPrototypeImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aRecord.getKindImpl(); - } - - /** - * Method used by the lara interpreter to select fields - * @return - */ - @Override - public List selectField() { - return this.aRecord.selectField(); - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aRecord.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aRecord.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aRecord.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aRecord.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aRecord.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aRecord.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aRecord.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aRecord.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aRecord.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aRecord.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aRecord.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aRecord.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aRecord.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aRecord.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aRecord.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aRecord.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aRecord.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aRecord.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aRecord.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aRecord.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aRecord.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aRecord.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aRecord.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aRecord.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aRecord.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aRecord.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aRecord.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aRecord.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aRecord.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aRecord.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aRecord.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aRecord.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aRecord.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aRecord.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aRecord.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aRecord.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aRecord.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aRecord.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aRecord.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aRecord.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aRecord.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aRecord.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aRecord.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aRecord.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aRecord.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aRecord.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aRecord.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aRecord.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aRecord.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aRecord.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aRecord.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aRecord.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aRecord.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aRecord.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aRecord.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aRecord.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aRecord.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aRecord.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aRecord.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aRecord.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aRecord.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aRecord.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aRecord.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aRecord.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aRecord.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aRecord.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aRecord.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aRecord.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aRecord.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aRecord.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aRecord.getTypeImpl(); - } - - /** - * Adds a field to a record (struct, class). - * @param field - */ - @Override - public void addFieldImpl(AField field) { - this.aRecord.addFieldImpl(field); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aRecord.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aRecord.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aRecord.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aRecord.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aRecord.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aRecord.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aRecord.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aRecord.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aRecord.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aRecord.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aRecord.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aRecord.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aRecord.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aRecord.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aRecord.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aRecord.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aRecord.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aRecord.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aRecord.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aRecord.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aRecord.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aRecord.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aRecord.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aRecord.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aRecord.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aRecord.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aRecord); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "method": - joinPointList = selectMethod(); - break; - case "field": - joinPointList = selectField(); - break; - default: - joinPointList = this.aRecord.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aRecord.fillWithAttributes(attributes); - attributes.add("allBases"); - attributes.add("allMethods"); - attributes.add("bases"); - attributes.add("canonical"); - attributes.add("implementation"); - attributes.add("isAbstract"); - attributes.add("isCanonical"); - attributes.add("isInterface"); - attributes.add("methods"); - attributes.add("prototypes"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aRecord.fillWithSelects(selects); - selects.add("method"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aRecord.fillWithActions(actions); - actions.add("void addMethod(method)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "class"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aRecord.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ClassAttributes { - ALLBASES("allBases"), - ALLMETHODS("allMethods"), - BASES("bases"), - CANONICAL("canonical"), - IMPLEMENTATION("implementation"), - ISABSTRACT("isAbstract"), - ISCANONICAL("isCanonical"), - ISINTERFACE("isInterface"), - METHODS("methods"), - PROTOTYPES("prototypes"), - FIELDS("fields"), - FUNCTIONS("functions"), - ISIMPLEMENTATION("isImplementation"), - ISPROTOTYPE("isPrototype"), - KIND("kind"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ClassAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ClassAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClavaException.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClavaException.java deleted file mode 100644 index b90d3fc142..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AClavaException.java +++ /dev/null @@ -1,293 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AClavaException - * This class is overwritten by the Weaver Generator. - * - * Utility joinpoint, to represent certain problems when generating join points - * @author Lara Weaver Generator - */ -public abstract class AClavaException extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute exception - * @return the attribute's value - */ - public abstract Object getExceptionImpl(); - - /** - * Get value on attribute exception - * @return the attribute's value - */ - public final Object getException() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "exception", Optional.empty()); - } - Object result = this.getExceptionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "exception", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "exception", e); - } - } - - /** - * Get value on attribute exceptionType - * @return the attribute's value - */ - public abstract String getExceptionTypeImpl(); - - /** - * Get value on attribute exceptionType - * @return the attribute's value - */ - public final Object getExceptionType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "exceptionType", Optional.empty()); - } - String result = this.getExceptionTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "exceptionType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "exceptionType", e); - } - } - - /** - * Get value on attribute message - * @return the attribute's value - */ - public abstract String getMessageImpl(); - - /** - * Get value on attribute message - * @return the attribute's value - */ - public final Object getMessage() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "message", Optional.empty()); - } - String result = this.getMessageImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "message", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "message", e); - } - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("exception"); - attributes.add("exceptionType"); - attributes.add("message"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "clavaException"; - } - /** - * - */ - protected enum ClavaExceptionAttributes { - EXCEPTION("exception"), - EXCEPTIONTYPE("exceptionType"), - MESSAGE("message"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ClavaExceptionAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ClavaExceptionAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AComment.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AComment.java deleted file mode 100644 index c2bcfca5f5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AComment.java +++ /dev/null @@ -1,281 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AComment - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AComment extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute text - * @return the attribute's value - */ - public abstract String getTextImpl(); - - /** - * Get value on attribute text - * @return the attribute's value - */ - public final Object getText() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "text", Optional.empty()); - } - String result = this.getTextImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "text", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "text", e); - } - } - - /** - * - */ - public void defTextImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def text with type String not implemented "); - } - - /** - * - * @param text - */ - public void setTextImpl(String text) { - throw new UnsupportedOperationException(get_class()+": Action setText not implemented "); - } - - /** - * - * @param text - */ - public final void setText(String text) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setText", this, Optional.empty(), text); - } - this.setTextImpl(text); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setText", this, Optional.empty(), text); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setText", e); - } - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "text": { - if(value instanceof String){ - this.defTextImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("text"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - actions.add("void setText(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "comment"; - } - /** - * - */ - protected enum CommentAttributes { - TEXT("text"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CommentAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CommentAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AContinue.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AContinue.java deleted file mode 100644 index b5147076a1..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AContinue.java +++ /dev/null @@ -1,1240 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AContinue - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AContinue extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AContinue(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "continue"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ContinueAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ContinueAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ContinueAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACudaKernelCall.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACudaKernelCall.java deleted file mode 100644 index a59b550008..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ACudaKernelCall.java +++ /dev/null @@ -1,1475 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ACudaKernelCall - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ACudaKernelCall extends ACall { - - protected ACall aCall; - - /** - * - */ - public ACudaKernelCall(ACall aCall){ - super(aCall); - this.aCall = aCall; - } - /** - * Get value on attribute config - * @return the attribute's value - */ - public abstract AExpression[] getConfigArrayImpl(); - - /** - * Get value on attribute config - * @return the attribute's value - */ - public Object getConfigImpl() { - AExpression[] aExpressionArrayImpl0 = getConfigArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute config - * @return the attribute's value - */ - public final Object getConfig() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "config", Optional.empty()); - } - Object result = this.getConfigImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "config", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "config", e); - } - } - - /** - * - */ - public void defConfigImpl(AExpression[] value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def config with type AExpression not implemented "); - } - - /** - * - * @param args - */ - public void setConfigImpl(AExpression[] args) { - throw new UnsupportedOperationException(get_class()+": Action setConfig not implemented "); - } - - /** - * - * @param args - */ - public final void setConfig(Object[] args) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setConfig", this, Optional.empty(), new Object[] { args}); - } - this.setConfigImpl(pt.up.fe.specs.util.SpecsCollections.cast(args, AExpression.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setConfig", this, Optional.empty(), new Object[] { args}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setConfig", e); - } - } - - /** - * - * @param args - */ - public void setConfigFromStringsImpl(String[] args) { - throw new UnsupportedOperationException(get_class()+": Action setConfigFromStrings not implemented "); - } - - /** - * - * @param args - */ - public final void setConfigFromStrings(Object[] args) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setConfigFromStrings", this, Optional.empty(), new Object[] { args}); - } - this.setConfigFromStringsImpl(pt.up.fe.specs.util.SpecsCollections.cast(args, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setConfigFromStrings", this, Optional.empty(), new Object[] { args}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setConfigFromStrings", e); - } - } - - /** - * Get value on attribute argListArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgListArrayImpl() { - return this.aCall.getArgListArrayImpl(); - } - - /** - * Get value on attribute argsArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgsArrayImpl() { - return this.aCall.getArgsArrayImpl(); - } - - /** - * Get value on attribute declaration - * @return the attribute's value - */ - @Override - public AFunction getDeclarationImpl() { - return this.aCall.getDeclarationImpl(); - } - - /** - * Get value on attribute definition - * @return the attribute's value - */ - @Override - public AFunction getDefinitionImpl() { - return this.aCall.getDefinitionImpl(); - } - - /** - * Get value on attribute directCallee - * @return the attribute's value - */ - @Override - public AFunction getDirectCalleeImpl() { - return this.aCall.getDirectCalleeImpl(); - } - - /** - * Get value on attribute function - * @return the attribute's value - */ - @Override - public AFunction getFunctionImpl() { - return this.aCall.getFunctionImpl(); - } - - /** - * Get value on attribute functionType - * @return the attribute's value - */ - @Override - public AFunctionType getFunctionTypeImpl() { - return this.aCall.getFunctionTypeImpl(); - } - - /** - * Get value on attribute getArg - * @return the attribute's value - */ - @Override - public AExpression getArgImpl(int index) { - return this.aCall.getArgImpl(index); - } - - /** - * Get value on attribute isMemberAccess - * @return the attribute's value - */ - @Override - public Boolean getIsMemberAccessImpl() { - return this.aCall.getIsMemberAccessImpl(); - } - - /** - * Get value on attribute isStmtCall - * @return the attribute's value - */ - @Override - public Boolean getIsStmtCallImpl() { - return this.aCall.getIsStmtCallImpl(); - } - - /** - * Get value on attribute memberAccess - * @return the attribute's value - */ - @Override - public AMemberAccess getMemberAccessImpl() { - return this.aCall.getMemberAccessImpl(); - } - - /** - * Get value on attribute memberNamesArrayImpl - * @return the attribute's value - */ - @Override - public String[] getMemberNamesArrayImpl() { - return this.aCall.getMemberNamesArrayImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aCall.getNameImpl(); - } - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - @Override - public Integer getNumArgsImpl() { - return this.aCall.getNumArgsImpl(); - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - @Override - public AType getReturnTypeImpl() { - return this.aCall.getReturnTypeImpl(); - } - - /** - * Get value on attribute signature - * @return the attribute's value - */ - @Override - public String getSignatureImpl() { - return this.aCall.getSignatureImpl(); - } - - /** - * Method used by the lara interpreter to select callees - * @return - */ - @Override - public List selectCallee() { - return this.aCall.selectCallee(); - } - - /** - * Method used by the lara interpreter to select args - * @return - */ - @Override - public List selectArg() { - return this.aCall.selectArg(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aCall.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aCall.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aCall.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aCall.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aCall.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aCall.selectVardecl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aCall.defNameImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aCall.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aCall.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aCall.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aCall.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aCall.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aCall.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aCall.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aCall.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aCall.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aCall.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aCall.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aCall.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aCall.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aCall.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aCall.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aCall.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aCall.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aCall.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aCall.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aCall.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aCall.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aCall.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aCall.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aCall.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aCall.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aCall.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aCall.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aCall.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aCall.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aCall.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aCall.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aCall.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aCall.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aCall.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aCall.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aCall.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aCall.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aCall.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aCall.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aCall.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aCall.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aCall.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aCall.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aCall.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aCall.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aCall.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aCall.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aCall.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aCall.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aCall.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aCall.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aCall.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aCall.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aCall.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aCall.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aCall.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aCall.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aCall.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aCall.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aCall.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aCall.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aCall.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aCall.getTypeImpl(); - } - - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - * @param argCode - * @param type - */ - @Override - public void addArgImpl(String argCode, AType type) { - this.aCall.addArgImpl(argCode, type); - } - - /** - * Adds an argument at the end of the call, creating a literal 'type' from the type string - * @param arg - * @param type - */ - @Override - public void addArgImpl(String arg, String type) { - this.aCall.addArgImpl(arg, type); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aCall.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aCall.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aCall.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aCall.detachImpl(); - } - - /** - * Tries to inline this call - */ - @Override - public boolean inlineImpl() { - return this.aCall.inlineImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aCall.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aCall.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aCall.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aCall.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aCall.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aCall.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aCall.replaceWithStringsImpl(node); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgImpl(int index, AExpression expr) { - this.aCall.setArgImpl(index, expr); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgFromStringImpl(int index, String expr) { - this.aCall.setArgFromStringImpl(index, expr); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aCall.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aCall.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aCall.setLastChildImpl(node); - } - - /** - * Changes the name of the call - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aCall.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aCall.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aCall.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aCall.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aCall.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aCall.toCommentImpl(prefix, suffix); - } - - /** - * Wraps this call with a possibly new wrapping function - * @param name - */ - @Override - public void wrapImpl(String name) { - this.aCall.wrapImpl(name); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aCall); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "callee": - joinPointList = selectCallee(); - break; - case "arg": - joinPointList = selectArg(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aCall.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "config": { - if(value instanceof AExpression[]){ - this.defConfigImpl((AExpression[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aCall.fillWithAttributes(attributes); - attributes.add("config"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aCall.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aCall.fillWithActions(actions); - actions.add("void setConfig(expression[])"); - actions.add("void setConfigFromStrings(String[])"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "cudaKernelCall"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aCall.instanceOf(joinpointClass); - } - /** - * - */ - protected enum CudaKernelCallAttributes { - CONFIG("config"), - ARGLIST("argList"), - ARGS("args"), - DECLARATION("declaration"), - DEFINITION("definition"), - DIRECTCALLEE("directCallee"), - FUNCTION("function"), - FUNCTIONTYPE("functionType"), - GETARG("getArg"), - ISMEMBERACCESS("isMemberAccess"), - ISSTMTCALL("isStmtCall"), - MEMBERACCESS("memberAccess"), - MEMBERNAMES("memberNames"), - NAME("name"), - NUMARGS("numArgs"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private CudaKernelCallAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(CudaKernelCallAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADecl.java deleted file mode 100644 index 5b7b50f788..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADecl.java +++ /dev/null @@ -1,247 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ADecl - * This class is overwritten by the Weaver Generator. - * - * Represents one declaration (e.g., int foo(){return 0;}) or definition (e.g., int foo();) in the code - * @author Lara Weaver Generator - */ -public abstract class ADecl extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute attrs - * @return the attribute's value - */ - public abstract AAttribute[] getAttrsArrayImpl(); - - /** - * The attributes (e.g. Pure, CUDAGlobal) associated to this decl - */ - public Object getAttrsImpl() { - AAttribute[] aAttributeArrayImpl0 = getAttrsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aAttributeArrayImpl0); - return nativeArray0; - } - - /** - * The attributes (e.g. Pure, CUDAGlobal) associated to this decl - */ - public final Object getAttrs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "attrs", Optional.empty()); - } - Object result = this.getAttrsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "attrs", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "attrs", e); - } - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("attrs"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "decl"; - } - /** - * - */ - protected enum DeclAttributes { - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private DeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(DeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclStmt.java deleted file mode 100644 index 78f775cd50..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclStmt.java +++ /dev/null @@ -1,1277 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ADeclStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ADeclStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ADeclStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute decls - * @return the attribute's value - */ - public abstract ADecl[] getDeclsArrayImpl(); - - /** - * The declarations in this statement - */ - public Object getDeclsImpl() { - ADecl[] aDeclArrayImpl0 = getDeclsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aDeclArrayImpl0); - return nativeArray0; - } - - /** - * The declarations in this statement - */ - public final Object getDecls() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "decls", Optional.empty()); - } - Object result = this.getDeclsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "decls", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "decls", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("decls"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "declStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum DeclStmtAttributes { - DECLS("decls"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private DeclStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(DeclStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclarator.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclarator.java deleted file mode 100644 index 904cd86621..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeclarator.java +++ /dev/null @@ -1,1160 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ADeclarator - * This class is overwritten by the Weaver Generator. - * - * Represents a decl that comes from a declarator (e.g., function, field, variable) - * @author Lara Weaver Generator - */ -public abstract class ADeclarator extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public ADeclarator(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "declarator"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum DeclaratorAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private DeclaratorAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(DeclaratorAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADefault.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADefault.java deleted file mode 100644 index 4f4366f70a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADefault.java +++ /dev/null @@ -1,1241 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ADefault - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ADefault extends ASwitchCase { - - protected ASwitchCase aSwitchCase; - - /** - * - */ - public ADefault(ASwitchCase aSwitchCase){ - super(aSwitchCase); - this.aSwitchCase = aSwitchCase; - } - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aSwitchCase.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aSwitchCase.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aSwitchCase.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aSwitchCase.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aSwitchCase.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aSwitchCase.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aSwitchCase.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aSwitchCase.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aSwitchCase.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aSwitchCase.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aSwitchCase.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aSwitchCase.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aSwitchCase.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aSwitchCase.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aSwitchCase.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aSwitchCase.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aSwitchCase.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aSwitchCase.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aSwitchCase.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aSwitchCase.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aSwitchCase.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aSwitchCase.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aSwitchCase.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aSwitchCase.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aSwitchCase.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aSwitchCase.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aSwitchCase.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aSwitchCase.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aSwitchCase.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aSwitchCase.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aSwitchCase.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aSwitchCase.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aSwitchCase.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aSwitchCase.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aSwitchCase.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aSwitchCase.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aSwitchCase.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aSwitchCase.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aSwitchCase.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aSwitchCase.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aSwitchCase.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aSwitchCase.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aSwitchCase.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aSwitchCase.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aSwitchCase.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aSwitchCase.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aSwitchCase.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aSwitchCase.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aSwitchCase.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aSwitchCase.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aSwitchCase.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aSwitchCase.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aSwitchCase.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aSwitchCase.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aSwitchCase.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aSwitchCase.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aSwitchCase.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aSwitchCase.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aSwitchCase.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aSwitchCase.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aSwitchCase.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aSwitchCase.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aSwitchCase.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aSwitchCase.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aSwitchCase.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aSwitchCase.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aSwitchCase.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aSwitchCase.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aSwitchCase.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aSwitchCase.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aSwitchCase.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aSwitchCase.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aSwitchCase.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aSwitchCase.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aSwitchCase.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aSwitchCase.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aSwitchCase.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aSwitchCase.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aSwitchCase.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aSwitchCase.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aSwitchCase.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aSwitchCase.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aSwitchCase.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aSwitchCase.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aSwitchCase.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aSwitchCase.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aSwitchCase.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aSwitchCase.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aSwitchCase.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aSwitchCase.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aSwitchCase.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aSwitchCase.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aSwitchCase.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aSwitchCase.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aSwitchCase.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aSwitchCase.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aSwitchCase.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aSwitchCase.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aSwitchCase.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aSwitchCase.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aSwitchCase.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aSwitchCase.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aSwitchCase.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aSwitchCase.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aSwitchCase); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aSwitchCase.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aSwitchCase.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aSwitchCase.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aSwitchCase.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "default"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aSwitchCase.instanceOf(joinpointClass); - } - /** - * - */ - protected enum DefaultAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private DefaultAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(DefaultAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeleteExpr.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeleteExpr.java deleted file mode 100644 index b4d0e60245..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ADeleteExpr.java +++ /dev/null @@ -1,1102 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ADeleteExpr - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ADeleteExpr extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public ADeleteExpr(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "deleteExpr"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum DeleteExprAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private DeleteExprAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(DeleteExprAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AElaboratedType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AElaboratedType.java deleted file mode 100644 index 18fc0bc64f..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AElaboratedType.java +++ /dev/null @@ -1,1391 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AElaboratedType - * This class is overwritten by the Weaver Generator. - * - * Represents a type that was referred to using an elaborated type keyword, e.g., struct S, or via a qualified name, e.g., N::M::type, or both. This type is used to keep track of a type name as written in the source code, including tag keywords and any nested-name-specifiers. The type itself is always 'sugar', used to express what was written in the source code but containing no additional semantic information. - * @author Lara Weaver Generator - */ -public abstract class AElaboratedType extends AType { - - protected AType aType; - - /** - * - */ - public AElaboratedType(AType aType){ - this.aType = aType; - } - /** - * the keyword of this elaborated type, if present. Can be one of: struct, interface, union, class, enum, typename - */ - public abstract String getKeywordImpl(); - - /** - * the keyword of this elaborated type, if present. Can be one of: struct, interface, union, class, enum, typename - */ - public final Object getKeyword() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "keyword", Optional.empty()); - } - String result = this.getKeywordImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "keyword", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "keyword", e); - } - } - - /** - * the type that is being prefixed with the qualifier - */ - public abstract AType getNamedTypeImpl(); - - /** - * the type that is being prefixed with the qualifier - */ - public final Object getNamedType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "namedType", Optional.empty()); - } - AType result = this.getNamedTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "namedType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "namedType", e); - } - } - - /** - * the qualifier of this elaborated type, if present (e.g., A::) - */ - public abstract String getQualifierImpl(); - - /** - * the qualifier of this elaborated type, if present (e.g., A::) - */ - public final Object getQualifier() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "qualifier", Optional.empty()); - } - String result = this.getQualifierImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "qualifier", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "qualifier", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("keyword"); - attributes.add("namedType"); - attributes.add("qualifier"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "elaboratedType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ElaboratedTypeAttributes { - KEYWORD("keyword"), - NAMEDTYPE("namedType"), - QUALIFIER("qualifier"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ElaboratedTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ElaboratedTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmpty.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmpty.java deleted file mode 100644 index 5c18996010..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmpty.java +++ /dev/null @@ -1,210 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AEmpty - * This class is overwritten by the Weaver Generator. - * - * Utility joinpoint, to represent empty nodes when directly accessing the tree - * @author Lara Weaver Generator - */ -public abstract class AEmpty extends ACxxWeaverJoinPoint { - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "empty"; - } - /** - * - */ - protected enum EmptyAttributes { - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private EmptyAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(EmptyAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmptyStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmptyStmt.java deleted file mode 100644 index 2d32541e8e..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEmptyStmt.java +++ /dev/null @@ -1,1240 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AEmptyStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AEmptyStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AEmptyStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "emptyStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum EmptyStmtAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private EmptyStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(EmptyStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumDecl.java deleted file mode 100644 index 2b9464b305..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumDecl.java +++ /dev/null @@ -1,1212 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AEnumDecl - * This class is overwritten by the Weaver Generator. - * - * Represents an enum - * @author Lara Weaver Generator - */ -public abstract class AEnumDecl extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public AEnumDecl(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute enumerators - * @return the attribute's value - */ - public abstract AEnumeratorDecl[] getEnumeratorsArrayImpl(); - - /** - * Get value on attribute enumerators - * @return the attribute's value - */ - public Object getEnumeratorsImpl() { - AEnumeratorDecl[] aEnumeratorDeclArrayImpl0 = getEnumeratorsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aEnumeratorDeclArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute enumerators - * @return the attribute's value - */ - public final Object getEnumerators() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "enumerators", Optional.empty()); - } - Object result = this.getEnumeratorsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "enumerators", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "enumerators", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select enumerators - * @return - */ - public List selectEnumerator() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AEnumeratorDecl.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "enumerator": - joinPointList = selectEnumerator(); - break; - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - attributes.add("enumerators"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - selects.add("enumerator"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "enumDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum EnumDeclAttributes { - ENUMERATORS("enumerators"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private EnumDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(EnumDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumType.java deleted file mode 100644 index fc8bf9bc54..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumType.java +++ /dev/null @@ -1,1364 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AEnumType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AEnumType extends ATagType { - - protected ATagType aTagType; - - /** - * - */ - public AEnumType(ATagType aTagType){ - super(aTagType); - this.aTagType = aTagType; - } - /** - * Get value on attribute integerType - * @return the attribute's value - */ - public abstract AType getIntegerTypeImpl(); - - /** - * Get value on attribute integerType - * @return the attribute's value - */ - public final Object getIntegerType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "integerType", Optional.empty()); - } - AType result = this.getIntegerTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "integerType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "integerType", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aTagType.getDeclImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aTagType.getNameImpl(); - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aTagType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aTagType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aTagType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aTagType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aTagType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aTagType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aTagType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aTagType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aTagType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aTagType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aTagType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aTagType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aTagType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aTagType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aTagType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aTagType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aTagType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aTagType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aTagType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aTagType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aTagType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aTagType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aTagType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aTagType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aTagType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aTagType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aTagType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aTagType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aTagType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aTagType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aTagType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aTagType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aTagType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aTagType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aTagType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aTagType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aTagType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aTagType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aTagType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aTagType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aTagType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aTagType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aTagType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aTagType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aTagType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aTagType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aTagType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aTagType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aTagType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aTagType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aTagType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aTagType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aTagType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aTagType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aTagType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aTagType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aTagType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aTagType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aTagType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aTagType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aTagType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aTagType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aTagType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aTagType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aTagType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aTagType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aTagType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aTagType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aTagType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aTagType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aTagType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aTagType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aTagType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aTagType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aTagType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aTagType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aTagType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aTagType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aTagType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aTagType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aTagType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aTagType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aTagType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aTagType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aTagType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aTagType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aTagType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aTagType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aTagType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aTagType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aTagType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aTagType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aTagType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aTagType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aTagType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aTagType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aTagType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aTagType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aTagType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aTagType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aTagType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aTagType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aTagType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aTagType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aTagType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aTagType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aTagType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aTagType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aTagType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aTagType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aTagType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aTagType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aTagType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aTagType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aTagType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aTagType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aTagType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aTagType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aTagType.fillWithAttributes(attributes); - attributes.add("integerType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aTagType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aTagType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "enumType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aTagType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum EnumTypeAttributes { - INTEGERTYPE("integerType"), - DECL("decl"), - NAME("name"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private EnumTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(EnumTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumeratorDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumeratorDecl.java deleted file mode 100644 index 0c3f8f53fc..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AEnumeratorDecl.java +++ /dev/null @@ -1,1160 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AEnumeratorDecl - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AEnumeratorDecl extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public AEnumeratorDecl(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "enumeratorDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum EnumeratorDeclAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private EnumeratorDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(EnumeratorDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExprStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExprStmt.java deleted file mode 100644 index 8283473436..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExprStmt.java +++ /dev/null @@ -1,1267 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AExprStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AExprStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AExprStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * The expression join point associated to this exprStmt - */ - public abstract AExpression getExprImpl(); - - /** - * The expression join point associated to this exprStmt - */ - public final Object getExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "expr", Optional.empty()); - } - AExpression result = this.getExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "expr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "expr", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("expr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "exprStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ExprStmtAttributes { - EXPR("expr"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ExprStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ExprStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExpression.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExpression.java deleted file mode 100644 index 1dbb2a2484..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AExpression.java +++ /dev/null @@ -1,354 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AExpression - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AExpression extends ACxxWeaverJoinPoint { - - /** - * a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none - */ - public abstract ADecl getDeclImpl(); - - /** - * a 'decl' join point that represents the declaration associated with this expression, or undefined if there is none - */ - public final Object getDecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "decl", Optional.empty()); - } - ADecl result = this.getDeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "decl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "decl", e); - } - } - - /** - * returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise - */ - public abstract ACast getImplicitCastImpl(); - - /** - * returns a cast joinpoint if this expression has an associated implicit cast, undefined otherwise - */ - public final Object getImplicitCast() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "implicitCast", Optional.empty()); - } - ACast result = this.getImplicitCastImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "implicitCast", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "implicitCast", e); - } - } - - /** - * true if the expression is part of an argument of a function call - */ - public abstract Boolean getIsFunctionArgumentImpl(); - - /** - * true if the expression is part of an argument of a function call - */ - public final Object getIsFunctionArgument() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isFunctionArgument", Optional.empty()); - } - Boolean result = this.getIsFunctionArgumentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isFunctionArgument", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isFunctionArgument", e); - } - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - public abstract String getUseImpl(); - - /** - * Get value on attribute use - * @return the attribute's value - */ - public final Object getUse() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "use", Optional.empty()); - } - String result = this.getUseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "use", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "use", e); - } - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - public abstract AVardecl getVardeclImpl(); - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - public final Object getVardecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "vardecl", Optional.empty()); - } - AVardecl result = this.getVardeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "vardecl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "vardecl", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select vardecls - * @return - */ - public List selectVardecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl.class, SelectOp.DESCENDANTS); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("decl"); - attributes.add("implicitCast"); - attributes.add("isFunctionArgument"); - attributes.add("use"); - attributes.add("vardecl"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - super.fillWithSelects(selects); - selects.add("vardecl"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "expression"; - } - /** - * - */ - protected enum ExpressionAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ExpressionAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ExpressionAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AField.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AField.java deleted file mode 100644 index 51c5a2c3a4..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AField.java +++ /dev/null @@ -1,1160 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AField - * This class is overwritten by the Weaver Generator. - * - * Represents a member of a struct/union/class - * @author Lara Weaver Generator - */ -public abstract class AField extends ADeclarator { - - protected ADeclarator aDeclarator; - - /** - * - */ - public AField(ADeclarator aDeclarator){ - super(aDeclarator); - this.aDeclarator = aDeclarator; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aDeclarator.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aDeclarator.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aDeclarator.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aDeclarator.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDeclarator.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aDeclarator.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aDeclarator.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aDeclarator.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDeclarator.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDeclarator.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDeclarator.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDeclarator.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDeclarator.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDeclarator.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDeclarator.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDeclarator.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDeclarator.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDeclarator.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDeclarator.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDeclarator.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDeclarator.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDeclarator.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDeclarator.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDeclarator.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDeclarator.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDeclarator.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDeclarator.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDeclarator.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDeclarator.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDeclarator.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDeclarator.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDeclarator.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDeclarator.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDeclarator.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDeclarator.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDeclarator.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDeclarator.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDeclarator.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDeclarator.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDeclarator.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDeclarator.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDeclarator.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDeclarator.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDeclarator.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDeclarator.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDeclarator.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDeclarator.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDeclarator.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDeclarator.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDeclarator.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDeclarator.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDeclarator.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDeclarator.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDeclarator.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDeclarator.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDeclarator.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDeclarator.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDeclarator.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDeclarator.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDeclarator.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDeclarator.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDeclarator.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDeclarator.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDeclarator.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDeclarator.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDeclarator.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDeclarator.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDeclarator.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDeclarator.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDeclarator.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDeclarator.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDeclarator.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDeclarator.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDeclarator.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDeclarator.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDeclarator.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDeclarator.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDeclarator.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDeclarator.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDeclarator.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDeclarator.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDeclarator.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDeclarator.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aDeclarator.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aDeclarator.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aDeclarator.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDeclarator.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDeclarator.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDeclarator.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDeclarator.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDeclarator.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDeclarator); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aDeclarator.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aDeclarator.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aDeclarator.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aDeclarator.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "field"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDeclarator.instanceOf(joinpointClass); - } - /** - * - */ - protected enum FieldAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private FieldAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(FieldAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFile.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFile.java deleted file mode 100644 index f2b2dd70de..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFile.java +++ /dev/null @@ -1,1184 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AFile - * This class is overwritten by the Weaver Generator. - * - * Represents a source file (.c, .cpp., .cl, etc) - * @author Lara Weaver Generator - */ -public abstract class AFile extends ACxxWeaverJoinPoint { - - /** - * the path to the source folder that was given as the base folder of this file - */ - public abstract String getBaseSourcePathImpl(); - - /** - * the path to the source folder that was given as the base folder of this file - */ - public final Object getBaseSourcePath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "baseSourcePath", Optional.empty()); - } - String result = this.getBaseSourcePathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "baseSourcePath", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "baseSourcePath", e); - } - } - - /** - * the output of the parser if there were errors during parsing - */ - public abstract String getErrorOutputImpl(); - - /** - * the output of the parser if there were errors during parsing - */ - public final Object getErrorOutput() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "errorOutput", Optional.empty()); - } - String result = this.getErrorOutputImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "errorOutput", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "errorOutput", e); - } - } - - /** - * a Java file to the file that originated this translation unit - */ - public abstract Object getFileImpl(); - - /** - * a Java file to the file that originated this translation unit - */ - public final Object getFile() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "file", Optional.empty()); - } - Object result = this.getFileImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "file", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "file", e); - } - } - - /** - * - * @param destinationFolderpath - * @return - */ - public abstract String getDestinationFilepathImpl(String destinationFolderpath); - - /** - * - * @param destinationFolderpath - * @return - */ - public final Object getDestinationFilepath(String destinationFolderpath) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getDestinationFilepath", Optional.empty(), destinationFolderpath); - } - String result = this.getDestinationFilepathImpl(destinationFolderpath); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getDestinationFilepath", Optional.ofNullable(result), destinationFolderpath); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getDestinationFilepath", e); - } - } - - /** - * true if this file contains a 'main' method - */ - public abstract Boolean getHasMainImpl(); - - /** - * true if this file contains a 'main' method - */ - public final Object getHasMain() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasMain", Optional.empty()); - } - Boolean result = this.getHasMainImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasMain", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasMain", e); - } - } - - /** - * true if there were errors during parsing - */ - public abstract Boolean getHasParsingErrorsImpl(); - - /** - * true if there were errors during parsing - */ - public final Object getHasParsingErrors() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasParsingErrors", Optional.empty()); - } - Boolean result = this.getHasParsingErrorsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasParsingErrors", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasParsingErrors", e); - } - } - - /** - * Get value on attribute includes - * @return the attribute's value - */ - public abstract AInclude[] getIncludesArrayImpl(); - - /** - * the includes of this file - */ - public Object getIncludesImpl() { - AInclude[] aIncludeArrayImpl0 = getIncludesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aIncludeArrayImpl0); - return nativeArray0; - } - - /** - * the includes of this file - */ - public final Object getIncludes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "includes", Optional.empty()); - } - Object result = this.getIncludesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "includes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "includes", e); - } - } - - /** - * true if this file is considered a C++ file - */ - public abstract Boolean getIsCxxImpl(); - - /** - * true if this file is considered a C++ file - */ - public final Object getIsCxx() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCxx", Optional.empty()); - } - Boolean result = this.getIsCxxImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCxx", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCxx", e); - } - } - - /** - * true if this file is considered a header file - */ - public abstract Boolean getIsHeaderImpl(); - - /** - * true if this file is considered a header file - */ - public final Object getIsHeader() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isHeader", Optional.empty()); - } - Boolean result = this.getIsHeaderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isHeader", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isHeader", e); - } - } - - /** - * true if this file is an OpenCL filetype - */ - public abstract Boolean getIsOpenCLImpl(); - - /** - * true if this file is an OpenCL filetype - */ - public final Object getIsOpenCL() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isOpenCL", Optional.empty()); - } - Boolean result = this.getIsOpenCLImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isOpenCL", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isOpenCL", e); - } - } - - /** - * the name of the file - */ - public abstract String getNameImpl(); - - /** - * the name of the file - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * the folder of the source file - */ - public abstract String getPathImpl(); - - /** - * the folder of the source file - */ - public final Object getPath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "path", Optional.empty()); - } - String result = this.getPathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "path", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "path", e); - } - } - - /** - * the path to the file relative to the base source path - */ - public abstract String getRelativeFilepathImpl(); - - /** - * the path to the file relative to the base source path - */ - public final Object getRelativeFilepath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "relativeFilepath", Optional.empty()); - } - String result = this.getRelativeFilepathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "relativeFilepath", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "relativeFilepath", e); - } - } - - /** - * the path to the folder of the source file relative to the base source path - */ - public abstract String getRelativeFolderpathImpl(); - - /** - * the path to the folder of the source file relative to the base source path - */ - public final Object getRelativeFolderpath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "relativeFolderpath", Optional.empty()); - } - String result = this.getRelativeFolderpathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "relativeFolderpath", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "relativeFolderpath", e); - } - } - - /** - * - */ - public void defRelativeFolderpathImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def relativeFolderpath with type String not implemented "); - } - - /** - * the name of the source folder of this file, or undefined if it has none - */ - public abstract String getSourceFoldernameImpl(); - - /** - * the name of the source folder of this file, or undefined if it has none - */ - public final Object getSourceFoldername() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "sourceFoldername", Optional.empty()); - } - String result = this.getSourceFoldernameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "sourceFoldername", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "sourceFoldername", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select stmts - * @return - */ - public List selectStmt() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select childStmts - * @return - */ - public List selectChildStmt() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select functions - * @return - */ - public List selectFunction() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunction.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select methods - * @return - */ - public List selectMethod() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMethod.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select records - * @return - */ - public List selectRecord() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ARecord.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select structs - * @return - */ - public List selectStruct() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStruct.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select classs - * @return - */ - public List selectClass() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AClass.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select pragmas - * @return - */ - public List selectPragma() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.APragma.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select markers - * @return - */ - public List selectMarker() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMarker.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select tags - * @return - */ - public List selectTag() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATag.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select vardecls - * @return - */ - public List selectVardecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select comments - * @return - */ - public List selectComment() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AComment.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select includes - * @return - */ - public List selectInclude() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AInclude.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select typedefDecls - * @return - */ - public List selectTypedefDecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATypedefDecl.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select decls - * @return - */ - public List selectDecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ADecl.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a C include to the current file. If the file already has the include, it does nothing - * @param name - * @param isAngled - */ - public void addCIncludeImpl(String name, boolean isAngled) { - throw new UnsupportedOperationException(get_class()+": Action addCInclude not implemented "); - } - - /** - * Adds a C include to the current file. If the file already has the include, it does nothing - * @param name - * @param isAngled - */ - public final void addCInclude(String name, boolean isAngled) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addCInclude", this, Optional.empty(), name, isAngled); - } - this.addCIncludeImpl(name, isAngled); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addCInclude", this, Optional.empty(), name, isAngled); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addCInclude", e); - } - } - - /** - * Adds a function to the file that returns void and has no parameters - * @param name - */ - public AJoinPoint addFunctionImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action addFunction not implemented "); - } - - /** - * Adds a function to the file that returns void and has no parameters - * @param name - */ - public final Object addFunction(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addFunction", this, Optional.empty(), name); - } - AJoinPoint result = this.addFunctionImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addFunction", this, Optional.ofNullable(result), name); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "addFunction", e); - } - } - - /** - * Adds a global variable to this file - * @param name - * @param type - * @param initValue - */ - public AVardecl addGlobalImpl(String name, AJoinPoint type, String initValue) { - throw new UnsupportedOperationException(get_class()+": Action addGlobal not implemented "); - } - - /** - * Adds a global variable to this file - * @param name - * @param type - * @param initValue - */ - public final Object addGlobal(String name, AJoinPoint type, String initValue) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addGlobal", this, Optional.empty(), name, type, initValue); - } - AVardecl result = this.addGlobalImpl(name, type, initValue); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addGlobal", this, Optional.ofNullable(result), name, type, initValue); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "addGlobal", e); - } - } - - /** - * Adds an include to the current file. If the file already has the include, it does nothing - * @param name - * @param isAngled - */ - public void addIncludeImpl(String name, boolean isAngled) { - throw new UnsupportedOperationException(get_class()+": Action addInclude not implemented "); - } - - /** - * Adds an include to the current file. If the file already has the include, it does nothing - * @param name - * @param isAngled - */ - public final void addInclude(String name, boolean isAngled) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addInclude", this, Optional.empty(), name, isAngled); - } - this.addIncludeImpl(name, isAngled); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addInclude", this, Optional.empty(), name, isAngled); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addInclude", e); - } - } - - /** - * Overload of addInclude which accepts a join point - * @param jp - */ - public void addIncludeJpImpl(AJoinPoint jp) { - throw new UnsupportedOperationException(get_class()+": Action addIncludeJp not implemented "); - } - - /** - * Overload of addInclude which accepts a join point - * @param jp - */ - public final void addIncludeJp(AJoinPoint jp) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addIncludeJp", this, Optional.empty(), jp); - } - this.addIncludeJpImpl(jp); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addIncludeJp", this, Optional.empty(), jp); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addIncludeJp", e); - } - } - - /** - * Adds the node in the join point to the start of the file - * @param node - */ - public void insertBeginImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertBegin not implemented "); - } - - /** - * Adds the node in the join point to the start of the file - * @param node - */ - public final void insertBegin(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBegin", this, Optional.empty(), node); - } - this.insertBeginImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBegin", this, Optional.empty(), node); - } - } catch(Exception e) { - throw new ActionException(get_class(), "insertBegin", e); - } - } - - /** - * Adds the String as a Decl to the end of the file - * @param code - */ - public void insertBeginImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertBegin not implemented "); - } - - /** - * Adds the String as a Decl to the end of the file - * @param code - */ - public final void insertBegin(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBegin", this, Optional.empty(), code); - } - this.insertBeginImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBegin", this, Optional.empty(), code); - } - } catch(Exception e) { - throw new ActionException(get_class(), "insertBegin", e); - } - } - - /** - * Adds the node in the join point to the end of the file - * @param node - */ - public void insertEndImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertEnd not implemented "); - } - - /** - * Adds the node in the join point to the end of the file - * @param node - */ - public final void insertEnd(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertEnd", this, Optional.empty(), node); - } - this.insertEndImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertEnd", this, Optional.empty(), node); - } - } catch(Exception e) { - throw new ActionException(get_class(), "insertEnd", e); - } - } - - /** - * Adds the String as a Decl to the end of the file - * @param code - */ - public void insertEndImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertEnd not implemented "); - } - - /** - * Adds the String as a Decl to the end of the file - * @param code - */ - public final void insertEnd(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertEnd", this, Optional.empty(), code); - } - this.insertEndImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertEnd", this, Optional.empty(), code); - } - } catch(Exception e) { - throw new ActionException(get_class(), "insertEnd", e); - } - } - - /** - * Recompiles only this file, returns a join point to the new recompiled file, or throws an exception if a problem happens - */ - public AFile rebuildImpl() { - throw new UnsupportedOperationException(get_class()+": Action rebuild not implemented "); - } - - /** - * Recompiles only this file, returns a join point to the new recompiled file, or throws an exception if a problem happens - */ - public final Object rebuild() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "rebuild", this, Optional.empty()); - } - AFile result = this.rebuildImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "rebuild", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "rebuild", e); - } - } - - /** - * Recompiles only this file, returns a join point to the new recompiled file, or returns a clavaException join point if a problem happens - */ - public AJoinPoint rebuildTryImpl() { - throw new UnsupportedOperationException(get_class()+": Action rebuildTry not implemented "); - } - - /** - * Recompiles only this file, returns a join point to the new recompiled file, or returns a clavaException join point if a problem happens - */ - public final Object rebuildTry() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "rebuildTry", this, Optional.empty()); - } - AJoinPoint result = this.rebuildTryImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "rebuildTry", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "rebuildTry", e); - } - } - - /** - * Changes the name of the file - * @param filename - */ - public void setNameImpl(String filename) { - throw new UnsupportedOperationException(get_class()+": Action setName not implemented "); - } - - /** - * Changes the name of the file - * @param filename - */ - public final void setName(String filename) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setName", this, Optional.empty(), filename); - } - this.setNameImpl(filename); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setName", this, Optional.empty(), filename); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setName", e); - } - } - - /** - * Sets the path to the folder of the source file relative to the base source path - * @param path - */ - public void setRelativeFolderpathImpl(String path) { - throw new UnsupportedOperationException(get_class()+": Action setRelativeFolderpath not implemented "); - } - - /** - * Sets the path to the folder of the source file relative to the base source path - * @param path - */ - public final void setRelativeFolderpath(String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setRelativeFolderpath", this, Optional.empty(), path); - } - this.setRelativeFolderpathImpl(path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setRelativeFolderpath", this, Optional.empty(), path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setRelativeFolderpath", e); - } - } - - /** - * Writes the code of this file to a given folder - * @param destinationFoldername - */ - public String writeImpl(String destinationFoldername) { - throw new UnsupportedOperationException(get_class()+": Action write not implemented "); - } - - /** - * Writes the code of this file to a given folder - * @param destinationFoldername - */ - public final Object write(String destinationFoldername) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "write", this, Optional.empty(), destinationFoldername); - } - String result = this.writeImpl(destinationFoldername); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "write", this, Optional.ofNullable(result), destinationFoldername); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "write", e); - } - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "stmt": - joinPointList = selectStmt(); - break; - case "childStmt": - joinPointList = selectChildStmt(); - break; - case "function": - joinPointList = selectFunction(); - break; - case "method": - joinPointList = selectMethod(); - break; - case "record": - joinPointList = selectRecord(); - break; - case "struct": - joinPointList = selectStruct(); - break; - case "class": - joinPointList = selectClass(); - break; - case "pragma": - joinPointList = selectPragma(); - break; - case "marker": - joinPointList = selectMarker(); - break; - case "tag": - joinPointList = selectTag(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "comment": - joinPointList = selectComment(); - break; - case "include": - joinPointList = selectInclude(); - break; - case "typedefDecl": - joinPointList = selectTypedefDecl(); - break; - case "decl": - joinPointList = selectDecl(); - break; - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "relativeFolderpath": { - if(value instanceof String){ - this.defRelativeFolderpathImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("baseSourcePath"); - attributes.add("errorOutput"); - attributes.add("file"); - attributes.add("getDestinationFilepath"); - attributes.add("hasMain"); - attributes.add("hasParsingErrors"); - attributes.add("includes"); - attributes.add("isCxx"); - attributes.add("isHeader"); - attributes.add("isOpenCL"); - attributes.add("name"); - attributes.add("path"); - attributes.add("relativeFilepath"); - attributes.add("relativeFolderpath"); - attributes.add("sourceFoldername"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - selects.add("stmt"); - selects.add("childStmt"); - selects.add("function"); - selects.add("method"); - selects.add("record"); - selects.add("struct"); - selects.add("class"); - selects.add("pragma"); - selects.add("marker"); - selects.add("tag"); - selects.add("vardecl"); - selects.add("comment"); - selects.add("include"); - selects.add("typedefDecl"); - selects.add("decl"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - actions.add("void addCInclude(String, boolean)"); - actions.add("joinpoint addFunction(String)"); - actions.add("vardecl addGlobal(String, joinpoint, String)"); - actions.add("void addInclude(String, boolean)"); - actions.add("void addIncludeJp(joinpoint)"); - actions.add("void insertBegin(joinpoint)"); - actions.add("void insertBegin(String)"); - actions.add("void insertEnd(joinpoint)"); - actions.add("void insertEnd(String)"); - actions.add("file rebuild()"); - actions.add("joinpoint rebuildTry()"); - actions.add("void setName(String)"); - actions.add("void setRelativeFolderpath(String)"); - actions.add("String write(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "file"; - } - /** - * - */ - protected enum FileAttributes { - BASESOURCEPATH("baseSourcePath"), - ERROROUTPUT("errorOutput"), - FILE("file"), - GETDESTINATIONFILEPATH("getDestinationFilepath"), - HASMAIN("hasMain"), - HASPARSINGERRORS("hasParsingErrors"), - INCLUDES("includes"), - ISCXX("isCxx"), - ISHEADER("isHeader"), - ISOPENCL("isOpenCL"), - NAME("name"), - PATH("path"), - RELATIVEFILEPATH("relativeFilepath"), - RELATIVEFOLDERPATH("relativeFolderpath"), - SOURCEFOLDERNAME("sourceFoldername"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private FileAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(FileAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFloatLiteral.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFloatLiteral.java deleted file mode 100644 index 6d911f7dae..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFloatLiteral.java +++ /dev/null @@ -1,1132 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AFloatLiteral - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AFloatLiteral extends ALiteral { - - protected ALiteral aLiteral; - - /** - * - */ - public AFloatLiteral(ALiteral aLiteral){ - super(aLiteral); - this.aLiteral = aLiteral; - } - /** - * Get value on attribute value - * @return the attribute's value - */ - public abstract Double getValueImpl(); - - /** - * Get value on attribute value - * @return the attribute's value - */ - public final Object getValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "value", Optional.empty()); - } - Double result = this.getValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "value", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "value", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aLiteral.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aLiteral.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aLiteral.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aLiteral.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aLiteral.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aLiteral.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aLiteral.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aLiteral.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aLiteral.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aLiteral.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aLiteral.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aLiteral.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aLiteral.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aLiteral.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aLiteral.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aLiteral.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aLiteral.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aLiteral.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aLiteral.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aLiteral.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aLiteral.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aLiteral.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aLiteral.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aLiteral.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aLiteral.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aLiteral.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aLiteral.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aLiteral.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aLiteral.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aLiteral.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aLiteral.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aLiteral.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aLiteral.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aLiteral.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aLiteral.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aLiteral.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aLiteral.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aLiteral.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aLiteral.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aLiteral.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aLiteral.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aLiteral.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aLiteral.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aLiteral.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aLiteral.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aLiteral.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aLiteral.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aLiteral.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aLiteral.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aLiteral.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aLiteral.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aLiteral.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aLiteral.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aLiteral.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aLiteral.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aLiteral.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aLiteral.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aLiteral.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aLiteral.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aLiteral.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aLiteral.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aLiteral.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aLiteral.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aLiteral.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aLiteral.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aLiteral.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aLiteral.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aLiteral.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aLiteral.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aLiteral.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aLiteral.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aLiteral.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aLiteral.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aLiteral.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aLiteral.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aLiteral.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aLiteral.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aLiteral.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aLiteral.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aLiteral.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aLiteral.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aLiteral.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aLiteral.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aLiteral.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aLiteral.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aLiteral.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aLiteral); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aLiteral.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aLiteral.fillWithAttributes(attributes); - attributes.add("value"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aLiteral.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aLiteral.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "floatLiteral"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aLiteral.instanceOf(joinpointClass); - } - /** - * - */ - protected enum FloatLiteralAttributes { - VALUE("value"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private FloatLiteralAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(FloatLiteralAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunction.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunction.java deleted file mode 100644 index 30a7283085..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunction.java +++ /dev/null @@ -1,2417 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AFunction - * This class is overwritten by the Weaver Generator. - * - * Represents a function declaration or definition - * @author Lara Weaver Generator - */ -public abstract class AFunction extends ADeclarator { - - protected ADeclarator aDeclarator; - - /** - * - */ - public AFunction(ADeclarator aDeclarator){ - super(aDeclarator); - this.aDeclarator = aDeclarator; - } - /** - * Get value on attribute body - * @return the attribute's value - */ - public abstract AScope getBodyImpl(); - - /** - * Get value on attribute body - * @return the attribute's value - */ - public final Object getBody() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "body", Optional.empty()); - } - AScope result = this.getBodyImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "body", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "body", e); - } - } - - /** - * - */ - public void defBodyImpl(AScope value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def body with type AScope not implemented "); - } - - /** - * Get value on attribute calls - * @return the attribute's value - */ - public abstract ACall[] getCallsArrayImpl(); - - /** - * Get value on attribute calls - * @return the attribute's value - */ - public Object getCallsImpl() { - ACall[] aCallArrayImpl0 = getCallsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aCallArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute calls - * @return the attribute's value - */ - public final Object getCalls() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "calls", Optional.empty()); - } - Object result = this.getCallsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "calls", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "calls", e); - } - } - - /** - * Function join points can either represent declarations or definitions, returns the definition of this function, if present, or the first declaration, if only declarations are present - */ - public abstract AFunction getCanonicalImpl(); - - /** - * Function join points can either represent declarations or definitions, returns the definition of this function, if present, or the first declaration, if only declarations are present - */ - public final Object getCanonical() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "canonical", Optional.empty()); - } - AFunction result = this.getCanonicalImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "canonical", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "canonical", e); - } - } - - /** - * Returns the first prototype of this function that could be found, or undefined if there is none - */ - public abstract AFunction getDeclarationJpImpl(); - - /** - * Returns the first prototype of this function that could be found, or undefined if there is none - */ - public final Object getDeclarationJp() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "declarationJp", Optional.empty()); - } - AFunction result = this.getDeclarationJpImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "declarationJp", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "declarationJp", e); - } - } - - /** - * Get value on attribute declarationJps - * @return the attribute's value - */ - public abstract AFunction[] getDeclarationJpsArrayImpl(); - - /** - * Returns the prototypes of this function that are present in the code. If there are none, returns an empty array - */ - public Object getDeclarationJpsImpl() { - AFunction[] aFunctionArrayImpl0 = getDeclarationJpsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aFunctionArrayImpl0); - return nativeArray0; - } - - /** - * Returns the prototypes of this function that are present in the code. If there are none, returns an empty array - */ - public final Object getDeclarationJps() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "declarationJps", Optional.empty()); - } - Object result = this.getDeclarationJpsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "declarationJps", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "declarationJps", e); - } - } - - /** - * Returns the implementation of this function if there is one, or undefined otherwise - */ - public abstract AFunction getDefinitionJpImpl(); - - /** - * Returns the implementation of this function if there is one, or undefined otherwise - */ - public final Object getDefinitionJp() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "definitionJp", Optional.empty()); - } - AFunction result = this.getDefinitionJpImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "definitionJp", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "definitionJp", e); - } - } - - /** - * the type of the call, which includes the return type and the types of the parameters - */ - public abstract AFunctionType getFunctionTypeImpl(); - - /** - * the type of the call, which includes the return type and the types of the parameters - */ - public final Object getFunctionType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "functionType", Optional.empty()); - } - AFunctionType result = this.getFunctionTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "functionType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "functionType", e); - } - } - - /** - * - */ - public void defFunctionTypeImpl(AFunctionType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def functionType with type AFunctionType not implemented "); - } - - /** - * - * @param withReturnType - * @return - */ - public abstract String getDeclarationImpl(Boolean withReturnType); - - /** - * - * @param withReturnType - * @return - */ - public final Object getDeclaration(Boolean withReturnType) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getDeclaration", Optional.empty(), withReturnType); - } - String result = this.getDeclarationImpl(withReturnType); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getDeclaration", Optional.ofNullable(result), withReturnType); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getDeclaration", e); - } - } - - /** - * [DEPRECATED: Use .isImplementation instead] True if this particular function join point has a body, false otherwise - */ - public abstract Boolean getHasDefinitionImpl(); - - /** - * [DEPRECATED: Use .isImplementation instead] True if this particular function join point has a body, false otherwise - */ - public final Object getHasDefinition() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasDefinition", Optional.empty()); - } - Boolean result = this.getHasDefinitionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasDefinition", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasDefinition", e); - } - } - - /** - * Get value on attribute id - * @return the attribute's value - */ - public abstract String getIdImpl(); - - /** - * Get value on attribute id - * @return the attribute's value - */ - public final Object getId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "id", Optional.empty()); - } - String result = this.getIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "id", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "id", e); - } - } - - /** - * true, if this is the function returned by the 'canonical' attribute - */ - public abstract Boolean getIsCanonicalImpl(); - - /** - * true, if this is the function returned by the 'canonical' attribute - */ - public final Object getIsCanonical() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCanonical", Optional.empty()); - } - Boolean result = this.getIsCanonicalImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCanonical", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCanonical", e); - } - } - - /** - * Get value on attribute isCudaKernel - * @return the attribute's value - */ - public abstract Boolean getIsCudaKernelImpl(); - - /** - * Get value on attribute isCudaKernel - * @return the attribute's value - */ - public final Object getIsCudaKernel() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCudaKernel", Optional.empty()); - } - Boolean result = this.getIsCudaKernelImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCudaKernel", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCudaKernel", e); - } - } - - /** - * Get value on attribute isDelete - * @return the attribute's value - */ - public abstract Boolean getIsDeleteImpl(); - - /** - * Get value on attribute isDelete - * @return the attribute's value - */ - public final Object getIsDelete() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isDelete", Optional.empty()); - } - Boolean result = this.getIsDeleteImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isDelete", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isDelete", e); - } - } - - /** - * true if this particular function join point is an implementation (i.e. has a body), false otherwise - */ - public abstract Boolean getIsImplementationImpl(); - - /** - * true if this particular function join point is an implementation (i.e. has a body), false otherwise - */ - public final Object getIsImplementation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isImplementation", Optional.empty()); - } - Boolean result = this.getIsImplementationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isImplementation", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isImplementation", e); - } - } - - /** - * Get value on attribute isInline - * @return the attribute's value - */ - public abstract Boolean getIsInlineImpl(); - - /** - * Get value on attribute isInline - * @return the attribute's value - */ - public final Object getIsInline() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInline", Optional.empty()); - } - Boolean result = this.getIsInlineImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInline", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInline", e); - } - } - - /** - * Get value on attribute isModulePrivate - * @return the attribute's value - */ - public abstract Boolean getIsModulePrivateImpl(); - - /** - * Get value on attribute isModulePrivate - * @return the attribute's value - */ - public final Object getIsModulePrivate() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isModulePrivate", Optional.empty()); - } - Boolean result = this.getIsModulePrivateImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isModulePrivate", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isModulePrivate", e); - } - } - - /** - * true if this particular function join point is a prototype (i.e. does not have a body), false otherwise - */ - public abstract Boolean getIsPrototypeImpl(); - - /** - * true if this particular function join point is a prototype (i.e. does not have a body), false otherwise - */ - public final Object getIsPrototype() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPrototype", Optional.empty()); - } - Boolean result = this.getIsPrototypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPrototype", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPrototype", e); - } - } - - /** - * Get value on attribute isPure - * @return the attribute's value - */ - public abstract Boolean getIsPureImpl(); - - /** - * Get value on attribute isPure - * @return the attribute's value - */ - public final Object getIsPure() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPure", Optional.empty()); - } - Boolean result = this.getIsPureImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPure", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPure", e); - } - } - - /** - * Get value on attribute isVirtual - * @return the attribute's value - */ - public abstract Boolean getIsVirtualImpl(); - - /** - * Get value on attribute isVirtual - * @return the attribute's value - */ - public final Object getIsVirtual() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isVirtual", Optional.empty()); - } - Boolean result = this.getIsVirtualImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isVirtual", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isVirtual", e); - } - } - - /** - * Get value on attribute paramNames - * @return the attribute's value - */ - public abstract String[] getParamNamesArrayImpl(); - - /** - * Get value on attribute paramNames - * @return the attribute's value - */ - public Object getParamNamesImpl() { - String[] stringArrayImpl0 = getParamNamesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute paramNames - * @return the attribute's value - */ - public final Object getParamNames() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "paramNames", Optional.empty()); - } - Object result = this.getParamNamesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "paramNames", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "paramNames", e); - } - } - - /** - * Get value on attribute params - * @return the attribute's value - */ - public abstract AParam[] getParamsArrayImpl(); - - /** - * Get value on attribute params - * @return the attribute's value - */ - public Object getParamsImpl() { - AParam[] aParamArrayImpl0 = getParamsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aParamArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute params - * @return the attribute's value - */ - public final Object getParams() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "params", Optional.empty()); - } - Object result = this.getParamsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "params", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "params", e); - } - } - - /** - * - */ - public void defParamsImpl(AParam[] value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def params with type AParam not implemented "); - } - - /** - * - */ - public void defParamsImpl(String[] value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def params with type String not implemented "); - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - public abstract AType getReturnTypeImpl(); - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - public final Object getReturnType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "returnType", Optional.empty()); - } - AType result = this.getReturnTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "returnType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "returnType", e); - } - } - - /** - * - */ - public void defReturnTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def returnType with type AType not implemented "); - } - - /** - * a string with the signature of this function (e.g., name of the function, plus the parameters types) - */ - public abstract String getSignatureImpl(); - - /** - * a string with the signature of this function (e.g., name of the function, plus the parameters types) - */ - public final Object getSignature() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "signature", Optional.empty()); - } - String result = this.getSignatureImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "signature", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "signature", e); - } - } - - /** - * The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC) - */ - public abstract String getStorageClassImpl(); - - /** - * The storage class of this function (i.e., one of NONE, EXTERN, PRIVATE_EXTERN or STATIC) - */ - public final Object getStorageClass() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "storageClass", Optional.empty()); - } - String result = this.getStorageClassImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "storageClass", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "storageClass", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select bodys - * @return - */ - public List selectBody() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ABody.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select params - * @return - */ - public List selectParam() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AParam.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select decls - * @return - */ - public List selectDecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ADecl.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a new parameter to the function - * @param param - */ - public void addParamImpl(AParam param) { - throw new UnsupportedOperationException(get_class()+": Action addParam not implemented "); - } - - /** - * Adds a new parameter to the function - * @param param - */ - public final void addParam(AParam param) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addParam", this, Optional.empty(), param); - } - this.addParamImpl(param); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addParam", this, Optional.empty(), param); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addParam", e); - } - } - - /** - * Adds a new parameter to the function - * @param name - * @param type - */ - public void addParamImpl(String name, AType type) { - throw new UnsupportedOperationException(get_class()+": Action addParam not implemented "); - } - - /** - * Adds a new parameter to the function - * @param name - * @param type - */ - public final void addParam(String name, AType type) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addParam", this, Optional.empty(), name, type); - } - this.addParamImpl(name, type); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addParam", this, Optional.empty(), name, type); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addParam", e); - } - } - - /** - * Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class - * @param newName - * @param insert - */ - public AFunction cloneImpl(String newName, Boolean insert) { - throw new UnsupportedOperationException(get_class()+": Action clone not implemented "); - } - - /** - * Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class - * @param newName - * @param insert - */ - public final Object clone(String newName, Boolean insert) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "clone", this, Optional.empty(), newName, insert); - } - AFunction result = this.cloneImpl(newName, insert); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "clone", this, Optional.ofNullable(result), newName, insert); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "clone", e); - } - } - - /** - * Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided). - * @param newName - * @param fileName - */ - public AFunction cloneOnFileImpl(String newName, String fileName) { - throw new UnsupportedOperationException(get_class()+": Action cloneOnFile not implemented "); - } - - /** - * Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided). - * @param newName - * @param fileName - */ - public final Object cloneOnFile(String newName, String fileName) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "cloneOnFile", this, Optional.empty(), newName, fileName); - } - AFunction result = this.cloneOnFileImpl(newName, fileName); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "cloneOnFile", this, Optional.ofNullable(result), newName, fileName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "cloneOnFile", e); - } - } - - /** - * Generates a clone of the provided function on a new file (with the provided join point). - * @param newName - * @param fileName - */ - public AFunction cloneOnFileImpl(String newName, AFile fileName) { - throw new UnsupportedOperationException(get_class()+": Action cloneOnFile not implemented "); - } - - /** - * Generates a clone of the provided function on a new file (with the provided join point). - * @param newName - * @param fileName - */ - public final Object cloneOnFile(String newName, AFile fileName) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "cloneOnFile", this, Optional.empty(), newName, fileName); - } - AFunction result = this.cloneOnFileImpl(newName, fileName); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "cloneOnFile", this, Optional.ofNullable(result), newName, fileName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "cloneOnFile", e); - } - } - - /** - * Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - public AJoinPoint insertReturnImpl(AJoinPoint code) { - throw new UnsupportedOperationException(get_class()+": Action insertReturn not implemented "); - } - - /** - * Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - public final Object insertReturn(AJoinPoint code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertReturn", this, Optional.empty(), code); - } - AJoinPoint result = this.insertReturnImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertReturn", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertReturn", e); - } - } - - /** - * Inserts code as a literal statement before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - public AJoinPoint insertReturnImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertReturn not implemented "); - } - - /** - * Inserts code as a literal statement before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - public final Object insertReturn(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertReturn", this, Optional.empty(), code); - } - AJoinPoint result = this.insertReturnImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertReturn", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertReturn", e); - } - } - - /** - * Creates a new call to this function - * @param args - */ - public ACall newCallImpl(AJoinPoint[] args) { - throw new UnsupportedOperationException(get_class()+": Action newCall not implemented "); - } - - /** - * Creates a new call to this function - * @param args - */ - public final Object newCall(Object[] args) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "newCall", this, Optional.empty(), new Object[] { args}); - } - ACall result = this.newCallImpl(pt.up.fe.specs.util.SpecsCollections.cast(args, AJoinPoint.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "newCall", this, Optional.ofNullable(result), new Object[] { args}); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "newCall", e); - } - } - - /** - * Sets the body of the function - * @param body - */ - public void setBodyImpl(AScope body) { - throw new UnsupportedOperationException(get_class()+": Action setBody not implemented "); - } - - /** - * Sets the body of the function - * @param body - */ - public final void setBody(AScope body) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setBody", this, Optional.empty(), body); - } - this.setBodyImpl(body); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setBody", this, Optional.empty(), body); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setBody", e); - } - } - - /** - * Sets the type of the function - * @param functionType - */ - public void setFunctionTypeImpl(AFunctionType functionType) { - throw new UnsupportedOperationException(get_class()+": Action setFunctionType not implemented "); - } - - /** - * Sets the type of the function - * @param functionType - */ - public final void setFunctionType(AFunctionType functionType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setFunctionType", this, Optional.empty(), functionType); - } - this.setFunctionTypeImpl(functionType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setFunctionType", this, Optional.empty(), functionType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setFunctionType", e); - } - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param param - */ - public void setParamImpl(int index, AParam param) { - throw new UnsupportedOperationException(get_class()+": Action setParam not implemented "); - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param param - */ - public final void setParam(int index, AParam param) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParam", this, Optional.empty(), index, param); - } - this.setParamImpl(index, param); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParam", this, Optional.empty(), index, param); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParam", e); - } - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param name - * @param type - */ - public void setParamImpl(int index, String name, AType type) { - throw new UnsupportedOperationException(get_class()+": Action setParam not implemented "); - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param name - * @param type - */ - public final void setParam(int index, String name, AType type) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParam", this, Optional.empty(), index, name, type); - } - this.setParamImpl(index, name, type); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParam", this, Optional.empty(), index, name, type); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParam", e); - } - } - - /** - * Sets the type of a parameter of the function - * @param index - * @param newType - */ - public void setParamTypeImpl(int index, AType newType) { - throw new UnsupportedOperationException(get_class()+": Action setParamType not implemented "); - } - - /** - * Sets the type of a parameter of the function - * @param index - * @param newType - */ - public final void setParamType(int index, AType newType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParamType", this, Optional.empty(), index, newType); - } - this.setParamTypeImpl(index, newType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParamType", this, Optional.empty(), index, newType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParamType", e); - } - } - - /** - * Sets the parameters of the function - * @param params - */ - public void setParamsImpl(AParam[] params) { - throw new UnsupportedOperationException(get_class()+": Action setParams not implemented "); - } - - /** - * Sets the parameters of the function - * @param params - */ - public final void setParams(Object[] params) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParams", this, Optional.empty(), new Object[] { params}); - } - this.setParamsImpl(pt.up.fe.specs.util.SpecsCollections.cast(params, AParam.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParams", this, Optional.empty(), new Object[] { params}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParams", e); - } - } - - /** - * Overload that accepts strings that represent type-varname pairs (e.g., int param1) - * @param params - */ - public void setParamsFromStringsImpl(String[] params) { - throw new UnsupportedOperationException(get_class()+": Action setParamsFromStrings not implemented "); - } - - /** - * Overload that accepts strings that represent type-varname pairs (e.g., int param1) - * @param params - */ - public final void setParamsFromStrings(Object[] params) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParamsFromStrings", this, Optional.empty(), new Object[] { params}); - } - this.setParamsFromStringsImpl(pt.up.fe.specs.util.SpecsCollections.cast(params, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParamsFromStrings", this, Optional.empty(), new Object[] { params}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParamsFromStrings", e); - } - } - - /** - * Sets the return type of the function - * @param returnType - */ - public void setReturnTypeImpl(AType returnType) { - throw new UnsupportedOperationException(get_class()+": Action setReturnType not implemented "); - } - - /** - * Sets the return type of the function - * @param returnType - */ - public final void setReturnType(AType returnType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setReturnType", this, Optional.empty(), returnType); - } - this.setReturnTypeImpl(returnType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setReturnType", this, Optional.empty(), returnType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setReturnType", e); - } - } - - /** - * Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise. - * @param storageClass - */ - public boolean setStorageClassImpl(String storageClass) { - throw new UnsupportedOperationException(get_class()+": Action setStorageClass not implemented "); - } - - /** - * Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise. - * @param storageClass - */ - public final Object setStorageClass(String storageClass) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setStorageClass", this, Optional.empty(), storageClass); - } - boolean result = this.setStorageClassImpl(storageClass); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setStorageClass", this, Optional.ofNullable(result), storageClass); - } - return result; - } catch(Exception e) { - throw new ActionException(get_class(), "setStorageClass", e); - } - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aDeclarator.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aDeclarator.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aDeclarator.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aDeclarator.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDeclarator.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aDeclarator.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aDeclarator.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aDeclarator.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDeclarator.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDeclarator.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDeclarator.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDeclarator.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDeclarator.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDeclarator.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDeclarator.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDeclarator.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDeclarator.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDeclarator.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDeclarator.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDeclarator.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDeclarator.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDeclarator.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDeclarator.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDeclarator.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDeclarator.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDeclarator.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDeclarator.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDeclarator.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDeclarator.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDeclarator.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDeclarator.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDeclarator.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDeclarator.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDeclarator.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDeclarator.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDeclarator.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDeclarator.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDeclarator.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDeclarator.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDeclarator.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDeclarator.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDeclarator.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDeclarator.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDeclarator.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDeclarator.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDeclarator.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDeclarator.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDeclarator.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDeclarator.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDeclarator.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDeclarator.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDeclarator.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDeclarator.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDeclarator.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDeclarator.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDeclarator.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDeclarator.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDeclarator.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDeclarator.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDeclarator.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDeclarator.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDeclarator.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDeclarator.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDeclarator.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDeclarator.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDeclarator.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDeclarator.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDeclarator.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDeclarator.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDeclarator.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDeclarator.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDeclarator.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDeclarator.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDeclarator.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDeclarator.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDeclarator.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDeclarator.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDeclarator.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDeclarator.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDeclarator.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDeclarator.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDeclarator.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDeclarator.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aDeclarator.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aDeclarator.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aDeclarator.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDeclarator.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDeclarator.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDeclarator.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDeclarator.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDeclarator.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDeclarator); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "body": - joinPointList = selectBody(); - break; - case "param": - joinPointList = selectParam(); - break; - case "decl": - joinPointList = selectDecl(); - break; - default: - joinPointList = this.aDeclarator.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "body": { - if(value instanceof AScope){ - this.defBodyImpl((AScope)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "functionType": { - if(value instanceof AFunctionType){ - this.defFunctionTypeImpl((AFunctionType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "params": { - if(value instanceof AParam[]){ - this.defParamsImpl((AParam[])value); - return; - } - if(value instanceof String[]){ - this.defParamsImpl((String[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "returnType": { - if(value instanceof AType){ - this.defReturnTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aDeclarator.fillWithAttributes(attributes); - attributes.add("body"); - attributes.add("calls"); - attributes.add("canonical"); - attributes.add("declarationJp"); - attributes.add("declarationJps"); - attributes.add("definitionJp"); - attributes.add("functionType"); - attributes.add("getDeclaration"); - attributes.add("hasDefinition"); - attributes.add("id"); - attributes.add("isCanonical"); - attributes.add("isCudaKernel"); - attributes.add("isDelete"); - attributes.add("isImplementation"); - attributes.add("isInline"); - attributes.add("isModulePrivate"); - attributes.add("isPrototype"); - attributes.add("isPure"); - attributes.add("isVirtual"); - attributes.add("paramNames"); - attributes.add("params"); - attributes.add("returnType"); - attributes.add("signature"); - attributes.add("storageClass"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aDeclarator.fillWithSelects(selects); - selects.add("body"); - selects.add("param"); - selects.add("decl"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aDeclarator.fillWithActions(actions); - actions.add("void addParam(param)"); - actions.add("void addParam(String, type)"); - actions.add("function clone(String, Boolean)"); - actions.add("function cloneOnFile(String, String)"); - actions.add("function cloneOnFile(String, file)"); - actions.add("joinpoint insertReturn(joinpoint)"); - actions.add("joinpoint insertReturn(String)"); - actions.add("call newCall(joinpoint[])"); - actions.add("void setBody(scope)"); - actions.add("void setFunctionType(functionType)"); - actions.add("void setParam(int, param)"); - actions.add("void setParam(int, String, type)"); - actions.add("void setParamType(int, type)"); - actions.add("void setParams(param[])"); - actions.add("void setParamsFromStrings(String[])"); - actions.add("void setReturnType(type)"); - actions.add("boolean setStorageClass(StorageClass)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "function"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDeclarator.instanceOf(joinpointClass); - } - /** - * - */ - protected enum FunctionAttributes { - BODY("body"), - CALLS("calls"), - CANONICAL("canonical"), - DECLARATIONJP("declarationJp"), - DECLARATIONJPS("declarationJps"), - DEFINITIONJP("definitionJp"), - FUNCTIONTYPE("functionType"), - GETDECLARATION("getDeclaration"), - HASDEFINITION("hasDefinition"), - ID("id"), - ISCANONICAL("isCanonical"), - ISCUDAKERNEL("isCudaKernel"), - ISDELETE("isDelete"), - ISIMPLEMENTATION("isImplementation"), - ISINLINE("isInline"), - ISMODULEPRIVATE("isModulePrivate"), - ISPROTOTYPE("isPrototype"), - ISPURE("isPure"), - ISVIRTUAL("isVirtual"), - PARAMNAMES("paramNames"), - PARAMS("params"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - STORAGECLASS("storageClass"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private FunctionAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(FunctionAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunctionType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunctionType.java deleted file mode 100644 index 06cfc953f5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AFunctionType.java +++ /dev/null @@ -1,1451 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AFunctionType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AFunctionType extends AType { - - protected AType aType; - - /** - * - */ - public AFunctionType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute paramTypes - * @return the attribute's value - */ - public abstract AType[] getParamTypesArrayImpl(); - - /** - * Get value on attribute paramTypes - * @return the attribute's value - */ - public Object getParamTypesImpl() { - AType[] aTypeArrayImpl0 = getParamTypesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aTypeArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute paramTypes - * @return the attribute's value - */ - public final Object getParamTypes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "paramTypes", Optional.empty()); - } - Object result = this.getParamTypesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "paramTypes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "paramTypes", e); - } - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - public abstract AType getReturnTypeImpl(); - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - public final Object getReturnType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "returnType", Optional.empty()); - } - AType result = this.getReturnTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "returnType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "returnType", e); - } - } - - /** - * - */ - public void defReturnTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def returnType with type AType not implemented "); - } - - /** - * Sets the type of a parameter of the FunctionType. Be careful that if you directly change the type of a paramemter and the function type is associated with a function declaration, this change will not be reflected in the function. If you want to change the type of a parameter of a function declaration, use $function.setParaType - * @param index - * @param newType - */ - public void setParamTypeImpl(int index, AType newType) { - throw new UnsupportedOperationException(get_class()+": Action setParamType not implemented "); - } - - /** - * Sets the type of a parameter of the FunctionType. Be careful that if you directly change the type of a paramemter and the function type is associated with a function declaration, this change will not be reflected in the function. If you want to change the type of a parameter of a function declaration, use $function.setParaType - * @param index - * @param newType - */ - public final void setParamType(int index, AType newType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setParamType", this, Optional.empty(), index, newType); - } - this.setParamTypeImpl(index, newType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setParamType", this, Optional.empty(), index, newType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setParamType", e); - } - } - - /** - * Sets the return type of the FunctionType - * @param newType - */ - public void setReturnTypeImpl(AType newType) { - throw new UnsupportedOperationException(get_class()+": Action setReturnType not implemented "); - } - - /** - * Sets the return type of the FunctionType - * @param newType - */ - public final void setReturnType(AType newType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setReturnType", this, Optional.empty(), newType); - } - this.setReturnTypeImpl(newType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setReturnType", this, Optional.empty(), newType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setReturnType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "returnType": { - if(value instanceof AType){ - this.defReturnTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("paramTypes"); - attributes.add("returnType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - actions.add("void setParamType(int, type)"); - actions.add("void setReturnType(type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "functionType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum FunctionTypeAttributes { - PARAMTYPES("paramTypes"), - RETURNTYPE("returnType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private FunctionTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(FunctionTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AGotoStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AGotoStmt.java deleted file mode 100644 index 0b74e17f79..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AGotoStmt.java +++ /dev/null @@ -1,1311 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AGotoStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AGotoStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AGotoStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute label - * @return the attribute's value - */ - public abstract ALabelDecl getLabelImpl(); - - /** - * Get value on attribute label - * @return the attribute's value - */ - public final Object getLabel() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "label", Optional.empty()); - } - ALabelDecl result = this.getLabelImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "label", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "label", e); - } - } - - /** - * - */ - public void defLabelImpl(ALabelDecl value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def label with type ALabelDecl not implemented "); - } - - /** - * sets the label of the goto - * @param label - */ - public void setLabelImpl(ALabelDecl label) { - throw new UnsupportedOperationException(get_class()+": Action setLabel not implemented "); - } - - /** - * sets the label of the goto - * @param label - */ - public final void setLabel(ALabelDecl label) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setLabel", this, Optional.empty(), label); - } - this.setLabelImpl(label); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setLabel", this, Optional.empty(), label); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setLabel", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "label": { - if(value instanceof ALabelDecl){ - this.defLabelImpl((ALabelDecl)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("label"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - actions.add("void setLabel(labelDecl)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "gotoStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum GotoStmtAttributes { - LABEL("label"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private GotoStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(GotoStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIf.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIf.java deleted file mode 100644 index 369dad28d5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIf.java +++ /dev/null @@ -1,1535 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AIf - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AIf extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AIf(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute cond - * @return the attribute's value - */ - public abstract AExpression getCondImpl(); - - /** - * Get value on attribute cond - * @return the attribute's value - */ - public final Object getCond() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "cond", Optional.empty()); - } - AExpression result = this.getCondImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "cond", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "cond", e); - } - } - - /** - * - */ - public void defCondImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def cond with type AExpression not implemented "); - } - - /** - * Get value on attribute condDecl - * @return the attribute's value - */ - public abstract AVardecl getCondDeclImpl(); - - /** - * Get value on attribute condDecl - * @return the attribute's value - */ - public final Object getCondDecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "condDecl", Optional.empty()); - } - AVardecl result = this.getCondDeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "condDecl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "condDecl", e); - } - } - - /** - * Get value on attribute _else - * @return the attribute's value - */ - public abstract AScope getElseImpl(); - - /** - * Get value on attribute _else - * @return the attribute's value - */ - public final Object getElse() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "else", Optional.empty()); - } - AScope result = this.getElseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "else", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "else", e); - } - } - - /** - * - */ - public void defElseImpl(AStatement value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def else with type AStatement not implemented "); - } - - /** - * Get value on attribute then - * @return the attribute's value - */ - public abstract AScope getThenImpl(); - - /** - * Get value on attribute then - * @return the attribute's value - */ - public final Object getThen() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "then", Optional.empty()); - } - AScope result = this.getThenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "then", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "then", e); - } - } - - /** - * - */ - public void defThenImpl(AStatement value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def then with type AStatement not implemented "); - } - - /** - * Default implementation of the method used by the lara interpreter to select conds - * @return - */ - public List selectCond() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select condDecls - * @return - */ - public List selectCondDecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select thens - * @return - */ - public List selectThen() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select elses - * @return - */ - public List selectElse() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select bodys - * @return - */ - public List selectBody() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * sets the condition of the if - * @param cond - */ - public void setCondImpl(AExpression cond) { - throw new UnsupportedOperationException(get_class()+": Action setCond not implemented "); - } - - /** - * sets the condition of the if - * @param cond - */ - public final void setCond(AExpression cond) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCond", this, Optional.empty(), cond); - } - this.setCondImpl(cond); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCond", this, Optional.empty(), cond); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCond", e); - } - } - - /** - * sets the body of the else - * @param _else - */ - public void setElseImpl(AStatement _else) { - throw new UnsupportedOperationException(get_class()+": Action setElse not implemented "); - } - - /** - * sets the body of the else - * @param _else - */ - public final void setElse(AStatement _else) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setElse", this, Optional.empty(), _else); - } - this.setElseImpl(_else); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setElse", this, Optional.empty(), _else); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setElse", e); - } - } - - /** - * sets the body of the if - * @param then - */ - public void setThenImpl(AStatement then) { - throw new UnsupportedOperationException(get_class()+": Action setThen not implemented "); - } - - /** - * sets the body of the if - * @param then - */ - public final void setThen(AStatement then) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setThen", this, Optional.empty(), then); - } - this.setThenImpl(then); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setThen", this, Optional.empty(), then); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setThen", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "cond": - joinPointList = selectCond(); - break; - case "condDecl": - joinPointList = selectCondDecl(); - break; - case "then": - joinPointList = selectThen(); - break; - case "else": - joinPointList = selectElse(); - break; - case "body": - joinPointList = selectBody(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "cond": { - if(value instanceof AExpression){ - this.defCondImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "else": { - if(value instanceof AStatement){ - this.defElseImpl((AStatement)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "then": { - if(value instanceof AStatement){ - this.defThenImpl((AStatement)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("cond"); - attributes.add("condDecl"); - attributes.add("else"); - attributes.add("then"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - selects.add("cond"); - selects.add("condDecl"); - selects.add("then"); - selects.add("else"); - selects.add("body"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - actions.add("void setCond(expression)"); - actions.add("void setElse(statement)"); - actions.add("void setThen(statement)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "if"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum IfAttributes { - COND("cond"), - CONDDECL("condDecl"), - ELSE("else"), - THEN("then"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private IfAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(IfAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AImplicitValue.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AImplicitValue.java deleted file mode 100644 index 843065c514..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AImplicitValue.java +++ /dev/null @@ -1,1102 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AImplicitValue - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AImplicitValue extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AImplicitValue(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "implicitValue"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ImplicitValueAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ImplicitValueAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ImplicitValueAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInclude.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInclude.java deleted file mode 100644 index 27c028e45f..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInclude.java +++ /dev/null @@ -1,1127 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AInclude - * This class is overwritten by the Weaver Generator. - * - * Represents an include directive (e.g., #include ) - * @author Lara Weaver Generator - */ -public abstract class AInclude extends ADecl { - - protected ADecl aDecl; - - /** - * - */ - public AInclude(ADecl aDecl){ - this.aDecl = aDecl; - } - /** - * true if this is an angled include (i.e., system include) - */ - public abstract Boolean getIsAngledImpl(); - - /** - * true if this is an angled include (i.e., system include) - */ - public final Object getIsAngled() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isAngled", Optional.empty()); - } - Boolean result = this.getIsAngledImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isAngled", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isAngled", e); - } - } - - /** - * the name of the include - */ - public abstract String getNameImpl(); - - /** - * the name of the include - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * the path to the folder of the source file of the include, relative to the name of the include - */ - public abstract String getRelativeFolderpathImpl(); - - /** - * the path to the folder of the source file of the include, relative to the name of the include - */ - public final Object getRelativeFolderpath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "relativeFolderpath", Optional.empty()); - } - String result = this.getRelativeFolderpathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "relativeFolderpath", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "relativeFolderpath", e); - } - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDecl.getAttrsArrayImpl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDecl.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aDecl.fillWithAttributes(attributes); - attributes.add("isAngled"); - attributes.add("name"); - attributes.add("relativeFolderpath"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "include"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum IncludeAttributes { - ISANGLED("isAngled"), - NAME("name"), - RELATIVEFOLDERPATH("relativeFolderpath"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private IncludeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(IncludeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIncompleteArrayType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIncompleteArrayType.java deleted file mode 100644 index 7e2f97d15e..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIncompleteArrayType.java +++ /dev/null @@ -1,1348 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AIncompleteArrayType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AIncompleteArrayType extends AArrayType { - - protected AArrayType aArrayType; - - /** - * - */ - public AIncompleteArrayType(AArrayType aArrayType){ - super(aArrayType); - this.aArrayType = aArrayType; - } - /** - * Get value on attribute elementType - * @return the attribute's value - */ - @Override - public AType getElementTypeImpl() { - return this.aArrayType.getElementTypeImpl(); - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aArrayType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aArrayType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aArrayType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aArrayType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aArrayType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aArrayType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aArrayType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aArrayType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aArrayType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aArrayType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aArrayType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aArrayType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aArrayType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aArrayType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aArrayType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aArrayType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aArrayType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aArrayType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aArrayType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aArrayType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aArrayType.defTemplateArgsTypesImpl(value); - } - - /** - * - */ - public void defElementTypeImpl(AType value) { - this.aArrayType.defElementTypeImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aArrayType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aArrayType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aArrayType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aArrayType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aArrayType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aArrayType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aArrayType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aArrayType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aArrayType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aArrayType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aArrayType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aArrayType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aArrayType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aArrayType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aArrayType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aArrayType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aArrayType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aArrayType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aArrayType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aArrayType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aArrayType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aArrayType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aArrayType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aArrayType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aArrayType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aArrayType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aArrayType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aArrayType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aArrayType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aArrayType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aArrayType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aArrayType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aArrayType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aArrayType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aArrayType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aArrayType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aArrayType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aArrayType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aArrayType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aArrayType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aArrayType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aArrayType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aArrayType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aArrayType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aArrayType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aArrayType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aArrayType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aArrayType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aArrayType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aArrayType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aArrayType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aArrayType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aArrayType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aArrayType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aArrayType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aArrayType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aArrayType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aArrayType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aArrayType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aArrayType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aArrayType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aArrayType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aArrayType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aArrayType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aArrayType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aArrayType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aArrayType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aArrayType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aArrayType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aArrayType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aArrayType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aArrayType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aArrayType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aArrayType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aArrayType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aArrayType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aArrayType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aArrayType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aArrayType.setDesugarImpl(desugaredType); - } - - /** - * Sets the element type of the array - * @param arrayElementType - */ - @Override - public void setElementTypeImpl(AType arrayElementType) { - this.aArrayType.setElementTypeImpl(arrayElementType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aArrayType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aArrayType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aArrayType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aArrayType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aArrayType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aArrayType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aArrayType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aArrayType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aArrayType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aArrayType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aArrayType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aArrayType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aArrayType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aArrayType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aArrayType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "elementType": { - if(value instanceof AType){ - this.defElementTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aArrayType.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aArrayType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aArrayType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "incompleteArrayType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aArrayType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum IncompleteArrayTypeAttributes { - ELEMENTTYPE("elementType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private IncompleteArrayTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(IncompleteArrayTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInitList.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInitList.java deleted file mode 100644 index 044c315b15..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AInitList.java +++ /dev/null @@ -1,1129 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AInitList - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AInitList extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AInitList(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * [May be undefined] If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements - */ - public abstract AExpression getArrayFillerImpl(); - - /** - * [May be undefined] If this initializer list initializes an array with more elements than there are initializers in the list, specifies an expression to be used for value initialization of the rest of the elements - */ - public final Object getArrayFiller() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "arrayFiller", Optional.empty()); - } - AExpression result = this.getArrayFillerImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "arrayFiller", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "arrayFiller", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("arrayFiller"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "initList"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum InitListAttributes { - ARRAYFILLER("arrayFiller"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private InitListAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(InitListAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIntLiteral.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIntLiteral.java deleted file mode 100644 index 4565d56675..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AIntLiteral.java +++ /dev/null @@ -1,1132 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AIntLiteral - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AIntLiteral extends ALiteral { - - protected ALiteral aLiteral; - - /** - * - */ - public AIntLiteral(ALiteral aLiteral){ - super(aLiteral); - this.aLiteral = aLiteral; - } - /** - * Get value on attribute value - * @return the attribute's value - */ - public abstract Long getValueImpl(); - - /** - * Get value on attribute value - * @return the attribute's value - */ - public final Object getValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "value", Optional.empty()); - } - Long result = this.getValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "value", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "value", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aLiteral.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aLiteral.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aLiteral.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aLiteral.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aLiteral.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aLiteral.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aLiteral.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aLiteral.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aLiteral.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aLiteral.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aLiteral.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aLiteral.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aLiteral.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aLiteral.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aLiteral.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aLiteral.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aLiteral.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aLiteral.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aLiteral.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aLiteral.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aLiteral.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aLiteral.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aLiteral.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aLiteral.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aLiteral.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aLiteral.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aLiteral.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aLiteral.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aLiteral.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aLiteral.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aLiteral.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aLiteral.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aLiteral.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aLiteral.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aLiteral.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aLiteral.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aLiteral.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aLiteral.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aLiteral.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aLiteral.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aLiteral.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aLiteral.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aLiteral.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aLiteral.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aLiteral.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aLiteral.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aLiteral.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aLiteral.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aLiteral.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aLiteral.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aLiteral.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aLiteral.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aLiteral.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aLiteral.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aLiteral.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aLiteral.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aLiteral.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aLiteral.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aLiteral.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aLiteral.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aLiteral.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aLiteral.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aLiteral.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aLiteral.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aLiteral.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aLiteral.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aLiteral.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aLiteral.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aLiteral.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aLiteral.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aLiteral.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aLiteral.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aLiteral.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aLiteral.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aLiteral.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aLiteral.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aLiteral.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aLiteral.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aLiteral.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aLiteral.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aLiteral.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aLiteral.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aLiteral.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aLiteral.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aLiteral.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aLiteral.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aLiteral.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aLiteral.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aLiteral.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aLiteral.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aLiteral); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aLiteral.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aLiteral.fillWithAttributes(attributes); - attributes.add("value"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aLiteral.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aLiteral.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "intLiteral"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aLiteral.instanceOf(joinpointClass); - } - /** - * - */ - protected enum IntLiteralAttributes { - VALUE("value"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private IntLiteralAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(IntLiteralAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AJoinPoint.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AJoinPoint.java deleted file mode 100644 index bc12c62a13..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AJoinPoint.java +++ /dev/null @@ -1,2565 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import pt.up.fe.specs.clava.ClavaNode; -import java.util.List; -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.exception.AttributeException; -import pt.up.fe.specs.clava.weaver.CxxWeaver; -import org.lara.interpreter.weaver.interf.SelectOp; - -/** - * Abstract class containing the global attributes and default action exception. - * This class is overwritten when the weaver generator is executed. - * @author Lara Weaver Generator - */ -public abstract class AJoinPoint extends JoinPoint { - - /** - * - */ - @Override - public boolean same(JoinPoint iJoinPoint) { - if (this.get_class().equals(iJoinPoint.get_class())) { - - return this.compareNodes((AJoinPoint) iJoinPoint); - } - return false; - } - - /** - * Compares the two join points based on their node reference of the used compiler/parsing tool.
- * This is the default implementation for comparing two join points.
- * Note for developers: A weaver may override this implementation in the editable abstract join point, so - * the changes are made for all join points, or override this method in specific join points. - */ - public boolean compareNodes(AJoinPoint aJoinPoint) { - return this.getNode().equals(aJoinPoint.getNode()); - } - - /** - * Returns the tree node reference of this join point.
NOTEThis method is essentially used to compare two join points - * @return Tree node reference - */ - public abstract ClavaNode getNode(); - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - actions.add("copy()"); - actions.add("dataClear()"); - actions.add("deepCopy()"); - actions.add("detach()"); - actions.add("insertAfter(AJoinPoint node)"); - actions.add("insertAfter(String code)"); - actions.add("insertBefore(AJoinPoint node)"); - actions.add("insertBefore(String node)"); - actions.add("messageToUser(String message)"); - actions.add("removeChildren()"); - actions.add("replaceWith(AJoinPoint node)"); - actions.add("replaceWith(String node)"); - actions.add("replaceWith(AJoinPoint[] node)"); - actions.add("replaceWithStrings(String[] node)"); - actions.add("setData(Object source)"); - actions.add("setFirstChild(AJoinPoint node)"); - actions.add("setInlineComments(String[] comments)"); - actions.add("setInlineComments(String comments)"); - actions.add("setLastChild(AJoinPoint node)"); - actions.add("setType(AType type)"); - actions.add("setUserField(String fieldName, Object value)"); - actions.add("setUserField(Map fieldNameAndValue)"); - actions.add("setValue(String key, Object value)"); - actions.add("toComment(String prefix, String suffix)"); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - public AJoinPoint copyImpl() { - throw new UnsupportedOperationException(get_class()+": Action copy not implemented "); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - public final Object copy() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "copy", this, Optional.empty()); - } - AJoinPoint result = this.copyImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "copy", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "copy", e); - } - } - - /** - * Clears all properties from the .data object - */ - public void dataClearImpl() { - throw new UnsupportedOperationException(get_class()+": Action dataClear not implemented "); - } - - /** - * Clears all properties from the .data object - */ - public final void dataClear() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "dataClear", this, Optional.empty()); - } - this.dataClearImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "dataClear", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "dataClear", e); - } - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - public AJoinPoint deepCopyImpl() { - throw new UnsupportedOperationException(get_class()+": Action deepCopy not implemented "); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - public final Object deepCopy() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "deepCopy", this, Optional.empty()); - } - AJoinPoint result = this.deepCopyImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "deepCopy", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "deepCopy", e); - } - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - public AJoinPoint detachImpl() { - throw new UnsupportedOperationException(get_class()+": Action detach not implemented "); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - public final Object detach() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "detach", this, Optional.empty()); - } - AJoinPoint result = this.detachImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "detach", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "detach", e); - } - } - - /** - * Inserts the given join point after this join point - * @param node - */ - public AJoinPoint insertAfterImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertAfter not implemented "); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - public final Object insertAfter(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertAfter", this, Optional.empty(), node); - } - AJoinPoint result = this.insertAfterImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertAfter", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertAfter", e); - } - } - - /** - * Overload which accepts a string - * @param code - */ - public AJoinPoint insertAfterImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertAfter not implemented "); - } - - /** - * Overload which accepts a string - * @param code - */ - public final Object insertAfter(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertAfter", this, Optional.empty(), code); - } - AJoinPoint result = this.insertAfterImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertAfter", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertAfter", e); - } - } - - /** - * Inserts the given join point before this join point - * @param node - */ - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertBefore not implemented "); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - public final Object insertBefore(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBefore", this, Optional.empty(), node); - } - AJoinPoint result = this.insertBeforeImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBefore", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertBefore", e); - } - } - - /** - * Overload which accepts a string - * @param node - */ - public AJoinPoint insertBeforeImpl(String node) { - throw new UnsupportedOperationException(get_class()+": Action insertBefore not implemented "); - } - - /** - * Overload which accepts a string - * @param node - */ - public final Object insertBefore(String node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBefore", this, Optional.empty(), node); - } - AJoinPoint result = this.insertBeforeImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBefore", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertBefore", e); - } - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - public void messageToUserImpl(String message) { - throw new UnsupportedOperationException(get_class()+": Action messageToUser not implemented "); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - public final void messageToUser(String message) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "messageToUser", this, Optional.empty(), message); - } - this.messageToUserImpl(message); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "messageToUser", this, Optional.empty(), message); - } - } catch(Exception e) { - throw new ActionException(get_class(), "messageToUser", e); - } - } - - /** - * Removes the children of this node - */ - public void removeChildrenImpl() { - throw new UnsupportedOperationException(get_class()+": Action removeChildren not implemented "); - } - - /** - * Removes the children of this node - */ - public final void removeChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "removeChildren", this, Optional.empty()); - } - this.removeChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "removeChildren", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "removeChildren", e); - } - } - - /** - * Replaces this node with the given node - * @param node - */ - public AJoinPoint replaceWithImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action replaceWith not implemented "); - } - - /** - * Replaces this node with the given node - * @param node - */ - public final Object replaceWith(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "replaceWith", this, Optional.empty(), node); - } - AJoinPoint result = this.replaceWithImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "replaceWith", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "replaceWith", e); - } - } - - /** - * Overload which accepts a string - * @param node - */ - public AJoinPoint replaceWithImpl(String node) { - throw new UnsupportedOperationException(get_class()+": Action replaceWith not implemented "); - } - - /** - * Overload which accepts a string - * @param node - */ - public final Object replaceWith(String node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "replaceWith", this, Optional.empty(), node); - } - AJoinPoint result = this.replaceWithImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "replaceWith", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "replaceWith", e); - } - } - - /** - * Overload which accepts a list of join points - * @param node - */ - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - throw new UnsupportedOperationException(get_class()+": Action replaceWith not implemented "); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - public final Object replaceWith(Object[] node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "replaceWith", this, Optional.empty(), new Object[] { node}); - } - AJoinPoint result = this.replaceWithImpl(pt.up.fe.specs.util.SpecsCollections.cast(node, AJoinPoint.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "replaceWith", this, Optional.ofNullable(result), new Object[] { node}); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "replaceWith", e); - } - } - - /** - * Overload which accepts a list of strings - * @param node - */ - public AJoinPoint replaceWithStringsImpl(String[] node) { - throw new UnsupportedOperationException(get_class()+": Action replaceWithStrings not implemented "); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - public final Object replaceWithStrings(Object[] node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "replaceWithStrings", this, Optional.empty(), new Object[] { node}); - } - AJoinPoint result = this.replaceWithStringsImpl(pt.up.fe.specs.util.SpecsCollections.cast(node, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "replaceWithStrings", this, Optional.ofNullable(result), new Object[] { node}); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "replaceWithStrings", e); - } - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - public void setDataImpl(Object source) { - throw new UnsupportedOperationException(get_class()+": Action setData not implemented "); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - public final void setData(Object source) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setData", this, Optional.empty(), source); - } - this.setDataImpl(source); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setData", this, Optional.empty(), source); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setData", e); - } - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action setFirstChild not implemented "); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - public final Object setFirstChild(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setFirstChild", this, Optional.empty(), node); - } - AJoinPoint result = this.setFirstChildImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setFirstChild", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setFirstChild", e); - } - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - public void setInlineCommentsImpl(String[] comments) { - throw new UnsupportedOperationException(get_class()+": Action setInlineComments not implemented "); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - public final void setInlineComments(Object[] comments) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInlineComments", this, Optional.empty(), new Object[] { comments}); - } - this.setInlineCommentsImpl(pt.up.fe.specs.util.SpecsCollections.cast(comments, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInlineComments", this, Optional.empty(), new Object[] { comments}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInlineComments", e); - } - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - public void setInlineCommentsImpl(String comments) { - throw new UnsupportedOperationException(get_class()+": Action setInlineComments not implemented "); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - public final void setInlineComments(String comments) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInlineComments", this, Optional.empty(), comments); - } - this.setInlineCommentsImpl(comments); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInlineComments", this, Optional.empty(), comments); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInlineComments", e); - } - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - public AJoinPoint setLastChildImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action setLastChild not implemented "); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - public final Object setLastChild(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setLastChild", this, Optional.empty(), node); - } - AJoinPoint result = this.setLastChildImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setLastChild", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setLastChild", e); - } - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - public void setTypeImpl(AType type) { - throw new UnsupportedOperationException(get_class()+": Action setType not implemented "); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - public final void setType(AType type) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setType", this, Optional.empty(), type); - } - this.setTypeImpl(type); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setType", this, Optional.empty(), type); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setType", e); - } - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - public Object setUserFieldImpl(String fieldName, Object value) { - throw new UnsupportedOperationException(get_class()+": Action setUserField not implemented "); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - public final Object setUserField(String fieldName, Object value) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setUserField", this, Optional.empty(), fieldName, value); - } - Object result = this.setUserFieldImpl(fieldName, value); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setUserField", this, Optional.ofNullable(result), fieldName, value); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setUserField", e); - } - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - public Object setUserFieldImpl(Map fieldNameAndValue) { - throw new UnsupportedOperationException(get_class()+": Action setUserField not implemented "); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - public final Object setUserField(Map fieldNameAndValue) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setUserField", this, Optional.empty(), fieldNameAndValue); - } - Object result = this.setUserFieldImpl(fieldNameAndValue); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setUserField", this, Optional.ofNullable(result), fieldNameAndValue); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setUserField", e); - } - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - public AJoinPoint setValueImpl(String key, Object value) { - throw new UnsupportedOperationException(get_class()+": Action setValue not implemented "); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - public final Object setValue(String key, Object value) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setValue", this, Optional.empty(), key, value); - } - AJoinPoint result = this.setValueImpl(key, value); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setValue", this, Optional.ofNullable(result), key, value); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setValue", e); - } - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - public AJoinPoint toCommentImpl(String prefix, String suffix) { - throw new UnsupportedOperationException(get_class()+": Action toComment not implemented "); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - public final Object toComment(String prefix, String suffix) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "toComment", this, Optional.empty(), prefix, suffix); - } - AJoinPoint result = this.toCommentImpl(prefix, suffix); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "toComment", this, Optional.ofNullable(result), prefix, suffix); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "toComment", e); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - // Default attributes - super.fillWithAttributes(attributes); - - //Attributes available for all join points - attributes.add("ast"); - attributes.add("astChildren"); - attributes.add("astId"); - attributes.add("astIsInstance(String className)"); - attributes.add("astName"); - attributes.add("astNumChildren"); - attributes.add("bitWidth"); - attributes.add("chain"); - attributes.add("children"); - attributes.add("code"); - attributes.add("column"); - attributes.add("contains(AJoinPoint jp)"); - attributes.add("currentRegion"); - attributes.add("data"); - attributes.add("depth"); - attributes.add("descendants"); - attributes.add("endColumn"); - attributes.add("endLine"); - attributes.add("filename"); - attributes.add("filepath"); - attributes.add("firstChild"); - attributes.add("getAncestor(String type)"); - attributes.add("getAstAncestor(String type)"); - attributes.add("getAstChild(int index)"); - attributes.add("getChainAncestor(String type)"); - attributes.add("getChild(int index)"); - attributes.add("getDescendants(String type)"); - attributes.add("getDescendantsAndSelf(String type)"); - attributes.add("getFirstJp(String type)"); - attributes.add("getJavaFieldType(String fieldName)"); - attributes.add("getKeyType(String key)"); - attributes.add("getUserField(String fieldName)"); - attributes.add("getValue(String key)"); - attributes.add("hasChildren"); - attributes.add("hasNode(Object nodeOrJp)"); - attributes.add("hasParent"); - attributes.add("hasType"); - attributes.add("inlineComments"); - attributes.add("isCilk"); - attributes.add("isInSystemHeader"); - attributes.add("isInsideHeader"); - attributes.add("isInsideLoopHeader"); - attributes.add("isMacro"); - attributes.add("javaFields"); - attributes.add("jpFields(Boolean recursive)"); - attributes.add("jpId"); - attributes.add("keys"); - attributes.add("lastChild"); - attributes.add("leftJp"); - attributes.add("line"); - attributes.add("location"); - attributes.add("numChildren"); - attributes.add("originNode"); - attributes.add("parent"); - attributes.add("parentRegion"); - attributes.add("pragmas"); - attributes.add("rightJp"); - attributes.add("root"); - attributes.add("scopeNodes"); - attributes.add("siblingsLeft"); - attributes.add("siblingsRight"); - attributes.add("stmt"); - attributes.add("type"); - } - - /** - * String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump' - */ - public abstract String getAstImpl(); - - /** - * String with a dump of the AST representation starting from this node. This representation corresponds to the internal Java representation of the ClavaAst, where the node names correspond to Java classes. To get an equivalent representation with join point names, use the attribute 'dump' - */ - public final Object getAst() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "ast", Optional.empty()); - } - String result = this.getAstImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "ast", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "ast", e); - } - } - - /** - * Get value on attribute astChildren - * @return the attribute's value - */ - public abstract AJoinPoint[] getAstChildrenArrayImpl(); - - /** - * Returns an array with the children of the node, considering null nodes - */ - public Object getAstChildrenImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getAstChildrenArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * Returns an array with the children of the node, considering null nodes - */ - public final Object getAstChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "astChildren", Optional.empty()); - } - Object result = this.getAstChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "astChildren", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "astChildren", e); - } - } - - /** - * String that uniquely identifies this node - */ - public abstract String getAstIdImpl(); - - /** - * String that uniquely identifies this node - */ - public final Object getAstId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "astId", Optional.empty()); - } - String result = this.getAstIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "astId", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "astId", e); - } - } - - /** - * - * @param className - * @return - */ - public abstract Boolean astIsInstanceImpl(String className); - - /** - * - * @param className - * @return - */ - public final Object astIsInstance(String className) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "astIsInstance", Optional.empty(), className); - } - Boolean result = this.astIsInstanceImpl(className); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "astIsInstance", Optional.ofNullable(result), className); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "astIsInstance", e); - } - } - - /** - * The name of the Java class of this node, which is similar to the equivalent node in Clang AST - */ - public abstract String getAstNameImpl(); - - /** - * The name of the Java class of this node, which is similar to the equivalent node in Clang AST - */ - public final Object getAstName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "astName", Optional.empty()); - } - String result = this.getAstNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "astName", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "astName", e); - } - } - - /** - * Returns the number of children of the node, considering null nodes - */ - public abstract Integer getAstNumChildrenImpl(); - - /** - * Returns the number of children of the node, considering null nodes - */ - public final Object getAstNumChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "astNumChildren", Optional.empty()); - } - Integer result = this.getAstNumChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "astNumChildren", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "astNumChildren", e); - } - } - - /** - * The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit - */ - public abstract Integer getBitWidthImpl(); - - /** - * The bit width of the type returned by this join point, in relation to the definitions of its Translation Unit, or undefined if there is no type or bitwidth defined, or if the join point is not in a TranslationUnit - */ - public final Object getBitWidth() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "bitWidth", Optional.empty()); - } - Integer result = this.getBitWidthImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "bitWidth", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "bitWidth", e); - } - } - - /** - * Get value on attribute chain - * @return the attribute's value - */ - public abstract String[] getChainArrayImpl(); - - /** - * String list of the names of the join points that form a path from the root to this node - */ - public Object getChainImpl() { - String[] stringArrayImpl0 = getChainArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * String list of the names of the join points that form a path from the root to this node - */ - public final Object getChain() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "chain", Optional.empty()); - } - Object result = this.getChainImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "chain", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "chain", e); - } - } - - /** - * Get value on attribute children - * @return the attribute's value - */ - public abstract AJoinPoint[] getChildrenArrayImpl(); - - /** - * Returns an array with the children of the node, ignoring null nodes - */ - public Object getChildrenImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getChildrenArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * Returns an array with the children of the node, ignoring null nodes - */ - public final Object getChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "children", Optional.empty()); - } - Object result = this.getChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "children", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "children", e); - } - } - - /** - * String with the code represented by this node - */ - public abstract String getCodeImpl(); - - /** - * String with the code represented by this node - */ - public final Object getCode() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "code", Optional.empty()); - } - String result = this.getCodeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "code", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "code", e); - } - } - - /** - * The starting column of the current node in the original code - */ - public abstract Integer getColumnImpl(); - - /** - * The starting column of the current node in the original code - */ - public final Object getColumn() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "column", Optional.empty()); - } - Integer result = this.getColumnImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "column", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "column", e); - } - } - - /** - * - * @param jp - * @return - */ - public abstract Boolean containsImpl(AJoinPoint jp); - - /** - * - * @param jp - * @return - */ - public final Object contains(AJoinPoint jp) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "contains", Optional.empty(), jp); - } - Boolean result = this.containsImpl(jp); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "contains", Optional.ofNullable(result), jp); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "contains", e); - } - } - - /** - * Returns the node that declares the scope of this node - */ - public abstract AJoinPoint getCurrentRegionImpl(); - - /** - * Returns the node that declares the scope of this node - */ - public final Object getCurrentRegion() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "currentRegion", Optional.empty()); - } - AJoinPoint result = this.getCurrentRegionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "currentRegion", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "currentRegion", e); - } - } - - /** - * JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds. - */ - public abstract Object getDataImpl(); - - /** - * - */ - public void defDataImpl(Object value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def data with type Object not implemented "); - } - - /** - * JS object associated with this node, containing parsed data of #pragma clava data when the node can be a target of pragmas. This is a special object, managed internally, and cannot be reassigned, to change its contents requires using key-value pairs. If the node can be the target of a pragma, the information stored in this object is persisted between rebuilds. - */ - public final Object getData() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "data", Optional.empty()); - } - Object result = this.getDataImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "data", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "data", e); - } - } - - /** - * the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc. - */ - public abstract Integer getDepthImpl(); - - /** - * the depth of this join point in the AST. If it is the root join point returns 0, if it is a child of the root node returns 1, etc. - */ - public final Object getDepth() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "depth", Optional.empty()); - } - Integer result = this.getDepthImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "depth", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "depth", e); - } - } - - /** - * Get value on attribute descendants - * @return the attribute's value - */ - public abstract AJoinPoint[] getDescendantsArrayImpl(); - - /** - * Retrieves all descendants of the join point - */ - public Object getDescendantsImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getDescendantsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * Retrieves all descendants of the join point - */ - public final Object getDescendants() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "descendants", Optional.empty()); - } - Object result = this.getDescendantsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "descendants", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "descendants", e); - } - } - - /** - * The ending column of the current node in the original code - */ - public abstract Integer getEndColumnImpl(); - - /** - * The ending column of the current node in the original code - */ - public final Object getEndColumn() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "endColumn", Optional.empty()); - } - Integer result = this.getEndColumnImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "endColumn", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "endColumn", e); - } - } - - /** - * The ending line of the current node in the original code - */ - public abstract Integer getEndLineImpl(); - - /** - * The ending line of the current node in the original code - */ - public final Object getEndLine() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "endLine", Optional.empty()); - } - Integer result = this.getEndLineImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "endLine", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "endLine", e); - } - } - - /** - * The name of the file where the code of this node is located, if available - */ - public abstract String getFilenameImpl(); - - /** - * The name of the file where the code of this node is located, if available - */ - public final Object getFilename() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "filename", Optional.empty()); - } - String result = this.getFilenameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "filename", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "filename", e); - } - } - - /** - * the complete path to the file where the code of this node comes from - */ - public abstract String getFilepathImpl(); - - /** - * the complete path to the file where the code of this node comes from - */ - public final Object getFilepath() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "filepath", Optional.empty()); - } - String result = this.getFilepathImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "filepath", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "filepath", e); - } - } - - /** - * Returns the first child of this node, or undefined if it has no child - */ - public abstract AJoinPoint getFirstChildImpl(); - - /** - * - */ - public void defFirstChildImpl(AJoinPoint value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def firstChild with type AJoinPoint not implemented "); - } - - /** - * Returns the first child of this node, or undefined if it has no child - */ - public final Object getFirstChild() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "firstChild", Optional.empty()); - } - AJoinPoint result = this.getFirstChildImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "firstChild", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "firstChild", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint getAncestorImpl(String type); - - /** - * - * @param type - * @return - */ - public final Object getAncestor(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getAncestor", Optional.empty(), type); - } - AJoinPoint result = this.getAncestorImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getAncestor", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getAncestor", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint getAstAncestorImpl(String type); - - /** - * - * @param type - * @return - */ - public final Object getAstAncestor(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getAstAncestor", Optional.empty(), type); - } - AJoinPoint result = this.getAstAncestorImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getAstAncestor", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getAstAncestor", e); - } - } - - /** - * - * @param index - * @return - */ - public abstract AJoinPoint getAstChildImpl(int index); - - /** - * - * @param index - * @return - */ - public final Object getAstChild(int index) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getAstChild", Optional.empty(), index); - } - AJoinPoint result = this.getAstChildImpl(index); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getAstChild", Optional.ofNullable(result), index); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getAstChild", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint getChainAncestorImpl(String type); - - /** - * - * @param type - * @return - */ - public final Object getChainAncestor(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getChainAncestor", Optional.empty(), type); - } - AJoinPoint result = this.getChainAncestorImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getChainAncestor", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getChainAncestor", e); - } - } - - /** - * - * @param index - * @return - */ - public abstract AJoinPoint getChildImpl(int index); - - /** - * - * @param index - * @return - */ - public final Object getChild(int index) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getChild", Optional.empty(), index); - } - AJoinPoint result = this.getChildImpl(index); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getChild", Optional.ofNullable(result), index); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getChild", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint[] getDescendantsArrayImpl(String type); - - /** - * - * @param type - * @return - */ - public Object getDescendantsImpl(String type) { - AJoinPoint[] aJoinPointArrayImpl0 = getDescendantsArrayImpl(type); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * - * @param type - * @return - */ - public final Object getDescendants(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getDescendants", Optional.empty(), type); - } - Object result = this.getDescendantsImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getDescendants", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getDescendants", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint[] getDescendantsAndSelfArrayImpl(String type); - - /** - * - * @param type - * @return - */ - public Object getDescendantsAndSelfImpl(String type) { - AJoinPoint[] aJoinPointArrayImpl0 = getDescendantsAndSelfArrayImpl(type); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * - * @param type - * @return - */ - public final Object getDescendantsAndSelf(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getDescendantsAndSelf", Optional.empty(), type); - } - Object result = this.getDescendantsAndSelfImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getDescendantsAndSelf", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getDescendantsAndSelf", e); - } - } - - /** - * - * @param type - * @return - */ - public abstract AJoinPoint getFirstJpImpl(String type); - - /** - * - * @param type - * @return - */ - public final Object getFirstJp(String type) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getFirstJp", Optional.empty(), type); - } - AJoinPoint result = this.getFirstJpImpl(type); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getFirstJp", Optional.ofNullable(result), type); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getFirstJp", e); - } - } - - /** - * - * @param fieldName - * @return - */ - public abstract String getJavaFieldTypeImpl(String fieldName); - - /** - * - * @param fieldName - * @return - */ - public final Object getJavaFieldType(String fieldName) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getJavaFieldType", Optional.empty(), fieldName); - } - String result = this.getJavaFieldTypeImpl(fieldName); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getJavaFieldType", Optional.ofNullable(result), fieldName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getJavaFieldType", e); - } - } - - /** - * - * @param key - * @return - */ - public abstract Object getKeyTypeImpl(String key); - - /** - * - * @param key - * @return - */ - public final Object getKeyType(String key) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getKeyType", Optional.empty(), key); - } - Object result = this.getKeyTypeImpl(key); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getKeyType", Optional.ofNullable(result), key); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getKeyType", e); - } - } - - /** - * - * @param fieldName - * @return - */ - public abstract Object getUserFieldImpl(String fieldName); - - /** - * - * @param fieldName - * @return - */ - public final Object getUserField(String fieldName) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getUserField", Optional.empty(), fieldName); - } - Object result = this.getUserFieldImpl(fieldName); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getUserField", Optional.ofNullable(result), fieldName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getUserField", e); - } - } - - /** - * - * @param key - * @return - */ - public abstract Object getValueImpl(String key); - - /** - * - * @param key - * @return - */ - public final Object getValue(String key) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getValue", Optional.empty(), key); - } - Object result = this.getValueImpl(key); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getValue", Optional.ofNullable(result), key); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getValue", e); - } - } - - /** - * true if the node has children, false otherwise - */ - public abstract Boolean getHasChildrenImpl(); - - /** - * true if the node has children, false otherwise - */ - public final Object getHasChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasChildren", Optional.empty()); - } - Boolean result = this.getHasChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasChildren", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasChildren", e); - } - } - - /** - * - * @param nodeOrJp - * @return - */ - public abstract Boolean hasNodeImpl(Object nodeOrJp); - - /** - * - * @param nodeOrJp - * @return - */ - public final Object hasNode(Object nodeOrJp) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasNode", Optional.empty(), nodeOrJp); - } - Boolean result = this.hasNodeImpl(nodeOrJp); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasNode", Optional.ofNullable(result), nodeOrJp); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasNode", e); - } - } - - /** - * true if this node has a parent - */ - public abstract Boolean getHasParentImpl(); - - /** - * true if this node has a parent - */ - public final Object getHasParent() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasParent", Optional.empty()); - } - Boolean result = this.getHasParentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasParent", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasParent", e); - } - } - - /** - * true, if the join point has a type - */ - public abstract Boolean getHasTypeImpl(); - - /** - * true, if the join point has a type - */ - public final Object getHasType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasType", Optional.empty()); - } - Boolean result = this.getHasTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasType", e); - } - } - - /** - * Get value on attribute inlineComments - * @return the attribute's value - */ - public abstract AComment[] getInlineCommentsArrayImpl(); - - /** - * Returns comments that are not explicitly in the AST, but embedded in other nodes - */ - public Object getInlineCommentsImpl() { - AComment[] aCommentArrayImpl0 = getInlineCommentsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aCommentArrayImpl0); - return nativeArray0; - } - - /** - * - */ - public void defInlineCommentsImpl(String[] value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def inlineComments with type String not implemented "); - } - - /** - * - */ - public void defInlineCommentsImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def inlineComments with type String not implemented "); - } - - /** - * Returns comments that are not explicitly in the AST, but embedded in other nodes - */ - public final Object getInlineComments() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "inlineComments", Optional.empty()); - } - Object result = this.getInlineCommentsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "inlineComments", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "inlineComments", e); - } - } - - /** - * true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for) - */ - public abstract Boolean getIsCilkImpl(); - - /** - * true if this is a Cilk node (i.e., cilk_spawn, cilk_sync or cilk_for) - */ - public final Object getIsCilk() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCilk", Optional.empty()); - } - Boolean result = this.getIsCilkImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCilk", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCilk", e); - } - } - - /** - * true, if the join point is part of a system header file - */ - public abstract Boolean getIsInSystemHeaderImpl(); - - /** - * true, if the join point is part of a system header file - */ - public final Object getIsInSystemHeader() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInSystemHeader", Optional.empty()); - } - Boolean result = this.getIsInSystemHeaderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInSystemHeader", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInSystemHeader", e); - } - } - - /** - * true, if the join point is inside a header (e.g., if condition, for, while) - */ - public abstract Boolean getIsInsideHeaderImpl(); - - /** - * true, if the join point is inside a header (e.g., if condition, for, while) - */ - public final Object getIsInsideHeader() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInsideHeader", Optional.empty()); - } - Boolean result = this.getIsInsideHeaderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInsideHeader", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInsideHeader", e); - } - } - - /** - * true, if the join point is inside a loop header (e.g., for, while) - */ - public abstract Boolean getIsInsideLoopHeaderImpl(); - - /** - * true, if the join point is inside a loop header (e.g., for, while) - */ - public final Object getIsInsideLoopHeader() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInsideLoopHeader", Optional.empty()); - } - Boolean result = this.getIsInsideLoopHeaderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInsideLoopHeader", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInsideLoopHeader", e); - } - } - - /** - * true if any descendant or the node itself was defined as a macro - */ - public abstract Boolean getIsMacroImpl(); - - /** - * true if any descendant or the node itself was defined as a macro - */ - public final Object getIsMacro() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isMacro", Optional.empty()); - } - Boolean result = this.getIsMacroImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isMacro", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isMacro", e); - } - } - - /** - * Get value on attribute javaFields - * @return the attribute's value - */ - public abstract String[] getJavaFieldsArrayImpl(); - - /** - * [DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue' - */ - public Object getJavaFieldsImpl() { - String[] stringArrayImpl0 = getJavaFieldsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * [DEPRECATED: used attribute 'keys' instead, together with 'getValue'] The names of the Java fields of this node. Can be used as key of the attribute 'javaValue' - */ - public final Object getJavaFields() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "javaFields", Optional.empty()); - } - Object result = this.getJavaFieldsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "javaFields", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "javaFields", e); - } - } - - /** - * - * @param recursive - * @return - */ - public abstract AJoinPoint[] jpFieldsArrayImpl(Boolean recursive); - - /** - * - * @param recursive - * @return - */ - public Object jpFieldsImpl(Boolean recursive) { - AJoinPoint[] aJoinPointArrayImpl0 = jpFieldsArrayImpl(recursive); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * - * @param recursive - * @return - */ - public final Object jpFields(Boolean recursive) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "jpFields", Optional.empty(), recursive); - } - Object result = this.jpFieldsImpl(recursive); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "jpFields", Optional.ofNullable(result), recursive); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "jpFields", e); - } - } - - /** - * Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it) - */ - public abstract String getJpIdImpl(); - - /** - * Id that is based on the position of the node in the code, and should remain stable between compilations (warning: only a few nodes - file, function, loop - currently support it) - */ - public final Object getJpId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "jpId", Optional.empty()); - } - String result = this.getJpIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "jpId", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "jpId", e); - } - } - - /** - * Get value on attribute keys - * @return the attribute's value - */ - public abstract String[] getKeysArrayImpl(); - - /** - * A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue' - */ - public Object getKeysImpl() { - String[] stringArrayImpl0 = getKeysArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * A list of the properties currently supported by this node. Can be used as parameter of the attribute 'getValue' - */ - public final Object getKeys() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "keys", Optional.empty()); - } - Object result = this.getKeysImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "keys", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "keys", e); - } - } - - /** - * Returns the last child of this node, or undefined if it has no child - */ - public abstract AJoinPoint getLastChildImpl(); - - /** - * - */ - public void defLastChildImpl(AJoinPoint value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def lastChild with type AJoinPoint not implemented "); - } - - /** - * Returns the last child of this node, or undefined if it has no child - */ - public final Object getLastChild() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "lastChild", Optional.empty()); - } - AJoinPoint result = this.getLastChildImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "lastChild", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "lastChild", e); - } - } - - /** - * Returns the node that came before this node, or undefined if there is none - */ - public abstract AJoinPoint getLeftJpImpl(); - - /** - * Returns the node that came before this node, or undefined if there is none - */ - public final Object getLeftJp() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "leftJp", Optional.empty()); - } - AJoinPoint result = this.getLeftJpImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "leftJp", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "leftJp", e); - } - } - - /** - * The starting line of the current node in the original code - */ - public abstract Integer getLineImpl(); - - /** - * The starting line of the current node in the original code - */ - public final Object getLine() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "line", Optional.empty()); - } - Integer result = this.getLineImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "line", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "line", e); - } - } - - /** - * A string with information about the file and code position of this node, if available - */ - public abstract String getLocationImpl(); - - /** - * A string with information about the file and code position of this node, if available - */ - public final Object getLocation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "location", Optional.empty()); - } - String result = this.getLocationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "location", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "location", e); - } - } - - /** - * Returns the number of children of the node, ignoring null nodes - */ - public abstract Integer getNumChildrenImpl(); - - /** - * Returns the number of children of the node, ignoring null nodes - */ - public final Object getNumChildren() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "numChildren", Optional.empty()); - } - Integer result = this.getNumChildrenImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "numChildren", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "numChildren", e); - } - } - - /** - * If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin - */ - public abstract AJoinPoint getOriginNodeImpl(); - - /** - * If this join point was not originally from the parsed AST, returns the first join point of the original AST that contributed to its origin - */ - public final Object getOriginNode() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "originNode", Optional.empty()); - } - AJoinPoint result = this.getOriginNodeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "originNode", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "originNode", e); - } - } - - /** - * Returns the parent node in the AST, or undefined if it is the root node - */ - public abstract AJoinPoint getParentImpl(); - - /** - * Returns the parent node in the AST, or undefined if it is the root node - */ - public final Object getParent() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "parent", Optional.empty()); - } - AJoinPoint result = this.getParentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "parent", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "parent", e); - } - } - - /** - * Returns the node that declares the scope that is a parent of the scope of this node - */ - public abstract AJoinPoint getParentRegionImpl(); - - /** - * Returns the node that declares the scope that is a parent of the scope of this node - */ - public final Object getParentRegion() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "parentRegion", Optional.empty()); - } - AJoinPoint result = this.getParentRegionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "parentRegion", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "parentRegion", e); - } - } - - /** - * Get value on attribute pragmas - * @return the attribute's value - */ - public abstract APragma[] getPragmasArrayImpl(); - - /** - * The pragmas associated with this node - */ - public Object getPragmasImpl() { - APragma[] aPragmaArrayImpl0 = getPragmasArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aPragmaArrayImpl0); - return nativeArray0; - } - - /** - * The pragmas associated with this node - */ - public final Object getPragmas() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "pragmas", Optional.empty()); - } - Object result = this.getPragmasImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "pragmas", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "pragmas", e); - } - } - - /** - * Returns the node that comes after this node, or undefined if there is none - */ - public abstract AJoinPoint getRightJpImpl(); - - /** - * Returns the node that comes after this node, or undefined if there is none - */ - public final Object getRightJp() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "rightJp", Optional.empty()); - } - AJoinPoint result = this.getRightJpImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "rightJp", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "rightJp", e); - } - } - - /** - * Returns the 'program' joinpoint - */ - public abstract AProgram getRootImpl(); - - /** - * Returns the 'program' joinpoint - */ - public final Object getRoot() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "root", Optional.empty()); - } - AProgram result = this.getRootImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "root", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "root", e); - } - } - - /** - * Get value on attribute scopeNodes - * @return the attribute's value - */ - public abstract AJoinPoint[] getScopeNodesArrayImpl(); - - /** - * the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array - */ - public Object getScopeNodesImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getScopeNodesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * the nodes of the scope of the current join point. If this node has a body (e.g., loop, function) corresponds to the children of the body. Otherwise, returns an empty array - */ - public final Object getScopeNodes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "scopeNodes", Optional.empty()); - } - Object result = this.getScopeNodesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "scopeNodes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "scopeNodes", e); - } - } - - /** - * Get value on attribute siblingsLeft - * @return the attribute's value - */ - public abstract AJoinPoint[] getSiblingsLeftArrayImpl(); - - /** - * Returns an array with the siblings that came before this node - */ - public Object getSiblingsLeftImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getSiblingsLeftArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * Returns an array with the siblings that came before this node - */ - public final Object getSiblingsLeft() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "siblingsLeft", Optional.empty()); - } - Object result = this.getSiblingsLeftImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "siblingsLeft", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "siblingsLeft", e); - } - } - - /** - * Get value on attribute siblingsRight - * @return the attribute's value - */ - public abstract AJoinPoint[] getSiblingsRightArrayImpl(); - - /** - * Returns an array with the siblings that come after this node - */ - public Object getSiblingsRightImpl() { - AJoinPoint[] aJoinPointArrayImpl0 = getSiblingsRightArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * Returns an array with the siblings that come after this node - */ - public final Object getSiblingsRight() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "siblingsRight", Optional.empty()); - } - Object result = this.getSiblingsRightImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "siblingsRight", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "siblingsRight", e); - } - } - - /** - * Converts this join point to a statement, or returns undefined if it was not possible - */ - public abstract AStatement getStmtImpl(); - - /** - * Converts this join point to a statement, or returns undefined if it was not possible - */ - public final Object getStmt() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "stmt", Optional.empty()); - } - AStatement result = this.getStmtImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "stmt", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "stmt", e); - } - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - public abstract AType getTypeImpl(); - - /** - * - */ - public void defTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def type with type AType not implemented "); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - public final Object getType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "type", Optional.empty()); - } - AType result = this.getTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "type", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "type", e); - } - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return super.instanceOf(joinpointClass); - } - - /** - * Returns the Weaving Engine this join point pertains to. - */ - @Override - public CxxWeaver getWeaverEngine() { - return CxxWeaver.getCxxWeaver(); - } - - /** - * Generic select function, used by the default select implementations. - */ - public abstract List select(Class joinPointClass, SelectOp op); -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelDecl.java deleted file mode 100644 index 70fb06dba8..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelDecl.java +++ /dev/null @@ -1,1189 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ALabelDecl - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ALabelDecl extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public ALabelDecl(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute labelStmt - * @return the attribute's value - */ - public abstract ALabelStmt getLabelStmtImpl(); - - /** - * Get value on attribute labelStmt - * @return the attribute's value - */ - public final Object getLabelStmt() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "labelStmt", Optional.empty()); - } - ALabelStmt result = this.getLabelStmtImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "labelStmt", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "labelStmt", e); - } - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - attributes.add("labelStmt"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "labelDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum LabelDeclAttributes { - LABELSTMT("labelStmt"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private LabelDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(LabelDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelStmt.java deleted file mode 100644 index 1537041701..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALabelStmt.java +++ /dev/null @@ -1,1311 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ALabelStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ALabelStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ALabelStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - public abstract ALabelDecl getDeclImpl(); - - /** - * Get value on attribute decl - * @return the attribute's value - */ - public final Object getDecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "decl", Optional.empty()); - } - ALabelDecl result = this.getDeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "decl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "decl", e); - } - } - - /** - * - */ - public void defDeclImpl(ALabelDecl value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def decl with type ALabelDecl not implemented "); - } - - /** - * sets the label of the label statement - * @param label - */ - public void setDeclImpl(ALabelDecl label) { - throw new UnsupportedOperationException(get_class()+": Action setDecl not implemented "); - } - - /** - * sets the label of the label statement - * @param label - */ - public final void setDecl(ALabelDecl label) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setDecl", this, Optional.empty(), label); - } - this.setDeclImpl(label); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setDecl", this, Optional.empty(), label); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setDecl", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "decl": { - if(value instanceof ALabelDecl){ - this.defDeclImpl((ALabelDecl)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("decl"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - actions.add("void setDecl(labelDecl)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "labelStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum LabelStmtAttributes { - DECL("decl"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private LabelStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(LabelStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALiteral.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALiteral.java deleted file mode 100644 index ec18f41522..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALiteral.java +++ /dev/null @@ -1,1102 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ALiteral - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ALiteral extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public ALiteral(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "literal"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum LiteralAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private LiteralAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(LiteralAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALoop.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALoop.java deleted file mode 100644 index 17fd6d7065..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ALoop.java +++ /dev/null @@ -1,2238 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ALoop - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ALoop extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ALoop(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute body - * @return the attribute's value - */ - public abstract AScope getBodyImpl(); - - /** - * Get value on attribute body - * @return the attribute's value - */ - public final Object getBody() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "body", Optional.empty()); - } - AScope result = this.getBodyImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "body", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "body", e); - } - } - - /** - * - */ - public void defBodyImpl(AScope value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def body with type AScope not implemented "); - } - - /** - * The statement of the loop condition - */ - public abstract AStatement getCondImpl(); - - /** - * The statement of the loop condition - */ - public final Object getCond() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "cond", Optional.empty()); - } - AStatement result = this.getCondImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "cond", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "cond", e); - } - } - - /** - * Get value on attribute condRelation - * @return the attribute's value - */ - public abstract String getCondRelationImpl(); - - /** - * Get value on attribute condRelation - * @return the attribute's value - */ - public final Object getCondRelation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "condRelation", Optional.empty()); - } - String result = this.getCondRelationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "condRelation", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "condRelation", e); - } - } - - /** - * - */ - public void defCondRelationImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def condRelation with type String not implemented "); - } - - /** - * Get value on attribute controlVar - * @return the attribute's value - */ - public abstract String getControlVarImpl(); - - /** - * Get value on attribute controlVar - * @return the attribute's value - */ - public final Object getControlVar() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "controlVar", Optional.empty()); - } - String result = this.getControlVarImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "controlVar", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "controlVar", e); - } - } - - /** - * Get value on attribute controlVarref - * @return the attribute's value - */ - public abstract AVarref getControlVarrefImpl(); - - /** - * Get value on attribute controlVarref - * @return the attribute's value - */ - public final Object getControlVarref() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "controlVarref", Optional.empty()); - } - AVarref result = this.getControlVarrefImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "controlVarref", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "controlVarref", e); - } - } - - /** - * The expression of the last value of the control variable (e.g. 'length' in 'i < length;') - */ - public abstract String getEndValueImpl(); - - /** - * The expression of the last value of the control variable (e.g. 'length' in 'i < length;') - */ - public final Object getEndValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "endValue", Optional.empty()); - } - String result = this.getEndValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "endValue", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "endValue", e); - } - } - - /** - * True if the condition of the loop in the canonical format, and is one of: <, <=, >, >= - */ - public abstract Boolean getHasCondRelationImpl(); - - /** - * True if the condition of the loop in the canonical format, and is one of: <, <=, >, >= - */ - public final Object getHasCondRelation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasCondRelation", Optional.empty()); - } - Boolean result = this.getHasCondRelationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasCondRelation", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasCondRelation", e); - } - } - - /** - * Uniquely identifies the loop inside the program - */ - public abstract String getIdImpl(); - - /** - * Uniquely identifies the loop inside the program - */ - public final Object getId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "id", Optional.empty()); - } - String result = this.getIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "id", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "id", e); - } - } - - /** - * The statement of the loop initialization - */ - public abstract AStatement getInitImpl(); - - /** - * The statement of the loop initialization - */ - public final Object getInit() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "init", Optional.empty()); - } - AStatement result = this.getInitImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "init", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "init", e); - } - } - - /** - * - */ - public void defInitImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def init with type String not implemented "); - } - - /** - * The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;') - */ - public abstract String getInitValueImpl(); - - /** - * The expression of the first value of the control variable (e.g. '0' in 'size_t i = 0;') - */ - public final Object getInitValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "initValue", Optional.empty()); - } - String result = this.getInitValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "initValue", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "initValue", e); - } - } - - /** - * - */ - public void defInitValueImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def initValue with type String not implemented "); - } - - /** - * Get value on attribute isInnermost - * @return the attribute's value - */ - public abstract Boolean getIsInnermostImpl(); - - /** - * Get value on attribute isInnermost - * @return the attribute's value - */ - public final Object getIsInnermost() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInnermost", Optional.empty()); - } - Boolean result = this.getIsInnermostImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInnermost", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInnermost", e); - } - } - - /** - * - * @param otherLoop - * @return - */ - public abstract Boolean isInterchangeableImpl(ALoop otherLoop); - - /** - * - * @param otherLoop - * @return - */ - public final Object isInterchangeable(ALoop otherLoop) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isInterchangeable", Optional.empty(), otherLoop); - } - Boolean result = this.isInterchangeableImpl(otherLoop); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isInterchangeable", Optional.ofNullable(result), otherLoop); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isInterchangeable", e); - } - } - - /** - * Get value on attribute isOutermost - * @return the attribute's value - */ - public abstract Boolean getIsOutermostImpl(); - - /** - * Get value on attribute isOutermost - * @return the attribute's value - */ - public final Object getIsOutermost() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isOutermost", Optional.empty()); - } - Boolean result = this.getIsOutermostImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isOutermost", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isOutermost", e); - } - } - - /** - * Get value on attribute isParallel - * @return the attribute's value - */ - public abstract Boolean getIsParallelImpl(); - - /** - * Get value on attribute isParallel - * @return the attribute's value - */ - public final Object getIsParallel() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isParallel", Optional.empty()); - } - Boolean result = this.getIsParallelImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isParallel", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isParallel", e); - } - } - - /** - * - */ - public void defIsParallelImpl(Boolean value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def isParallel with type Boolean not implemented "); - } - - /** - * - */ - public void defIsParallelImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def isParallel with type String not implemented "); - } - - /** - * Get value on attribute iterations - * @return the attribute's value - */ - public abstract Integer getIterationsImpl(); - - /** - * Get value on attribute iterations - * @return the attribute's value - */ - public final Object getIterations() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "iterations", Optional.empty()); - } - Integer result = this.getIterationsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "iterations", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "iterations", e); - } - } - - /** - * Get value on attribute iterationsExpr - * @return the attribute's value - */ - public abstract AExpression getIterationsExprImpl(); - - /** - * Get value on attribute iterationsExpr - * @return the attribute's value - */ - public final Object getIterationsExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "iterationsExpr", Optional.empty()); - } - AExpression result = this.getIterationsExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "iterationsExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "iterationsExpr", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute nestedLevel - * @return the attribute's value - */ - public abstract Integer getNestedLevelImpl(); - - /** - * Get value on attribute nestedLevel - * @return the attribute's value - */ - public final Object getNestedLevel() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "nestedLevel", Optional.empty()); - } - Integer result = this.getNestedLevelImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "nestedLevel", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "nestedLevel", e); - } - } - - /** - * Get value on attribute rank - * @return the attribute's value - */ - public abstract int[] getRankArrayImpl(); - - /** - * Get value on attribute rank - * @return the attribute's value - */ - public Object getRankImpl() { - int[] intArrayImpl0 = getRankArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(intArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute rank - * @return the attribute's value - */ - public final Object getRank() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "rank", Optional.empty()); - } - Object result = this.getRankImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "rank", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "rank", e); - } - } - - /** - * The statement of the loop step - */ - public abstract AStatement getStepImpl(); - - /** - * The statement of the loop step - */ - public final Object getStep() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "step", Optional.empty()); - } - AStatement result = this.getStepImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "step", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "step", e); - } - } - - /** - * The expression of the iteration step - */ - public abstract String getStepValueImpl(); - - /** - * The expression of the iteration step - */ - public final Object getStepValue() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "stepValue", Optional.empty()); - } - String result = this.getStepValueImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "stepValue", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "stepValue", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select inits - * @return - */ - public List selectInit() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select conds - * @return - */ - public List selectCond() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select steps - * @return - */ - public List selectStep() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select bodys - * @return - */ - public List selectBody() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * Interchanges two for loops, if possible - * @param otherLoop - */ - public void interchangeImpl(ALoop otherLoop) { - throw new UnsupportedOperationException(get_class()+": Action interchange not implemented "); - } - - /** - * Interchanges two for loops, if possible - * @param otherLoop - */ - public final void interchange(ALoop otherLoop) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "interchange", this, Optional.empty(), otherLoop); - } - this.interchangeImpl(otherLoop); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "interchange", this, Optional.empty(), otherLoop); - } - } catch(Exception e) { - throw new ActionException(get_class(), "interchange", e); - } - } - - /** - * Sets the body of the loop - * @param body - */ - public void setBodyImpl(AScope body) { - throw new UnsupportedOperationException(get_class()+": Action setBody not implemented "); - } - - /** - * Sets the body of the loop - * @param body - */ - public final void setBody(AScope body) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setBody", this, Optional.empty(), body); - } - this.setBodyImpl(body); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setBody", this, Optional.empty(), body); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setBody", e); - } - } - - /** - * Sets the conditional statement of the loop. Works with loops of kind 'for' - * @param condCode - */ - public void setCondImpl(String condCode) { - throw new UnsupportedOperationException(get_class()+": Action setCond not implemented "); - } - - /** - * Sets the conditional statement of the loop. Works with loops of kind 'for' - * @param condCode - */ - public final void setCond(String condCode) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCond", this, Optional.empty(), condCode); - } - this.setCondImpl(condCode); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCond", this, Optional.empty(), condCode); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCond", e); - } - } - - /** - * Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge - * @param operator - */ - public void setCondRelationImpl(String operator) { - throw new UnsupportedOperationException(get_class()+": Action setCondRelation not implemented "); - } - - /** - * Changes the operator of a canonical condition, if possible. Supported operators: lt, le, gt, ge - * @param operator - */ - public final void setCondRelation(String operator) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCondRelation", this, Optional.empty(), operator); - } - this.setCondRelationImpl(operator); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCondRelation", this, Optional.empty(), operator); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCondRelation", e); - } - } - - /** - * Sets the end value of the loop. Works with loops of kind 'for' - * @param initCode - */ - public void setEndValueImpl(String initCode) { - throw new UnsupportedOperationException(get_class()+": Action setEndValue not implemented "); - } - - /** - * Sets the end value of the loop. Works with loops of kind 'for' - * @param initCode - */ - public final void setEndValue(String initCode) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setEndValue", this, Optional.empty(), initCode); - } - this.setEndValueImpl(initCode); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setEndValue", this, Optional.empty(), initCode); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setEndValue", e); - } - } - - /** - * Sets the init statement of the loop - * @param initCode - */ - public void setInitImpl(String initCode) { - throw new UnsupportedOperationException(get_class()+": Action setInit not implemented "); - } - - /** - * Sets the init statement of the loop - * @param initCode - */ - public final void setInit(String initCode) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInit", this, Optional.empty(), initCode); - } - this.setInitImpl(initCode); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInit", this, Optional.empty(), initCode); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInit", e); - } - } - - /** - * Sets the init value of the loop. Works with loops of kind 'for' - * @param initCode - */ - public void setInitValueImpl(String initCode) { - throw new UnsupportedOperationException(get_class()+": Action setInitValue not implemented "); - } - - /** - * Sets the init value of the loop. Works with loops of kind 'for' - * @param initCode - */ - public final void setInitValue(String initCode) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInitValue", this, Optional.empty(), initCode); - } - this.setInitValueImpl(initCode); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInitValue", this, Optional.empty(), initCode); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInitValue", e); - } - } - - /** - * Sets the attribute 'isParallel' of the loop - * @param isParallel - */ - public void setIsParallelImpl(Boolean isParallel) { - throw new UnsupportedOperationException(get_class()+": Action setIsParallel not implemented "); - } - - /** - * Sets the attribute 'isParallel' of the loop - * @param isParallel - */ - public final void setIsParallel(Boolean isParallel) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setIsParallel", this, Optional.empty(), isParallel); - } - this.setIsParallelImpl(isParallel); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setIsParallel", this, Optional.empty(), isParallel); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setIsParallel", e); - } - } - - /** - * Sets the kind of the loop - * @param kind - */ - public void setKindImpl(String kind) { - throw new UnsupportedOperationException(get_class()+": Action setKind not implemented "); - } - - /** - * Sets the kind of the loop - * @param kind - */ - public final void setKind(String kind) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setKind", this, Optional.empty(), kind); - } - this.setKindImpl(kind); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setKind", this, Optional.empty(), kind); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setKind", e); - } - } - - /** - * Sets the step statement of the loop. Works with loops of kind 'for' - * @param stepCode - */ - public void setStepImpl(String stepCode) { - throw new UnsupportedOperationException(get_class()+": Action setStep not implemented "); - } - - /** - * Sets the step statement of the loop. Works with loops of kind 'for' - * @param stepCode - */ - public final void setStep(String stepCode) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setStep", this, Optional.empty(), stepCode); - } - this.setStepImpl(stepCode); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setStep", this, Optional.empty(), stepCode); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setStep", e); - } - } - - /** - * Applies loop tiling to this loop. - * @param blockSize - * @param reference - * @param useTernary - */ - public AStatement tileImpl(String blockSize, AStatement reference, Boolean useTernary) { - throw new UnsupportedOperationException(get_class()+": Action tile not implemented "); - } - - /** - * Applies loop tiling to this loop. - * @param blockSize - * @param reference - * @param useTernary - */ - public final Object tile(String blockSize, AStatement reference, Boolean useTernary) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "tile", this, Optional.empty(), blockSize, reference, useTernary); - } - AStatement result = this.tileImpl(blockSize, reference, useTernary); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "tile", this, Optional.ofNullable(result), blockSize, reference, useTernary); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "tile", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "init": - joinPointList = selectInit(); - break; - case "cond": - joinPointList = selectCond(); - break; - case "step": - joinPointList = selectStep(); - break; - case "body": - joinPointList = selectBody(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "body": { - if(value instanceof AScope){ - this.defBodyImpl((AScope)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "condRelation": { - if(value instanceof String){ - this.defCondRelationImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "init": { - if(value instanceof String){ - this.defInitImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "initValue": { - if(value instanceof String){ - this.defInitValueImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "isParallel": { - if(value instanceof Boolean){ - this.defIsParallelImpl((Boolean)value); - return; - } - if(value instanceof String){ - this.defIsParallelImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("body"); - attributes.add("cond"); - attributes.add("condRelation"); - attributes.add("controlVar"); - attributes.add("controlVarref"); - attributes.add("endValue"); - attributes.add("hasCondRelation"); - attributes.add("id"); - attributes.add("init"); - attributes.add("initValue"); - attributes.add("isInnermost"); - attributes.add("isInterchangeable"); - attributes.add("isOutermost"); - attributes.add("isParallel"); - attributes.add("iterations"); - attributes.add("iterationsExpr"); - attributes.add("kind"); - attributes.add("nestedLevel"); - attributes.add("rank"); - attributes.add("step"); - attributes.add("stepValue"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - selects.add("init"); - selects.add("cond"); - selects.add("step"); - selects.add("body"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - actions.add("void interchange(loop)"); - actions.add("void setBody(scope)"); - actions.add("void setCond(String)"); - actions.add("void setCondRelation(Relation)"); - actions.add("void setEndValue(String)"); - actions.add("void setInit(String)"); - actions.add("void setInitValue(String)"); - actions.add("void setIsParallel(Boolean)"); - actions.add("void setKind(String)"); - actions.add("void setStep(String)"); - actions.add("statement tile(String, statement, Boolean)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "loop"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum LoopAttributes { - BODY("body"), - COND("cond"), - CONDRELATION("condRelation"), - CONTROLVAR("controlVar"), - CONTROLVARREF("controlVarref"), - ENDVALUE("endValue"), - HASCONDRELATION("hasCondRelation"), - ID("id"), - INIT("init"), - INITVALUE("initValue"), - ISINNERMOST("isInnermost"), - ISINTERCHANGEABLE("isInterchangeable"), - ISOUTERMOST("isOutermost"), - ISPARALLEL("isParallel"), - ITERATIONS("iterations"), - ITERATIONSEXPR("iterationsExpr"), - KIND("kind"), - NESTEDLEVEL("nestedLevel"), - RANK("rank"), - STEP("step"), - STEPVALUE("stepValue"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private LoopAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(LoopAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMarker.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMarker.java deleted file mode 100644 index 6e8176b267..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMarker.java +++ /dev/null @@ -1,1177 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AMarker - * This class is overwritten by the Weaver Generator. - * - * Special pragma that can be used to mark scopes (e.g., #pragma lara marker loop1) - * @author Lara Weaver Generator - */ -public abstract class AMarker extends APragma { - - protected APragma aPragma; - - /** - * - */ - public AMarker(APragma aPragma){ - this.aPragma = aPragma; - } - /** - * A scope, associated with this marker - */ - public abstract AJoinPoint getContentsImpl(); - - /** - * A scope, associated with this marker - */ - public final Object getContents() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "contents", Optional.empty()); - } - AJoinPoint result = this.getContentsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "contents", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "contents", e); - } - } - - /** - * Get value on attribute id - * @return the attribute's value - */ - public abstract String getIdImpl(); - - /** - * Get value on attribute id - * @return the attribute's value - */ - public final Object getId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "id", Optional.empty()); - } - String result = this.getIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "id", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "id", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select contentss - * @return - */ - public List selectContents() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute content - * @return the attribute's value - */ - @Override - public String getContentImpl() { - return this.aPragma.getContentImpl(); - } - - /** - * Get value on attribute getTargetNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getTargetNodesArrayImpl(String endPragma) { - return this.aPragma.getTargetNodesArrayImpl(endPragma); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aPragma.getNameImpl(); - } - - /** - * Get value on attribute target - * @return the attribute's value - */ - @Override - public AJoinPoint getTargetImpl() { - return this.aPragma.getTargetImpl(); - } - - /** - * Method used by the lara interpreter to select targets - * @return - */ - @Override - public List selectTarget() { - return this.aPragma.selectTarget(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aPragma.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aPragma.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aPragma.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aPragma.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aPragma.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aPragma.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aPragma.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aPragma.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aPragma.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aPragma.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aPragma.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aPragma.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aPragma.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aPragma.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aPragma.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aPragma.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aPragma.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aPragma.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aPragma.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aPragma.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aPragma.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aPragma.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aPragma.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aPragma.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aPragma.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aPragma.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aPragma.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aPragma.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aPragma.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aPragma.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aPragma.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aPragma.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aPragma.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aPragma.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aPragma.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aPragma.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aPragma.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aPragma.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aPragma.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aPragma.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aPragma.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aPragma.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aPragma.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aPragma.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aPragma.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aPragma.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aPragma.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aPragma.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aPragma.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aPragma.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aPragma.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aPragma.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aPragma.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aPragma.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aPragma.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aPragma.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aPragma.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aPragma.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aPragma.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aPragma.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aPragma.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aPragma.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aPragma.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aPragma.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aPragma.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aPragma.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aPragma.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aPragma.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aPragma.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aPragma.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aPragma.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aPragma.replaceWithStringsImpl(node); - } - - /** - * - * @param content - */ - @Override - public void setContentImpl(String content) { - this.aPragma.setContentImpl(content); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aPragma.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aPragma.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aPragma.setLastChildImpl(node); - } - - /** - * - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aPragma.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aPragma.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aPragma.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aPragma.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aPragma.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aPragma.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aPragma); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "contents": - joinPointList = selectContents(); - break; - case "target": - joinPointList = selectTarget(); - break; - default: - joinPointList = this.aPragma.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aPragma.fillWithAttributes(attributes); - attributes.add("contents"); - attributes.add("id"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aPragma.fillWithSelects(selects); - selects.add("contents"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aPragma.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "marker"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aPragma.instanceOf(joinpointClass); - } - /** - * - */ - protected enum MarkerAttributes { - CONTENTS("contents"), - ID("id"), - CONTENT("content"), - GETTARGETNODES("getTargetNodes"), - NAME("name"), - TARGET("target"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private MarkerAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(MarkerAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberAccess.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberAccess.java deleted file mode 100644 index 75f95b9602..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberAccess.java +++ /dev/null @@ -1,1297 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AMemberAccess - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AMemberAccess extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AMemberAccess(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * true if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar) - */ - public abstract Boolean getArrowImpl(); - - /** - * true if this is a member access that uses arrow (i.e., foo->bar), false if uses dot (i.e., foo.bar) - */ - public final Object getArrow() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "arrow", Optional.empty()); - } - Boolean result = this.getArrowImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "arrow", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "arrow", e); - } - } - - /** - * - */ - public void defArrowImpl(Boolean value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def arrow with type Boolean not implemented "); - } - - /** - * expression of the base of this member access - */ - public abstract AExpression getBaseImpl(); - - /** - * expression of the base of this member access - */ - public final Object getBase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "base", Optional.empty()); - } - AExpression result = this.getBaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "base", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "base", e); - } - } - - /** - * Get value on attribute memberChain - * @return the attribute's value - */ - public abstract AExpression[] getMemberChainArrayImpl(); - - /** - * Get value on attribute memberChain - * @return the attribute's value - */ - public Object getMemberChainImpl() { - AExpression[] aExpressionArrayImpl0 = getMemberChainArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aExpressionArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute memberChain - * @return the attribute's value - */ - public final Object getMemberChain() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "memberChain", Optional.empty()); - } - Object result = this.getMemberChainImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "memberChain", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "memberChain", e); - } - } - - /** - * Get value on attribute memberChainNames - * @return the attribute's value - */ - public abstract String[] getMemberChainNamesArrayImpl(); - - /** - * Get value on attribute memberChainNames - * @return the attribute's value - */ - public Object getMemberChainNamesImpl() { - String[] stringArrayImpl0 = getMemberChainNamesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute memberChainNames - * @return the attribute's value - */ - public final Object getMemberChainNames() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "memberChainNames", Optional.empty()); - } - Object result = this.getMemberChainNamesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "memberChainNames", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "memberChainNames", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * - * @param isArrow - */ - public void setArrowImpl(Boolean isArrow) { - throw new UnsupportedOperationException(get_class()+": Action setArrow not implemented "); - } - - /** - * - * @param isArrow - */ - public final void setArrow(Boolean isArrow) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setArrow", this, Optional.empty(), isArrow); - } - this.setArrowImpl(isArrow); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setArrow", this, Optional.empty(), isArrow); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setArrow", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "arrow": { - if(value instanceof Boolean){ - this.defArrowImpl((Boolean)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("arrow"); - attributes.add("base"); - attributes.add("memberChain"); - attributes.add("memberChainNames"); - attributes.add("name"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - actions.add("void setArrow(Boolean)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "memberAccess"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum MemberAccessAttributes { - ARROW("arrow"), - BASE("base"), - MEMBERCHAIN("memberChain"), - MEMBERCHAINNAMES("memberChainNames"), - NAME("name"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private MemberAccessAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(MemberAccessAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberCall.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberCall.java deleted file mode 100644 index a604d29424..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMemberCall.java +++ /dev/null @@ -1,1423 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AMemberCall - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AMemberCall extends ACall { - - protected ACall aCall; - - /** - * - */ - public AMemberCall(ACall aCall){ - super(aCall); - this.aCall = aCall; - } - /** - * Get value on attribute base - * @return the attribute's value - */ - public abstract AExpression getBaseImpl(); - - /** - * Get value on attribute base - * @return the attribute's value - */ - public final Object getBase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "base", Optional.empty()); - } - AExpression result = this.getBaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "base", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "base", e); - } - } - - /** - * Get value on attribute rootBase - * @return the attribute's value - */ - public abstract AExpression getRootBaseImpl(); - - /** - * Get value on attribute rootBase - * @return the attribute's value - */ - public final Object getRootBase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "rootBase", Optional.empty()); - } - AExpression result = this.getRootBaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "rootBase", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "rootBase", e); - } - } - - /** - * Get value on attribute argListArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgListArrayImpl() { - return this.aCall.getArgListArrayImpl(); - } - - /** - * Get value on attribute argsArrayImpl - * @return the attribute's value - */ - @Override - public AExpression[] getArgsArrayImpl() { - return this.aCall.getArgsArrayImpl(); - } - - /** - * Get value on attribute declaration - * @return the attribute's value - */ - @Override - public AFunction getDeclarationImpl() { - return this.aCall.getDeclarationImpl(); - } - - /** - * Get value on attribute definition - * @return the attribute's value - */ - @Override - public AFunction getDefinitionImpl() { - return this.aCall.getDefinitionImpl(); - } - - /** - * Get value on attribute directCallee - * @return the attribute's value - */ - @Override - public AFunction getDirectCalleeImpl() { - return this.aCall.getDirectCalleeImpl(); - } - - /** - * Get value on attribute function - * @return the attribute's value - */ - @Override - public AFunction getFunctionImpl() { - return this.aCall.getFunctionImpl(); - } - - /** - * Get value on attribute functionType - * @return the attribute's value - */ - @Override - public AFunctionType getFunctionTypeImpl() { - return this.aCall.getFunctionTypeImpl(); - } - - /** - * Get value on attribute getArg - * @return the attribute's value - */ - @Override - public AExpression getArgImpl(int index) { - return this.aCall.getArgImpl(index); - } - - /** - * Get value on attribute isMemberAccess - * @return the attribute's value - */ - @Override - public Boolean getIsMemberAccessImpl() { - return this.aCall.getIsMemberAccessImpl(); - } - - /** - * Get value on attribute isStmtCall - * @return the attribute's value - */ - @Override - public Boolean getIsStmtCallImpl() { - return this.aCall.getIsStmtCallImpl(); - } - - /** - * Get value on attribute memberAccess - * @return the attribute's value - */ - @Override - public AMemberAccess getMemberAccessImpl() { - return this.aCall.getMemberAccessImpl(); - } - - /** - * Get value on attribute memberNamesArrayImpl - * @return the attribute's value - */ - @Override - public String[] getMemberNamesArrayImpl() { - return this.aCall.getMemberNamesArrayImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aCall.getNameImpl(); - } - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - @Override - public Integer getNumArgsImpl() { - return this.aCall.getNumArgsImpl(); - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - @Override - public AType getReturnTypeImpl() { - return this.aCall.getReturnTypeImpl(); - } - - /** - * Get value on attribute signature - * @return the attribute's value - */ - @Override - public String getSignatureImpl() { - return this.aCall.getSignatureImpl(); - } - - /** - * Method used by the lara interpreter to select callees - * @return - */ - @Override - public List selectCallee() { - return this.aCall.selectCallee(); - } - - /** - * Method used by the lara interpreter to select args - * @return - */ - @Override - public List selectArg() { - return this.aCall.selectArg(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aCall.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aCall.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aCall.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aCall.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aCall.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aCall.selectVardecl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aCall.defNameImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aCall.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aCall.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aCall.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aCall.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aCall.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aCall.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aCall.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aCall.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aCall.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aCall.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aCall.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aCall.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aCall.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aCall.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aCall.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aCall.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aCall.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aCall.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aCall.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aCall.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aCall.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aCall.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aCall.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aCall.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aCall.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aCall.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aCall.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aCall.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aCall.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aCall.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aCall.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aCall.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aCall.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aCall.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aCall.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aCall.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aCall.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aCall.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aCall.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aCall.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aCall.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aCall.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aCall.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aCall.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aCall.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aCall.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aCall.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aCall.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aCall.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aCall.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aCall.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aCall.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aCall.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aCall.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aCall.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aCall.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aCall.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aCall.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aCall.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aCall.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aCall.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aCall.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aCall.getTypeImpl(); - } - - /** - * Adds an argument at the end of the call, creating an expression using the given code and type. If a type is not provided, a dummy type is used - * @param argCode - * @param type - */ - @Override - public void addArgImpl(String argCode, AType type) { - this.aCall.addArgImpl(argCode, type); - } - - /** - * Adds an argument at the end of the call, creating a literal 'type' from the type string - * @param arg - * @param type - */ - @Override - public void addArgImpl(String arg, String type) { - this.aCall.addArgImpl(arg, type); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aCall.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aCall.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aCall.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aCall.detachImpl(); - } - - /** - * Tries to inline this call - */ - @Override - public boolean inlineImpl() { - return this.aCall.inlineImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aCall.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aCall.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aCall.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aCall.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aCall.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aCall.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aCall.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aCall.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aCall.replaceWithStringsImpl(node); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgImpl(int index, AExpression expr) { - this.aCall.setArgImpl(index, expr); - } - - /** - * - * @param index - * @param expr - */ - @Override - public void setArgFromStringImpl(int index, String expr) { - this.aCall.setArgFromStringImpl(index, expr); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aCall.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aCall.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aCall.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aCall.setLastChildImpl(node); - } - - /** - * Changes the name of the call - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aCall.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aCall.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aCall.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aCall.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aCall.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aCall.toCommentImpl(prefix, suffix); - } - - /** - * Wraps this call with a possibly new wrapping function - * @param name - */ - @Override - public void wrapImpl(String name) { - this.aCall.wrapImpl(name); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aCall); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "callee": - joinPointList = selectCallee(); - break; - case "arg": - joinPointList = selectArg(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aCall.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aCall.fillWithAttributes(attributes); - attributes.add("base"); - attributes.add("rootBase"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aCall.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aCall.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "memberCall"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aCall.instanceOf(joinpointClass); - } - /** - * - */ - protected enum MemberCallAttributes { - BASE("base"), - ROOTBASE("rootBase"), - ARGLIST("argList"), - ARGS("args"), - DECLARATION("declaration"), - DEFINITION("definition"), - DIRECTCALLEE("directCallee"), - FUNCTION("function"), - FUNCTIONTYPE("functionType"), - GETARG("getArg"), - ISMEMBERACCESS("isMemberAccess"), - ISSTMTCALL("isStmtCall"), - MEMBERACCESS("memberAccess"), - MEMBERNAMES("memberNames"), - NAME("name"), - NUMARGS("numArgs"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private MemberCallAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(MemberCallAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMethod.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMethod.java deleted file mode 100644 index b2a2677e61..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AMethod.java +++ /dev/null @@ -1,1719 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AMethod - * This class is overwritten by the Weaver Generator. - * - * Represents a C++ class method declaration or definition - * @author Lara Weaver Generator - */ -public abstract class AMethod extends AFunction { - - protected AFunction aFunction; - - /** - * - */ - public AMethod(AFunction aFunction){ - super(aFunction); - this.aFunction = aFunction; - } - /** - * Get value on attribute record - * @return the attribute's value - */ - public abstract AClass getRecordImpl(); - - /** - * Get value on attribute record - * @return the attribute's value - */ - public final Object getRecord() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "record", Optional.empty()); - } - AClass result = this.getRecordImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "record", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "record", e); - } - } - - /** - * Removes the of the method - */ - public void removeRecordImpl() { - throw new UnsupportedOperationException(get_class()+": Action removeRecord not implemented "); - } - - /** - * Removes the of the method - */ - public final void removeRecord() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "removeRecord", this, Optional.empty()); - } - this.removeRecordImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "removeRecord", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "removeRecord", e); - } - } - - /** - * Get value on attribute body - * @return the attribute's value - */ - @Override - public AScope getBodyImpl() { - return this.aFunction.getBodyImpl(); - } - - /** - * Get value on attribute callsArrayImpl - * @return the attribute's value - */ - @Override - public ACall[] getCallsArrayImpl() { - return this.aFunction.getCallsArrayImpl(); - } - - /** - * Get value on attribute canonical - * @return the attribute's value - */ - @Override - public AFunction getCanonicalImpl() { - return this.aFunction.getCanonicalImpl(); - } - - /** - * Get value on attribute declarationJp - * @return the attribute's value - */ - @Override - public AFunction getDeclarationJpImpl() { - return this.aFunction.getDeclarationJpImpl(); - } - - /** - * Get value on attribute declarationJpsArrayImpl - * @return the attribute's value - */ - @Override - public AFunction[] getDeclarationJpsArrayImpl() { - return this.aFunction.getDeclarationJpsArrayImpl(); - } - - /** - * Get value on attribute definitionJp - * @return the attribute's value - */ - @Override - public AFunction getDefinitionJpImpl() { - return this.aFunction.getDefinitionJpImpl(); - } - - /** - * Get value on attribute functionType - * @return the attribute's value - */ - @Override - public AFunctionType getFunctionTypeImpl() { - return this.aFunction.getFunctionTypeImpl(); - } - - /** - * Get value on attribute getDeclaration - * @return the attribute's value - */ - @Override - public String getDeclarationImpl(Boolean withReturnType) { - return this.aFunction.getDeclarationImpl(withReturnType); - } - - /** - * Get value on attribute hasDefinition - * @return the attribute's value - */ - @Override - public Boolean getHasDefinitionImpl() { - return this.aFunction.getHasDefinitionImpl(); - } - - /** - * Get value on attribute id - * @return the attribute's value - */ - @Override - public String getIdImpl() { - return this.aFunction.getIdImpl(); - } - - /** - * Get value on attribute isCanonical - * @return the attribute's value - */ - @Override - public Boolean getIsCanonicalImpl() { - return this.aFunction.getIsCanonicalImpl(); - } - - /** - * Get value on attribute isCudaKernel - * @return the attribute's value - */ - @Override - public Boolean getIsCudaKernelImpl() { - return this.aFunction.getIsCudaKernelImpl(); - } - - /** - * Get value on attribute isDelete - * @return the attribute's value - */ - @Override - public Boolean getIsDeleteImpl() { - return this.aFunction.getIsDeleteImpl(); - } - - /** - * Get value on attribute isImplementation - * @return the attribute's value - */ - @Override - public Boolean getIsImplementationImpl() { - return this.aFunction.getIsImplementationImpl(); - } - - /** - * Get value on attribute isInline - * @return the attribute's value - */ - @Override - public Boolean getIsInlineImpl() { - return this.aFunction.getIsInlineImpl(); - } - - /** - * Get value on attribute isModulePrivate - * @return the attribute's value - */ - @Override - public Boolean getIsModulePrivateImpl() { - return this.aFunction.getIsModulePrivateImpl(); - } - - /** - * Get value on attribute isPrototype - * @return the attribute's value - */ - @Override - public Boolean getIsPrototypeImpl() { - return this.aFunction.getIsPrototypeImpl(); - } - - /** - * Get value on attribute isPure - * @return the attribute's value - */ - @Override - public Boolean getIsPureImpl() { - return this.aFunction.getIsPureImpl(); - } - - /** - * Get value on attribute isVirtual - * @return the attribute's value - */ - @Override - public Boolean getIsVirtualImpl() { - return this.aFunction.getIsVirtualImpl(); - } - - /** - * Get value on attribute paramNamesArrayImpl - * @return the attribute's value - */ - @Override - public String[] getParamNamesArrayImpl() { - return this.aFunction.getParamNamesArrayImpl(); - } - - /** - * Get value on attribute paramsArrayImpl - * @return the attribute's value - */ - @Override - public AParam[] getParamsArrayImpl() { - return this.aFunction.getParamsArrayImpl(); - } - - /** - * Get value on attribute returnType - * @return the attribute's value - */ - @Override - public AType getReturnTypeImpl() { - return this.aFunction.getReturnTypeImpl(); - } - - /** - * Get value on attribute signature - * @return the attribute's value - */ - @Override - public String getSignatureImpl() { - return this.aFunction.getSignatureImpl(); - } - - /** - * Get value on attribute storageClass - * @return the attribute's value - */ - @Override - public String getStorageClassImpl() { - return this.aFunction.getStorageClassImpl(); - } - - /** - * Method used by the lara interpreter to select bodys - * @return - */ - @Override - public List selectBody() { - return this.aFunction.selectBody(); - } - - /** - * Method used by the lara interpreter to select params - * @return - */ - @Override - public List selectParam() { - return this.aFunction.selectParam(); - } - - /** - * Method used by the lara interpreter to select decls - * @return - */ - @Override - public List selectDecl() { - return this.aFunction.selectDecl(); - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aFunction.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aFunction.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aFunction.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aFunction.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aFunction.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aFunction.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aFunction.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aFunction.defQualifiedPrefixImpl(value); - } - - /** - * - */ - public void defBodyImpl(AScope value) { - this.aFunction.defBodyImpl(value); - } - - /** - * - */ - public void defFunctionTypeImpl(AFunctionType value) { - this.aFunction.defFunctionTypeImpl(value); - } - - /** - * - */ - public void defParamsImpl(AParam[] value) { - this.aFunction.defParamsImpl(value); - } - - /** - * - */ - public void defParamsImpl(String[] value) { - this.aFunction.defParamsImpl(value); - } - - /** - * - */ - public void defReturnTypeImpl(AType value) { - this.aFunction.defReturnTypeImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aFunction.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aFunction.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aFunction.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aFunction.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aFunction.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aFunction.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aFunction.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aFunction.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aFunction.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aFunction.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aFunction.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aFunction.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aFunction.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aFunction.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aFunction.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aFunction.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aFunction.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aFunction.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aFunction.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aFunction.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aFunction.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aFunction.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aFunction.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aFunction.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aFunction.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aFunction.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aFunction.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aFunction.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aFunction.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aFunction.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aFunction.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aFunction.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aFunction.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aFunction.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aFunction.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aFunction.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aFunction.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aFunction.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aFunction.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aFunction.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aFunction.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aFunction.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aFunction.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aFunction.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aFunction.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aFunction.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aFunction.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aFunction.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aFunction.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aFunction.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aFunction.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aFunction.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aFunction.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aFunction.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aFunction.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aFunction.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aFunction.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aFunction.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aFunction.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aFunction.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aFunction.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aFunction.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aFunction.getTypeImpl(); - } - - /** - * Adds a new parameter to the function - * @param param - */ - @Override - public void addParamImpl(AParam param) { - this.aFunction.addParamImpl(param); - } - - /** - * Adds a new parameter to the function - * @param name - * @param type - */ - @Override - public void addParamImpl(String name, AType type) { - this.aFunction.addParamImpl(name, type); - } - - /** - * Clones this function assigning it a new name, inserts the cloned function after the original function. If the name is the same and the original method, automatically removes the cloned method from the class - * @param newName - * @param insert - */ - @Override - public AFunction cloneImpl(String newName, Boolean insert) { - return this.aFunction.cloneImpl(newName, insert); - } - - /** - * Generates a clone of the provided function on a new file with the provided name (or with a weaver-generated name if one is not provided). - * @param newName - * @param fileName - */ - @Override - public AFunction cloneOnFileImpl(String newName, String fileName) { - return this.aFunction.cloneOnFileImpl(newName, fileName); - } - - /** - * Generates a clone of the provided function on a new file (with the provided join point). - * @param newName - * @param fileName - */ - @Override - public AFunction cloneOnFileImpl(String newName, AFile fileName) { - return this.aFunction.cloneOnFileImpl(newName, fileName); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aFunction.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aFunction.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aFunction.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aFunction.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aFunction.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aFunction.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aFunction.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aFunction.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aFunction.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aFunction.insertBeforeImpl(node); - } - - /** - * Inserts the joinpoint before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - @Override - public AJoinPoint insertReturnImpl(AJoinPoint code) { - return this.aFunction.insertReturnImpl(code); - } - - /** - * Inserts code as a literal statement before the return points of the function (return statements and implicitly, at the end of the function). Returns the last inserted node - * @param code - */ - @Override - public AJoinPoint insertReturnImpl(String code) { - return this.aFunction.insertReturnImpl(code); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aFunction.messageToUserImpl(message); - } - - /** - * Creates a new call to this function - * @param args - */ - @Override - public ACall newCallImpl(AJoinPoint[] args) { - return this.aFunction.newCallImpl(args); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aFunction.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aFunction.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aFunction.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aFunction.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aFunction.replaceWithStringsImpl(node); - } - - /** - * Sets the body of the function - * @param body - */ - @Override - public void setBodyImpl(AScope body) { - this.aFunction.setBodyImpl(body); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aFunction.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aFunction.setFirstChildImpl(node); - } - - /** - * Sets the type of the function - * @param functionType - */ - @Override - public void setFunctionTypeImpl(AFunctionType functionType) { - this.aFunction.setFunctionTypeImpl(functionType); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aFunction.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aFunction.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aFunction.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aFunction.setNameImpl(name); - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param param - */ - @Override - public void setParamImpl(int index, AParam param) { - this.aFunction.setParamImpl(index, param); - } - - /** - * Sets the parameter of the function at the given position - * @param index - * @param name - * @param type - */ - @Override - public void setParamImpl(int index, String name, AType type) { - this.aFunction.setParamImpl(index, name, type); - } - - /** - * Sets the type of a parameter of the function - * @param index - * @param newType - */ - @Override - public void setParamTypeImpl(int index, AType newType) { - this.aFunction.setParamTypeImpl(index, newType); - } - - /** - * Sets the parameters of the function - * @param params - */ - @Override - public void setParamsImpl(AParam[] params) { - this.aFunction.setParamsImpl(params); - } - - /** - * Overload that accepts strings that represent type-varname pairs (e.g., int param1) - * @param params - */ - @Override - public void setParamsFromStringsImpl(String[] params) { - this.aFunction.setParamsFromStringsImpl(params); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aFunction.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aFunction.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the return type of the function - * @param returnType - */ - @Override - public void setReturnTypeImpl(AType returnType) { - this.aFunction.setReturnTypeImpl(returnType); - } - - /** - * Sets the storage class of this specific function decl. AUTO and REGISTER are not allowed for functions, and EXTERN is not allowed in function implementations, or function declarations that are in the same file as the implementation. Returns true if the storage class changed, false otherwise. - * @param storageClass - */ - @Override - public boolean setStorageClassImpl(String storageClass) { - return this.aFunction.setStorageClassImpl(storageClass); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aFunction.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aFunction.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aFunction.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aFunction.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aFunction.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aFunction); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "body": - joinPointList = selectBody(); - break; - case "param": - joinPointList = selectParam(); - break; - case "decl": - joinPointList = selectDecl(); - break; - default: - joinPointList = this.aFunction.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "body": { - if(value instanceof AScope){ - this.defBodyImpl((AScope)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "functionType": { - if(value instanceof AFunctionType){ - this.defFunctionTypeImpl((AFunctionType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "params": { - if(value instanceof AParam[]){ - this.defParamsImpl((AParam[])value); - return; - } - if(value instanceof String[]){ - this.defParamsImpl((String[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "returnType": { - if(value instanceof AType){ - this.defReturnTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aFunction.fillWithAttributes(attributes); - attributes.add("record"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aFunction.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aFunction.fillWithActions(actions); - actions.add("void removeRecord()"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "method"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aFunction.instanceOf(joinpointClass); - } - /** - * - */ - protected enum MethodAttributes { - RECORD("record"), - BODY("body"), - CALLS("calls"), - CANONICAL("canonical"), - DECLARATIONJP("declarationJp"), - DECLARATIONJPS("declarationJps"), - DEFINITIONJP("definitionJp"), - FUNCTIONTYPE("functionType"), - GETDECLARATION("getDeclaration"), - HASDEFINITION("hasDefinition"), - ID("id"), - ISCANONICAL("isCanonical"), - ISCUDAKERNEL("isCudaKernel"), - ISDELETE("isDelete"), - ISIMPLEMENTATION("isImplementation"), - ISINLINE("isInline"), - ISMODULEPRIVATE("isModulePrivate"), - ISPROTOTYPE("isPrototype"), - ISPURE("isPure"), - ISVIRTUAL("isVirtual"), - PARAMNAMES("paramNames"), - PARAMS("params"), - RETURNTYPE("returnType"), - SIGNATURE("signature"), - STORAGECLASS("storageClass"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private MethodAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(MethodAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANamedDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANamedDecl.java deleted file mode 100644 index ac63c41d75..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANamedDecl.java +++ /dev/null @@ -1,1284 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ANamedDecl - * This class is overwritten by the Weaver Generator. - * - * Represents a decl with a name - * @author Lara Weaver Generator - */ -public abstract class ANamedDecl extends ADecl { - - protected ADecl aDecl; - - /** - * - */ - public ANamedDecl(ADecl aDecl){ - this.aDecl = aDecl; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - public abstract Boolean getIsPublicImpl(); - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - public final Object getIsPublic() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPublic", Optional.empty()); - } - Boolean result = this.getIsPublicImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPublic", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPublic", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * - */ - public void defNameImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def name with type String not implemented "); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - public abstract String getQualifiedNameImpl(); - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - public final Object getQualifiedName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "qualifiedName", Optional.empty()); - } - String result = this.getQualifiedNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "qualifiedName", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "qualifiedName", e); - } - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def qualifiedName with type String not implemented "); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - public abstract String getQualifiedPrefixImpl(); - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - public final Object getQualifiedPrefix() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "qualifiedPrefix", Optional.empty()); - } - String result = this.getQualifiedPrefixImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "qualifiedPrefix", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "qualifiedPrefix", e); - } - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def qualifiedPrefix with type String not implemented "); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - public void setNameImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action setName not implemented "); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - public final void setName(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setName", this, Optional.empty(), name); - } - this.setNameImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setName", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setName", e); - } - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - public void setQualifiedNameImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action setQualifiedName not implemented "); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - public final void setQualifiedName(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setQualifiedName", this, Optional.empty(), name); - } - this.setQualifiedNameImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setQualifiedName", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setQualifiedName", e); - } - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - throw new UnsupportedOperationException(get_class()+": Action setQualifiedPrefix not implemented "); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - public final void setQualifiedPrefix(String qualifiedPrefix) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setQualifiedPrefix", this, Optional.empty(), qualifiedPrefix); - } - this.setQualifiedPrefixImpl(qualifiedPrefix); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setQualifiedPrefix", this, Optional.empty(), qualifiedPrefix); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setQualifiedPrefix", e); - } - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDecl.getAttrsArrayImpl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDecl.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDecl); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aDecl.fillWithAttributes(attributes); - attributes.add("isPublic"); - attributes.add("name"); - attributes.add("qualifiedName"); - attributes.add("qualifiedPrefix"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aDecl.fillWithActions(actions); - actions.add("void setName(String)"); - actions.add("void setQualifiedName(String)"); - actions.add("void setQualifiedPrefix(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "namedDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum NamedDeclAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private NamedDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(NamedDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANewExpr.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANewExpr.java deleted file mode 100644 index f59120910c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ANewExpr.java +++ /dev/null @@ -1,1102 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ANewExpr - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ANewExpr extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public ANewExpr(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "newExpr"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum NewExprAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private NewExprAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(NewExprAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOmp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOmp.java deleted file mode 100644 index 43cf39cc44..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOmp.java +++ /dev/null @@ -1,2207 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AOmp - * This class is overwritten by the Weaver Generator. - * - * Represents an OpenMP pragma (e.g., #pragma omp parallel) - * @author Lara Weaver Generator - */ -public abstract class AOmp extends APragma { - - protected APragma aPragma; - - /** - * - */ - public AOmp(APragma aPragma){ - this.aPragma = aPragma; - } - /** - * Get value on attribute clauseKinds - * @return the attribute's value - */ - public abstract String[] getClauseKindsArrayImpl(); - - /** - * The names of the kinds of all clauses in the pragma, or empty array if no clause is defined - */ - public Object getClauseKindsImpl() { - String[] stringArrayImpl0 = getClauseKindsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The names of the kinds of all clauses in the pragma, or empty array if no clause is defined - */ - public final Object getClauseKinds() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "clauseKinds", Optional.empty()); - } - Object result = this.getClauseKindsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "clauseKinds", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "clauseKinds", e); - } - } - - /** - * An integer expression, or undefined if no 'collapse' clause is defined - */ - public abstract String getCollapseImpl(); - - /** - * An integer expression, or undefined if no 'collapse' clause is defined - */ - public final Object getCollapse() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "collapse", Optional.empty()); - } - String result = this.getCollapseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "collapse", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "collapse", e); - } - } - - /** - * Get value on attribute copyin - * @return the attribute's value - */ - public abstract String[] getCopyinArrayImpl(); - - /** - * The variable names of all copyin clauses, or empty array if no copyin clause is defined - */ - public Object getCopyinImpl() { - String[] stringArrayImpl0 = getCopyinArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The variable names of all copyin clauses, or empty array if no copyin clause is defined - */ - public final Object getCopyin() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "copyin", Optional.empty()); - } - Object result = this.getCopyinImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "copyin", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "copyin", e); - } - } - - /** - * One of 'shared' or 'none', or undefined if no 'default' clause is defined - */ - public abstract String getDefaultImpl(); - - /** - * One of 'shared' or 'none', or undefined if no 'default' clause is defined - */ - public final Object getDefault() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "default", Optional.empty()); - } - String result = this.getDefaultImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "default", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "default", e); - } - } - - /** - * Get value on attribute firstprivate - * @return the attribute's value - */ - public abstract String[] getFirstprivateArrayImpl(); - - /** - * The variable names of all firstprivate clauses, or empty array if no firstprivate clause is defined - */ - public Object getFirstprivateImpl() { - String[] stringArrayImpl0 = getFirstprivateArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The variable names of all firstprivate clauses, or empty array if no firstprivate clause is defined - */ - public final Object getFirstprivate() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "firstprivate", Optional.empty()); - } - Object result = this.getFirstprivateImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "firstprivate", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "firstprivate", e); - } - } - - /** - * - * @param kind - * @return - */ - public abstract String[] getReductionArrayImpl(String kind); - - /** - * - * @param kind - * @return - */ - public Object getReductionImpl(String kind) { - String[] stringArrayImpl0 = getReductionArrayImpl(kind); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * - * @param kind - * @return - */ - public final Object getReduction(String kind) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getReduction", Optional.empty(), kind); - } - Object result = this.getReductionImpl(kind); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getReduction", Optional.ofNullable(result), kind); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getReduction", e); - } - } - - /** - * - * @param clauseName - * @return - */ - public abstract Boolean hasClauseImpl(String clauseName); - - /** - * - * @param clauseName - * @return - */ - public final Object hasClause(String clauseName) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasClause", Optional.empty(), clauseName); - } - Boolean result = this.hasClauseImpl(clauseName); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasClause", Optional.ofNullable(result), clauseName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasClause", e); - } - } - - /** - * - * @param clauseName - * @return - */ - public abstract Boolean isClauseLegalImpl(String clauseName); - - /** - * - * @param clauseName - * @return - */ - public final Object isClauseLegal(String clauseName) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isClauseLegal", Optional.empty(), clauseName); - } - Boolean result = this.isClauseLegalImpl(clauseName); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isClauseLegal", Optional.ofNullable(result), clauseName); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isClauseLegal", e); - } - } - - /** - * The kind of the directive - */ - public abstract String getKindImpl(); - - /** - * The kind of the directive - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute lastprivate - * @return the attribute's value - */ - public abstract String[] getLastprivateArrayImpl(); - - /** - * The variable names of all lastprivate clauses, or empty array if no lastprivate clause is defined - */ - public Object getLastprivateImpl() { - String[] stringArrayImpl0 = getLastprivateArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The variable names of all lastprivate clauses, or empty array if no lastprivate clause is defined - */ - public final Object getLastprivate() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "lastprivate", Optional.empty()); - } - Object result = this.getLastprivateImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "lastprivate", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "lastprivate", e); - } - } - - /** - * An integer expression, or undefined if no 'num_threads' clause is defined - */ - public abstract String getNumThreadsImpl(); - - /** - * An integer expression, or undefined if no 'num_threads' clause is defined - */ - public final Object getNumThreads() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "numThreads", Optional.empty()); - } - String result = this.getNumThreadsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "numThreads", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "numThreads", e); - } - } - - /** - * - */ - public void defNumThreadsImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def numThreads with type String not implemented "); - } - - /** - * An integer expression, or undefined if no 'ordered' clause with a parameter is defined - */ - public abstract String getOrderedImpl(); - - /** - * An integer expression, or undefined if no 'ordered' clause with a parameter is defined - */ - public final Object getOrdered() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "ordered", Optional.empty()); - } - String result = this.getOrderedImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "ordered", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "ordered", e); - } - } - - /** - * Get value on attribute _private - * @return the attribute's value - */ - public abstract String[] getPrivateArrayImpl(); - - /** - * The variable names of all private clauses, or empty array if no private clause is defined - */ - public Object getPrivateImpl() { - String[] stringArrayImpl0 = getPrivateArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The variable names of all private clauses, or empty array if no private clause is defined - */ - public final Object getPrivate() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "private", Optional.empty()); - } - Object result = this.getPrivateImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "private", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "private", e); - } - } - - /** - * One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined - */ - public abstract String getProcBindImpl(); - - /** - * One of 'master', 'close' or 'spread', or undefined if no 'proc_bind' clause is defined - */ - public final Object getProcBind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "procBind", Optional.empty()); - } - String result = this.getProcBindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "procBind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "procBind", e); - } - } - - /** - * - */ - public void defProcBindImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def procBind with type String not implemented "); - } - - /** - * Get value on attribute reductionKinds - * @return the attribute's value - */ - public abstract String[] getReductionKindsArrayImpl(); - - /** - * The reduction kinds in the reductions clauses of the this pragma, or empty array if no reduction is defined - */ - public Object getReductionKindsImpl() { - String[] stringArrayImpl0 = getReductionKindsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The reduction kinds in the reductions clauses of the this pragma, or empty array if no reduction is defined - */ - public final Object getReductionKinds() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "reductionKinds", Optional.empty()); - } - Object result = this.getReductionKindsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "reductionKinds", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "reductionKinds", e); - } - } - - /** - * An integer expression, or undefined if no 'schedule' clause with chunk size is defined - */ - public abstract String getScheduleChunkSizeImpl(); - - /** - * An integer expression, or undefined if no 'schedule' clause with chunk size is defined - */ - public final Object getScheduleChunkSize() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "scheduleChunkSize", Optional.empty()); - } - String result = this.getScheduleChunkSizeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "scheduleChunkSize", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "scheduleChunkSize", e); - } - } - - /** - * One of 'static', 'dynamic', 'guided', 'auto' or 'runtime', or undefined if no 'schedule' clause is defined - */ - public abstract String getScheduleKindImpl(); - - /** - * One of 'static', 'dynamic', 'guided', 'auto' or 'runtime', or undefined if no 'schedule' clause is defined - */ - public final Object getScheduleKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "scheduleKind", Optional.empty()); - } - String result = this.getScheduleKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "scheduleKind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "scheduleKind", e); - } - } - - /** - * Get value on attribute scheduleModifiers - * @return the attribute's value - */ - public abstract String[] getScheduleModifiersArrayImpl(); - - /** - * A list with possible values of 'monotonic', 'nonmonotonic' or 'simd', or undefined if no 'schedule' clause with modifiers is defined - */ - public Object getScheduleModifiersImpl() { - String[] stringArrayImpl0 = getScheduleModifiersArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * A list with possible values of 'monotonic', 'nonmonotonic' or 'simd', or undefined if no 'schedule' clause with modifiers is defined - */ - public final Object getScheduleModifiers() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "scheduleModifiers", Optional.empty()); - } - Object result = this.getScheduleModifiersImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "scheduleModifiers", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "scheduleModifiers", e); - } - } - - /** - * Get value on attribute shared - * @return the attribute's value - */ - public abstract String[] getSharedArrayImpl(); - - /** - * The variable names of all shared clauses, or empty array if no shared clause is defined - */ - public Object getSharedImpl() { - String[] stringArrayImpl0 = getSharedArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * The variable names of all shared clauses, or empty array if no shared clause is defined - */ - public final Object getShared() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "shared", Optional.empty()); - } - Object result = this.getSharedImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "shared", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "shared", e); - } - } - - /** - * Removes any clause of the given kind from the OpenMP pragma - * @param clauseKind - */ - public void removeClauseImpl(String clauseKind) { - throw new UnsupportedOperationException(get_class()+": Action removeClause not implemented "); - } - - /** - * Removes any clause of the given kind from the OpenMP pragma - * @param clauseKind - */ - public final void removeClause(String clauseKind) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "removeClause", this, Optional.empty(), clauseKind); - } - this.removeClauseImpl(clauseKind); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "removeClause", this, Optional.empty(), clauseKind); - } - } catch(Exception e) { - throw new ActionException(get_class(), "removeClause", e); - } - } - - /** - * Sets the value of the collapse clause of an OpenMP pragma - * @param newExpr - */ - public void setCollapseImpl(String newExpr) { - throw new UnsupportedOperationException(get_class()+": Action setCollapse not implemented "); - } - - /** - * Sets the value of the collapse clause of an OpenMP pragma - * @param newExpr - */ - public final void setCollapse(String newExpr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCollapse", this, Optional.empty(), newExpr); - } - this.setCollapseImpl(newExpr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCollapse", this, Optional.empty(), newExpr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCollapse", e); - } - } - - /** - * Sets the value of the collapse clause of an OpenMP pragma - * @param newExpr - */ - public void setCollapseImpl(int newExpr) { - throw new UnsupportedOperationException(get_class()+": Action setCollapse not implemented "); - } - - /** - * Sets the value of the collapse clause of an OpenMP pragma - * @param newExpr - */ - public final void setCollapse(int newExpr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCollapse", this, Optional.empty(), newExpr); - } - this.setCollapseImpl(newExpr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCollapse", this, Optional.empty(), newExpr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCollapse", e); - } - } - - /** - * Sets the variables of a copyin clause of an OpenMP pragma - * @param newVariables - */ - public void setCopyinImpl(String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setCopyin not implemented "); - } - - /** - * Sets the variables of a copyin clause of an OpenMP pragma - * @param newVariables - */ - public final void setCopyin(Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setCopyin", this, Optional.empty(), new Object[] { newVariables}); - } - this.setCopyinImpl(pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setCopyin", this, Optional.empty(), new Object[] { newVariables}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setCopyin", e); - } - } - - /** - * Sets the value of the default clause of an OpenMP pragma - * @param newDefault - */ - public void setDefaultImpl(String newDefault) { - throw new UnsupportedOperationException(get_class()+": Action setDefault not implemented "); - } - - /** - * Sets the value of the default clause of an OpenMP pragma - * @param newDefault - */ - public final void setDefault(String newDefault) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setDefault", this, Optional.empty(), newDefault); - } - this.setDefaultImpl(newDefault); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setDefault", this, Optional.empty(), newDefault); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setDefault", e); - } - } - - /** - * Sets the variables of a firstprivate clause of an OpenMP pragma - * @param newVariables - */ - public void setFirstprivateImpl(String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setFirstprivate not implemented "); - } - - /** - * Sets the variables of a firstprivate clause of an OpenMP pragma - * @param newVariables - */ - public final void setFirstprivate(Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setFirstprivate", this, Optional.empty(), new Object[] { newVariables}); - } - this.setFirstprivateImpl(pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setFirstprivate", this, Optional.empty(), new Object[] { newVariables}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setFirstprivate", e); - } - } - - /** - * Sets the directive kind of the OpenMP pragma. Any unsupported clauses will be discarded - * @param directiveKind - */ - public void setKindImpl(String directiveKind) { - throw new UnsupportedOperationException(get_class()+": Action setKind not implemented "); - } - - /** - * Sets the directive kind of the OpenMP pragma. Any unsupported clauses will be discarded - * @param directiveKind - */ - public final void setKind(String directiveKind) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setKind", this, Optional.empty(), directiveKind); - } - this.setKindImpl(directiveKind); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setKind", this, Optional.empty(), directiveKind); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setKind", e); - } - } - - /** - * Sets the variables of a lastprivate clause of an OpenMP pragma - * @param newVariables - */ - public void setLastprivateImpl(String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setLastprivate not implemented "); - } - - /** - * Sets the variables of a lastprivate clause of an OpenMP pragma - * @param newVariables - */ - public final void setLastprivate(Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setLastprivate", this, Optional.empty(), new Object[] { newVariables}); - } - this.setLastprivateImpl(pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setLastprivate", this, Optional.empty(), new Object[] { newVariables}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setLastprivate", e); - } - } - - /** - * Sets the value of the num_threads clause of an OpenMP pragma - * @param newExpr - */ - public void setNumThreadsImpl(String newExpr) { - throw new UnsupportedOperationException(get_class()+": Action setNumThreads not implemented "); - } - - /** - * Sets the value of the num_threads clause of an OpenMP pragma - * @param newExpr - */ - public final void setNumThreads(String newExpr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setNumThreads", this, Optional.empty(), newExpr); - } - this.setNumThreadsImpl(newExpr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setNumThreads", this, Optional.empty(), newExpr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setNumThreads", e); - } - } - - /** - * Sets the value of the ordered clause of an OpenMP pragma - * @param parameters - */ - public void setOrderedImpl(String parameters) { - throw new UnsupportedOperationException(get_class()+": Action setOrdered not implemented "); - } - - /** - * Sets the value of the ordered clause of an OpenMP pragma - * @param parameters - */ - public final void setOrdered(String parameters) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setOrdered", this, Optional.empty(), parameters); - } - this.setOrderedImpl(parameters); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setOrdered", this, Optional.empty(), parameters); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setOrdered", e); - } - } - - /** - * Sets the variables of a private clause of an OpenMP pragma - * @param newVariables - */ - public void setPrivateImpl(String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setPrivate not implemented "); - } - - /** - * Sets the variables of a private clause of an OpenMP pragma - * @param newVariables - */ - public final void setPrivate(Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setPrivate", this, Optional.empty(), new Object[] { newVariables}); - } - this.setPrivateImpl(pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setPrivate", this, Optional.empty(), new Object[] { newVariables}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setPrivate", e); - } - } - - /** - * Sets the value of the proc_bind clause of an OpenMP pragma - * @param newBind - */ - public void setProcBindImpl(String newBind) { - throw new UnsupportedOperationException(get_class()+": Action setProcBind not implemented "); - } - - /** - * Sets the value of the proc_bind clause of an OpenMP pragma - * @param newBind - */ - public final void setProcBind(String newBind) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setProcBind", this, Optional.empty(), newBind); - } - this.setProcBindImpl(newBind); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setProcBind", this, Optional.empty(), newBind); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setProcBind", e); - } - } - - /** - * Sets the variables for a given kind of a reduction clause of an OpenMP pragma - * @param kind - * @param newVariables - */ - public void setReductionImpl(String kind, String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setReduction not implemented "); - } - - /** - * Sets the variables for a given kind of a reduction clause of an OpenMP pragma - * @param kind - * @param newVariables - */ - public final void setReduction(String kind, Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setReduction", this, Optional.empty(), kind, newVariables); - } - this.setReductionImpl(kind, pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setReduction", this, Optional.empty(), kind, newVariables); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setReduction", e); - } - } - - /** - * Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param chunkSize - */ - public void setScheduleChunkSizeImpl(String chunkSize) { - throw new UnsupportedOperationException(get_class()+": Action setScheduleChunkSize not implemented "); - } - - /** - * Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param chunkSize - */ - public final void setScheduleChunkSize(String chunkSize) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setScheduleChunkSize", this, Optional.empty(), chunkSize); - } - this.setScheduleChunkSizeImpl(chunkSize); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setScheduleChunkSize", this, Optional.empty(), chunkSize); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setScheduleChunkSize", e); - } - } - - /** - * Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param chunkSize - */ - public void setScheduleChunkSizeImpl(int chunkSize) { - throw new UnsupportedOperationException(get_class()+": Action setScheduleChunkSize not implemented "); - } - - /** - * Sets the value of the chunck size in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param chunkSize - */ - public final void setScheduleChunkSize(int chunkSize) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setScheduleChunkSize", this, Optional.empty(), chunkSize); - } - this.setScheduleChunkSizeImpl(chunkSize); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setScheduleChunkSize", this, Optional.empty(), chunkSize); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setScheduleChunkSize", e); - } - } - - /** - * Sets the value of the schedule clause of an OpenMP pragma - * @param scheduleKind - */ - public void setScheduleKindImpl(String scheduleKind) { - throw new UnsupportedOperationException(get_class()+": Action setScheduleKind not implemented "); - } - - /** - * Sets the value of the schedule clause of an OpenMP pragma - * @param scheduleKind - */ - public final void setScheduleKind(String scheduleKind) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setScheduleKind", this, Optional.empty(), scheduleKind); - } - this.setScheduleKindImpl(scheduleKind); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setScheduleKind", this, Optional.empty(), scheduleKind); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setScheduleKind", e); - } - } - - /** - * Sets the value of the modifiers in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param modifiers - */ - public void setScheduleModifiersImpl(String[] modifiers) { - throw new UnsupportedOperationException(get_class()+": Action setScheduleModifiers not implemented "); - } - - /** - * Sets the value of the modifiers in the schedule clause of an OpenMP pragma. Can only be called if there is already a schedule clause in the directive, otherwise throws an exception - * @param modifiers - */ - public final void setScheduleModifiers(Object[] modifiers) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setScheduleModifiers", this, Optional.empty(), new Object[] { modifiers}); - } - this.setScheduleModifiersImpl(pt.up.fe.specs.util.SpecsCollections.cast(modifiers, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setScheduleModifiers", this, Optional.empty(), new Object[] { modifiers}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setScheduleModifiers", e); - } - } - - /** - * Sets the variables of a shared clause of an OpenMP pragma - * @param newVariables - */ - public void setSharedImpl(String[] newVariables) { - throw new UnsupportedOperationException(get_class()+": Action setShared not implemented "); - } - - /** - * Sets the variables of a shared clause of an OpenMP pragma - * @param newVariables - */ - public final void setShared(Object[] newVariables) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setShared", this, Optional.empty(), new Object[] { newVariables}); - } - this.setSharedImpl(pt.up.fe.specs.util.SpecsCollections.cast(newVariables, String.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setShared", this, Optional.empty(), new Object[] { newVariables}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setShared", e); - } - } - - /** - * Get value on attribute content - * @return the attribute's value - */ - @Override - public String getContentImpl() { - return this.aPragma.getContentImpl(); - } - - /** - * Get value on attribute getTargetNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getTargetNodesArrayImpl(String endPragma) { - return this.aPragma.getTargetNodesArrayImpl(endPragma); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aPragma.getNameImpl(); - } - - /** - * Get value on attribute target - * @return the attribute's value - */ - @Override - public AJoinPoint getTargetImpl() { - return this.aPragma.getTargetImpl(); - } - - /** - * Method used by the lara interpreter to select targets - * @return - */ - @Override - public List selectTarget() { - return this.aPragma.selectTarget(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aPragma.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aPragma.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aPragma.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aPragma.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aPragma.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aPragma.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aPragma.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aPragma.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aPragma.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aPragma.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aPragma.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aPragma.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aPragma.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aPragma.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aPragma.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aPragma.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aPragma.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aPragma.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aPragma.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aPragma.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aPragma.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aPragma.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aPragma.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aPragma.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aPragma.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aPragma.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aPragma.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aPragma.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aPragma.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aPragma.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aPragma.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aPragma.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aPragma.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aPragma.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aPragma.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aPragma.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aPragma.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aPragma.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aPragma.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aPragma.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aPragma.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aPragma.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aPragma.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aPragma.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aPragma.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aPragma.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aPragma.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aPragma.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aPragma.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aPragma.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aPragma.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aPragma.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aPragma.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aPragma.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aPragma.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aPragma.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aPragma.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aPragma.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aPragma.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aPragma.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aPragma.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aPragma.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aPragma.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aPragma.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aPragma.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aPragma.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aPragma.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aPragma.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aPragma.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aPragma.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aPragma.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aPragma.replaceWithStringsImpl(node); - } - - /** - * - * @param content - */ - @Override - public void setContentImpl(String content) { - this.aPragma.setContentImpl(content); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aPragma.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aPragma.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aPragma.setLastChildImpl(node); - } - - /** - * - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aPragma.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aPragma.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aPragma.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aPragma.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aPragma.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aPragma.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aPragma); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "target": - joinPointList = selectTarget(); - break; - default: - joinPointList = this.aPragma.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "numThreads": { - if(value instanceof String){ - this.defNumThreadsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "procBind": { - if(value instanceof String){ - this.defProcBindImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aPragma.fillWithAttributes(attributes); - attributes.add("clauseKinds"); - attributes.add("collapse"); - attributes.add("copyin"); - attributes.add("default"); - attributes.add("firstprivate"); - attributes.add("getReduction"); - attributes.add("hasClause"); - attributes.add("isClauseLegal"); - attributes.add("kind"); - attributes.add("lastprivate"); - attributes.add("numThreads"); - attributes.add("ordered"); - attributes.add("private"); - attributes.add("procBind"); - attributes.add("reductionKinds"); - attributes.add("scheduleChunkSize"); - attributes.add("scheduleKind"); - attributes.add("scheduleModifiers"); - attributes.add("shared"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aPragma.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aPragma.fillWithActions(actions); - actions.add("void removeClause(String)"); - actions.add("void setCollapse(String)"); - actions.add("void setCollapse(int)"); - actions.add("void setCopyin(String[])"); - actions.add("void setDefault(String)"); - actions.add("void setFirstprivate(String[])"); - actions.add("void setKind(String)"); - actions.add("void setLastprivate(String[])"); - actions.add("void setNumThreads(String)"); - actions.add("void setOrdered(String)"); - actions.add("void setPrivate(String[])"); - actions.add("void setProcBind(String)"); - actions.add("void setReduction(String, String[])"); - actions.add("void setScheduleChunkSize(String)"); - actions.add("void setScheduleChunkSize(int)"); - actions.add("void setScheduleKind(String)"); - actions.add("void setScheduleModifiers(String[])"); - actions.add("void setShared(String[])"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "omp"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aPragma.instanceOf(joinpointClass); - } - /** - * - */ - protected enum OmpAttributes { - CLAUSEKINDS("clauseKinds"), - COLLAPSE("collapse"), - COPYIN("copyin"), - DEFAULT("default"), - FIRSTPRIVATE("firstprivate"), - GETREDUCTION("getReduction"), - HASCLAUSE("hasClause"), - ISCLAUSELEGAL("isClauseLegal"), - KIND("kind"), - LASTPRIVATE("lastprivate"), - NUMTHREADS("numThreads"), - ORDERED("ordered"), - PRIVATE("private"), - PROCBIND("procBind"), - REDUCTIONKINDS("reductionKinds"), - SCHEDULECHUNKSIZE("scheduleChunkSize"), - SCHEDULEKIND("scheduleKind"), - SCHEDULEMODIFIERS("scheduleModifiers"), - SHARED("shared"), - CONTENT("content"), - GETTARGETNODES("getTargetNodes"), - NAME("name"), - TARGET("target"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private OmpAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(OmpAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOp.java deleted file mode 100644 index dda1d55361..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AOp.java +++ /dev/null @@ -1,1183 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AOp - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AOp extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AOp(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - public abstract Boolean getIsBitwiseImpl(); - - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - public final Object getIsBitwise() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isBitwise", Optional.empty()); - } - Boolean result = this.getIsBitwiseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isBitwise", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isBitwise", e); - } - } - - /** - * The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary' - */ - public abstract String getKindImpl(); - - /** - * The kind of the operator. If it is a binary operator, can be one of: ptr_mem_d, ptr_mem_i, mul, div, rem, add, sub, shl, shr, cmp, lt, gt, le, ge, eq, ne, and, xor, or, l_and, l_or, assign, mul_assign, div_assign, rem_assign, add_assign, sub_assign, shl_assign, shr_assign, and_assign, xor_assign, or_assign, comma. If it is a unary operator, can be one of: post_inc, post_dec, pre_inc, pre_dec, addr_of, deref, plus, minus, not, l_not, real, imag, extension, cowait. If it is a ternary operator, the value will be 'ternary' - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute operator - * @return the attribute's value - */ - public abstract String getOperatorImpl(); - - /** - * Get value on attribute operator - * @return the attribute's value - */ - public final Object getOperator() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "operator", Optional.empty()); - } - String result = this.getOperatorImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "operator", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "operator", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("isBitwise"); - attributes.add("kind"); - attributes.add("operator"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "op"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum OpAttributes { - ISBITWISE("isBitwise"), - KIND("kind"), - OPERATOR("operator"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private OpAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(OpAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParam.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParam.java deleted file mode 100644 index 7774ae19c0..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParam.java +++ /dev/null @@ -1,1300 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AParam - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AParam extends AVardecl { - - protected AVardecl aVardecl; - - /** - * - */ - public AParam(AVardecl aVardecl){ - super(aVardecl); - this.aVardecl = aVardecl; - } - /** - * Get value on attribute definition - * @return the attribute's value - */ - @Override - public AVardecl getDefinitionImpl() { - return this.aVardecl.getDefinitionImpl(); - } - - /** - * Get value on attribute hasInit - * @return the attribute's value - */ - @Override - public Boolean getHasInitImpl() { - return this.aVardecl.getHasInitImpl(); - } - - /** - * Get value on attribute init - * @return the attribute's value - */ - @Override - public AExpression getInitImpl() { - return this.aVardecl.getInitImpl(); - } - - /** - * Get value on attribute initStyle - * @return the attribute's value - */ - @Override - public String getInitStyleImpl() { - return this.aVardecl.getInitStyleImpl(); - } - - /** - * Get value on attribute isGlobal - * @return the attribute's value - */ - @Override - public Boolean getIsGlobalImpl() { - return this.aVardecl.getIsGlobalImpl(); - } - - /** - * Get value on attribute isParam - * @return the attribute's value - */ - @Override - public Boolean getIsParamImpl() { - return this.aVardecl.getIsParamImpl(); - } - - /** - * Get value on attribute storageClass - * @return the attribute's value - */ - @Override - public String getStorageClassImpl() { - return this.aVardecl.getStorageClassImpl(); - } - - /** - * Method used by the lara interpreter to select inits - * @return - */ - @Override - public List selectInit() { - return this.aVardecl.selectInit(); - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aVardecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aVardecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aVardecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aVardecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aVardecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aVardecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aVardecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aVardecl.defQualifiedPrefixImpl(value); - } - - /** - * - */ - public void defStorageClassImpl(String value) { - this.aVardecl.defStorageClassImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aVardecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aVardecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aVardecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aVardecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aVardecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aVardecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aVardecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aVardecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aVardecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aVardecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aVardecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aVardecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aVardecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aVardecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aVardecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aVardecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aVardecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aVardecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aVardecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aVardecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aVardecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aVardecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aVardecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aVardecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aVardecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aVardecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aVardecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aVardecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aVardecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aVardecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aVardecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aVardecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aVardecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aVardecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aVardecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aVardecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aVardecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aVardecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aVardecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aVardecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aVardecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aVardecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aVardecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aVardecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aVardecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aVardecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aVardecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aVardecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aVardecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aVardecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aVardecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aVardecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aVardecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aVardecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aVardecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aVardecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aVardecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aVardecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aVardecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aVardecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aVardecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aVardecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aVardecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aVardecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aVardecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aVardecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aVardecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aVardecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aVardecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aVardecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aVardecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aVardecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aVardecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aVardecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aVardecl.removeChildrenImpl(); - } - - /** - * If vardecl already has an initialization, removes it. - * @param removeConst - */ - @Override - public void removeInitImpl(boolean removeConst) { - this.aVardecl.removeInitImpl(removeConst); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aVardecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aVardecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aVardecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aVardecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aVardecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aVardecl.setFirstChildImpl(node); - } - - /** - * Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - @Override - public void setInitImpl(AExpression init) { - this.aVardecl.setInitImpl(init); - } - - /** - * Converts the given string to a literal expression and sets it as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - @Override - public void setInitImpl(String init) { - this.aVardecl.setInitImpl(init); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aVardecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aVardecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aVardecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aVardecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aVardecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aVardecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl - * @param storageClass - */ - @Override - public void setStorageClassImpl(String storageClass) { - this.aVardecl.setStorageClassImpl(storageClass); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aVardecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aVardecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aVardecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aVardecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aVardecl.toCommentImpl(prefix, suffix); - } - - /** - * Creates a new varref based on this vardecl - */ - @Override - public AVarref varrefImpl() { - return this.aVardecl.varrefImpl(); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aVardecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "init": - joinPointList = selectInit(); - break; - default: - joinPointList = this.aVardecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "storageClass": { - if(value instanceof String){ - this.defStorageClassImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aVardecl.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aVardecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aVardecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "param"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aVardecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ParamAttributes { - DEFINITION("definition"), - HASINIT("hasInit"), - INIT("init"), - INITSTYLE("initStyle"), - ISGLOBAL("isGlobal"), - ISPARAM("isParam"), - STORAGECLASS("storageClass"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ParamAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ParamAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenExpr.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenExpr.java deleted file mode 100644 index aea58aaa7c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenExpr.java +++ /dev/null @@ -1,1129 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AParenExpr - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AParenExpr extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AParenExpr(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Returns the expression inside this parenthesis expression - */ - public abstract AExpression getSubExprImpl(); - - /** - * Returns the expression inside this parenthesis expression - */ - public final Object getSubExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "subExpr", Optional.empty()); - } - AExpression result = this.getSubExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "subExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "subExpr", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("subExpr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "parenExpr"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ParenExprAttributes { - SUBEXPR("subExpr"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ParenExprAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ParenExprAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenType.java deleted file mode 100644 index c244a093c4..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AParenType.java +++ /dev/null @@ -1,1385 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AParenType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AParenType extends AType { - - protected AType aType; - - /** - * - */ - public AParenType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute innerType - * @return the attribute's value - */ - public abstract AType getInnerTypeImpl(); - - /** - * Get value on attribute innerType - * @return the attribute's value - */ - public final Object getInnerType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "innerType", Optional.empty()); - } - AType result = this.getInnerTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "innerType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "innerType", e); - } - } - - /** - * - */ - public void defInnerTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def innerType with type AType not implemented "); - } - - /** - * Sets the inner type of this paren type - * @param innerType - */ - public void setInnerTypeImpl(AType innerType) { - throw new UnsupportedOperationException(get_class()+": Action setInnerType not implemented "); - } - - /** - * Sets the inner type of this paren type - * @param innerType - */ - public final void setInnerType(AType innerType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInnerType", this, Optional.empty(), innerType); - } - this.setInnerTypeImpl(innerType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInnerType", this, Optional.empty(), innerType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInnerType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "innerType": { - if(value instanceof AType){ - this.defInnerTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("innerType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - actions.add("void setInnerType(type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "parenType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ParenTypeAttributes { - INNERTYPE("innerType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ParenTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ParenTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APointerType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APointerType.java deleted file mode 100644 index 03d1cbd919..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APointerType.java +++ /dev/null @@ -1,1410 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point APointerType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class APointerType extends AType { - - protected AType aType; - - /** - * - */ - public APointerType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute pointee - * @return the attribute's value - */ - public abstract AType getPointeeImpl(); - - /** - * Get value on attribute pointee - * @return the attribute's value - */ - public final Object getPointee() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "pointee", Optional.empty()); - } - AType result = this.getPointeeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "pointee", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "pointee", e); - } - } - - /** - * - */ - public void defPointeeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def pointee with type AType not implemented "); - } - - /** - * Number of pointer levels from this pointer - */ - public abstract Integer getPointerLevelsImpl(); - - /** - * Number of pointer levels from this pointer - */ - public final Object getPointerLevels() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "pointerLevels", Optional.empty()); - } - Integer result = this.getPointerLevelsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "pointerLevels", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "pointerLevels", e); - } - } - - /** - * Sets the pointee type of this pointer type - * @param pointeeType - */ - public void setPointeeImpl(AType pointeeType) { - throw new UnsupportedOperationException(get_class()+": Action setPointee not implemented "); - } - - /** - * Sets the pointee type of this pointer type - * @param pointeeType - */ - public final void setPointee(AType pointeeType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setPointee", this, Optional.empty(), pointeeType); - } - this.setPointeeImpl(pointeeType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setPointee", this, Optional.empty(), pointeeType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setPointee", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "pointee": { - if(value instanceof AType){ - this.defPointeeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("pointee"); - attributes.add("pointerLevels"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - actions.add("void setPointee(type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "pointerType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum PointerTypeAttributes { - POINTEE("pointee"), - POINTERLEVELS("pointerLevels"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private PointerTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(PointerTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APragma.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APragma.java deleted file mode 100644 index fdfb87be9c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/APragma.java +++ /dev/null @@ -1,395 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point APragma - * This class is overwritten by the Weaver Generator. - * - * Represents a pragma in the code (e.g., #pragma kernel) - * @author Lara Weaver Generator - */ -public abstract class APragma extends ACxxWeaverJoinPoint { - - /** - * Everything that is after the name of the pragma - */ - public abstract String getContentImpl(); - - /** - * Everything that is after the name of the pragma - */ - public final Object getContent() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "content", Optional.empty()); - } - String result = this.getContentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "content", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "content", e); - } - } - - /** - * - * @param endPragma - * @return - */ - public abstract AJoinPoint[] getTargetNodesArrayImpl(String endPragma); - - /** - * - * @param endPragma - * @return - */ - public Object getTargetNodesImpl(String endPragma) { - AJoinPoint[] aJoinPointArrayImpl0 = getTargetNodesArrayImpl(endPragma); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aJoinPointArrayImpl0); - return nativeArray0; - } - - /** - * - * @param endPragma - * @return - */ - public final Object getTargetNodes(String endPragma) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getTargetNodes", Optional.empty(), endPragma); - } - Object result = this.getTargetNodesImpl(endPragma); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getTargetNodes", Optional.ofNullable(result), endPragma); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getTargetNodes", e); - } - } - - /** - * The name of the pragma. E.g. for #pragma foo bar, returns 'foo' - */ - public abstract String getNameImpl(); - - /** - * The name of the pragma. E.g. for #pragma foo bar, returns 'foo' - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations - */ - public abstract AJoinPoint getTargetImpl(); - - /** - * The first node below the pragma that is not a comment or another pragma. Example of pragma targets are statements and declarations - */ - public final Object getTarget() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "target", Optional.empty()); - } - AJoinPoint result = this.getTargetImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "target", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "target", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select targets - * @return - */ - public List selectTarget() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint.class, SelectOp.DESCENDANTS); - } - - /** - * - * @param content - */ - public void setContentImpl(String content) { - throw new UnsupportedOperationException(get_class()+": Action setContent not implemented "); - } - - /** - * - * @param content - */ - public final void setContent(String content) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setContent", this, Optional.empty(), content); - } - this.setContentImpl(content); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setContent", this, Optional.empty(), content); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setContent", e); - } - } - - /** - * - * @param name - */ - public void setNameImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action setName not implemented "); - } - - /** - * - * @param name - */ - public final void setName(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setName", this, Optional.empty(), name); - } - this.setNameImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setName", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setName", e); - } - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "target": - joinPointList = selectTarget(); - break; - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("content"); - attributes.add("getTargetNodes"); - attributes.add("name"); - attributes.add("target"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - super.fillWithSelects(selects); - selects.add("target"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - super.fillWithActions(actions); - actions.add("void setContent(String)"); - actions.add("void setName(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "pragma"; - } - /** - * - */ - protected enum PragmaAttributes { - CONTENT("content"), - GETTARGETNODES("getTargetNodes"), - NAME("name"), - TARGET("target"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private PragmaAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(PragmaAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AProgram.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AProgram.java deleted file mode 100644 index 747320f26c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AProgram.java +++ /dev/null @@ -1,1047 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AProgram - * This class is overwritten by the Weaver Generator. - * - * Represents the complete program and is the top-most joinpoint in the hierarchy - * @author Lara Weaver Generator - */ -public abstract class AProgram extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute baseFolder - * @return the attribute's value - */ - public abstract String getBaseFolderImpl(); - - /** - * Get value on attribute baseFolder - * @return the attribute's value - */ - public final Object getBaseFolder() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "baseFolder", Optional.empty()); - } - String result = this.getBaseFolderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "baseFolder", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "baseFolder", e); - } - } - - /** - * Get value on attribute defaultFlags - * @return the attribute's value - */ - public abstract String[] getDefaultFlagsArrayImpl(); - - /** - * Get value on attribute defaultFlags - * @return the attribute's value - */ - public Object getDefaultFlagsImpl() { - String[] stringArrayImpl0 = getDefaultFlagsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute defaultFlags - * @return the attribute's value - */ - public final Object getDefaultFlags() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "defaultFlags", Optional.empty()); - } - Object result = this.getDefaultFlagsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "defaultFlags", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "defaultFlags", e); - } - } - - /** - * Get value on attribute extraIncludes - * @return the attribute's value - */ - public abstract String[] getExtraIncludesArrayImpl(); - - /** - * paths to includes that the current program depends on - */ - public Object getExtraIncludesImpl() { - String[] stringArrayImpl0 = getExtraIncludesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * paths to includes that the current program depends on - */ - public final Object getExtraIncludes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "extraIncludes", Optional.empty()); - } - Object result = this.getExtraIncludesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "extraIncludes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "extraIncludes", e); - } - } - - /** - * Get value on attribute extraLibs - * @return the attribute's value - */ - public abstract String[] getExtraLibsArrayImpl(); - - /** - * link libraries of external projects the current program depends on - */ - public Object getExtraLibsImpl() { - String[] stringArrayImpl0 = getExtraLibsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * link libraries of external projects the current program depends on - */ - public final Object getExtraLibs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "extraLibs", Optional.empty()); - } - Object result = this.getExtraLibsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "extraLibs", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "extraLibs", e); - } - } - - /** - * Get value on attribute extraProjects - * @return the attribute's value - */ - public abstract String[] getExtraProjectsArrayImpl(); - - /** - * paths to folders of projects that the current program depends on - */ - public Object getExtraProjectsImpl() { - String[] stringArrayImpl0 = getExtraProjectsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * paths to folders of projects that the current program depends on - */ - public final Object getExtraProjects() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "extraProjects", Optional.empty()); - } - Object result = this.getExtraProjectsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "extraProjects", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "extraProjects", e); - } - } - - /** - * Get value on attribute extraSources - * @return the attribute's value - */ - public abstract String[] getExtraSourcesArrayImpl(); - - /** - * paths to sources that the current program depends on - */ - public Object getExtraSourcesImpl() { - String[] stringArrayImpl0 = getExtraSourcesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * paths to sources that the current program depends on - */ - public final Object getExtraSources() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "extraSources", Optional.empty()); - } - Object result = this.getExtraSourcesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "extraSources", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "extraSources", e); - } - } - - /** - * Get value on attribute files - * @return the attribute's value - */ - public abstract AFile[] getFilesArrayImpl(); - - /** - * the source files in this program - */ - public Object getFilesImpl() { - AFile[] aFileArrayImpl0 = getFilesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aFileArrayImpl0); - return nativeArray0; - } - - /** - * the source files in this program - */ - public final Object getFiles() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "files", Optional.empty()); - } - Object result = this.getFilesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "files", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "files", e); - } - } - - /** - * Get value on attribute includeFolders - * @return the attribute's value - */ - public abstract String[] getIncludeFoldersArrayImpl(); - - /** - * Get value on attribute includeFolders - * @return the attribute's value - */ - public Object getIncludeFoldersImpl() { - String[] stringArrayImpl0 = getIncludeFoldersArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute includeFolders - * @return the attribute's value - */ - public final Object getIncludeFolders() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "includeFolders", Optional.empty()); - } - Object result = this.getIncludeFoldersImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "includeFolders", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "includeFolders", e); - } - } - - /** - * true if the program was compiled with a C++ standard - */ - public abstract Boolean getIsCxxImpl(); - - /** - * true if the program was compiled with a C++ standard - */ - public final Object getIsCxx() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isCxx", Optional.empty()); - } - Boolean result = this.getIsCxxImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isCxx", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isCxx", e); - } - } - - /** - * a function join point with the main function of the program, if one is available - */ - public abstract AFunction getMainImpl(); - - /** - * a function join point with the main function of the program, if one is available - */ - public final Object getMain() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "main", Optional.empty()); - } - AFunction result = this.getMainImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "main", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "main", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * The name of the standard (e.g., c99, c++11) - */ - public abstract String getStandardImpl(); - - /** - * The name of the standard (e.g., c99, c++11) - */ - public final Object getStandard() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "standard", Optional.empty()); - } - String result = this.getStandardImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "standard", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "standard", e); - } - } - - /** - * The flag of the standard (e.g., -std=c++11) - */ - public abstract String getStdFlagImpl(); - - /** - * The flag of the standard (e.g., -std=c++11) - */ - public final Object getStdFlag() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "stdFlag", Optional.empty()); - } - String result = this.getStdFlagImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "stdFlag", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "stdFlag", e); - } - } - - /** - * Get value on attribute userFlags - * @return the attribute's value - */ - public abstract String[] getUserFlagsArrayImpl(); - - /** - * Get value on attribute userFlags - * @return the attribute's value - */ - public Object getUserFlagsImpl() { - String[] stringArrayImpl0 = getUserFlagsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute userFlags - * @return the attribute's value - */ - public final Object getUserFlags() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "userFlags", Optional.empty()); - } - Object result = this.getUserFlagsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "userFlags", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "userFlags", e); - } - } - - /** - * Get value on attribute weavingFolder - * @return the attribute's value - */ - public abstract String getWeavingFolderImpl(); - - /** - * Get value on attribute weavingFolder - * @return the attribute's value - */ - public final Object getWeavingFolder() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "weavingFolder", Optional.empty()); - } - String result = this.getWeavingFolderImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "weavingFolder", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "weavingFolder", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select files - * @return - */ - public List selectFile() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFile.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a path to an include that the current program depends on - * @param path - */ - public void addExtraIncludeImpl(String path) { - throw new UnsupportedOperationException(get_class()+": Action addExtraInclude not implemented "); - } - - /** - * Adds a path to an include that the current program depends on - * @param path - */ - public final void addExtraInclude(String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addExtraInclude", this, Optional.empty(), path); - } - this.addExtraIncludeImpl(path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addExtraInclude", this, Optional.empty(), path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addExtraInclude", e); - } - } - - /** - * Adds a path based on a git repository to an include that the current program depends on - * @param gitRepo - * @param path - */ - public void addExtraIncludeFromGitImpl(String gitRepo, String path) { - throw new UnsupportedOperationException(get_class()+": Action addExtraIncludeFromGit not implemented "); - } - - /** - * Adds a path based on a git repository to an include that the current program depends on - * @param gitRepo - * @param path - */ - public final void addExtraIncludeFromGit(String gitRepo, String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addExtraIncludeFromGit", this, Optional.empty(), gitRepo, path); - } - this.addExtraIncludeFromGitImpl(gitRepo, path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addExtraIncludeFromGit", this, Optional.empty(), gitRepo, path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addExtraIncludeFromGit", e); - } - } - - /** - * Adds a library (e.g., -pthreads) that the current program depends on - * @param lib - */ - public void addExtraLibImpl(String lib) { - throw new UnsupportedOperationException(get_class()+": Action addExtraLib not implemented "); - } - - /** - * Adds a library (e.g., -pthreads) that the current program depends on - * @param lib - */ - public final void addExtraLib(String lib) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addExtraLib", this, Optional.empty(), lib); - } - this.addExtraLibImpl(lib); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addExtraLib", this, Optional.empty(), lib); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addExtraLib", e); - } - } - - /** - * Adds a path to a source that the current program depends on - * @param path - */ - public void addExtraSourceImpl(String path) { - throw new UnsupportedOperationException(get_class()+": Action addExtraSource not implemented "); - } - - /** - * Adds a path to a source that the current program depends on - * @param path - */ - public final void addExtraSource(String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addExtraSource", this, Optional.empty(), path); - } - this.addExtraSourceImpl(path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addExtraSource", this, Optional.empty(), path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addExtraSource", e); - } - } - - /** - * Adds a path based on a git repository to a source that the current program depends on - * @param gitRepo - * @param path - */ - public void addExtraSourceFromGitImpl(String gitRepo, String path) { - throw new UnsupportedOperationException(get_class()+": Action addExtraSourceFromGit not implemented "); - } - - /** - * Adds a path based on a git repository to a source that the current program depends on - * @param gitRepo - * @param path - */ - public final void addExtraSourceFromGit(String gitRepo, String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addExtraSourceFromGit", this, Optional.empty(), gitRepo, path); - } - this.addExtraSourceFromGitImpl(gitRepo, path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addExtraSourceFromGit", this, Optional.empty(), gitRepo, path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addExtraSourceFromGit", e); - } - } - - /** - * Adds a file join point to the current program - * @param file - */ - public AJoinPoint addFileImpl(AFile file) { - throw new UnsupportedOperationException(get_class()+": Action addFile not implemented "); - } - - /** - * Adds a file join point to the current program - * @param file - */ - public final Object addFile(AFile file) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addFile", this, Optional.empty(), file); - } - AJoinPoint result = this.addFileImpl(file); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addFile", this, Optional.ofNullable(result), file); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "addFile", e); - } - } - - /** - * Adds a file join point to the current program, from the given path, which can be either a Java File or a String - * @param filepath - */ - public AJoinPoint addFileFromPathImpl(Object filepath) { - throw new UnsupportedOperationException(get_class()+": Action addFileFromPath not implemented "); - } - - /** - * Adds a file join point to the current program, from the given path, which can be either a Java File or a String - * @param filepath - */ - public final Object addFileFromPath(Object filepath) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addFileFromPath", this, Optional.empty(), filepath); - } - AJoinPoint result = this.addFileFromPathImpl(filepath); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addFileFromPath", this, Optional.ofNullable(result), filepath); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "addFileFromPath", e); - } - } - - /** - * Adds a path based on a git repository to a project that the current program depends on - * @param gitRepo - * @param libs - * @param path - */ - public void addProjectFromGitImpl(String gitRepo, String[] libs, String path) { - throw new UnsupportedOperationException(get_class()+": Action addProjectFromGit not implemented "); - } - - /** - * Adds a path based on a git repository to a project that the current program depends on - * @param gitRepo - * @param libs - * @param path - */ - public final void addProjectFromGit(String gitRepo, Object[] libs, String path) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addProjectFromGit", this, Optional.empty(), gitRepo, libs, path); - } - this.addProjectFromGitImpl(gitRepo, pt.up.fe.specs.util.SpecsCollections.cast(libs, String.class), path); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addProjectFromGit", this, Optional.empty(), gitRepo, libs, path); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addProjectFromGit", e); - } - } - - /** - * Registers a function to be executed when the program exits - * @param function - */ - public void atexitImpl(AFunction function) { - throw new UnsupportedOperationException(get_class()+": Action atexit not implemented "); - } - - /** - * Registers a function to be executed when the program exits - * @param function - */ - public final void atexit(AFunction function) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "atexit", this, Optional.empty(), function); - } - this.atexitImpl(function); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "atexit", this, Optional.empty(), function); - } - } catch(Exception e) { - throw new ActionException(get_class(), "atexit", e); - } - } - - /** - * Discards the AST at the top of the ASt stack - */ - public void popImpl() { - throw new UnsupportedOperationException(get_class()+": Action pop not implemented "); - } - - /** - * Discards the AST at the top of the ASt stack - */ - public final void pop() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "pop", this, Optional.empty()); - } - this.popImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "pop", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "pop", e); - } - } - - /** - * Creates a copy of the current AST and pushes it to the top of the AST stack - */ - public void pushImpl() { - throw new UnsupportedOperationException(get_class()+": Action push not implemented "); - } - - /** - * Creates a copy of the current AST and pushes it to the top of the AST stack - */ - public final void push() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "push", this, Optional.empty()); - } - this.pushImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "push", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "push", e); - } - } - - /** - * Recompiles the program currently represented by the AST, transforming literal code into AST nodes. Returns true if all files could be parsed correctly, or false otherwise - */ - public boolean rebuildImpl() { - throw new UnsupportedOperationException(get_class()+": Action rebuild not implemented "); - } - - /** - * Recompiles the program currently represented by the AST, transforming literal code into AST nodes. Returns true if all files could be parsed correctly, or false otherwise - */ - public final Object rebuild() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "rebuild", this, Optional.empty()); - } - boolean result = this.rebuildImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "rebuild", this, Optional.ofNullable(result)); - } - return result; - } catch(Exception e) { - throw new ActionException(get_class(), "rebuild", e); - } - } - - /** - * Similar to rebuild, but tries to fix compilation errors. Resulting program may not represent the originally intended functionality - */ - public void rebuildFuzzyImpl() { - throw new UnsupportedOperationException(get_class()+": Action rebuildFuzzy not implemented "); - } - - /** - * Similar to rebuild, but tries to fix compilation errors. Resulting program may not represent the originally intended functionality - */ - public final void rebuildFuzzy() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "rebuildFuzzy", this, Optional.empty()); - } - this.rebuildFuzzyImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "rebuildFuzzy", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "rebuildFuzzy", e); - } - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "file": - joinPointList = selectFile(); - break; - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("baseFolder"); - attributes.add("defaultFlags"); - attributes.add("extraIncludes"); - attributes.add("extraLibs"); - attributes.add("extraProjects"); - attributes.add("extraSources"); - attributes.add("files"); - attributes.add("includeFolders"); - attributes.add("isCxx"); - attributes.add("main"); - attributes.add("name"); - attributes.add("standard"); - attributes.add("stdFlag"); - attributes.add("userFlags"); - attributes.add("weavingFolder"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - super.fillWithSelects(selects); - selects.add("file"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - super.fillWithActions(actions); - actions.add("void addExtraInclude(String)"); - actions.add("void addExtraIncludeFromGit(String, String)"); - actions.add("void addExtraLib(String)"); - actions.add("void addExtraSource(String)"); - actions.add("void addExtraSourceFromGit(String, String)"); - actions.add("joinpoint addFile(file)"); - actions.add("joinpoint addFileFromPath(Object)"); - actions.add("void addProjectFromGit(String, String[], String)"); - actions.add("void atexit(function)"); - actions.add("void pop()"); - actions.add("void push()"); - actions.add("boolean rebuild()"); - actions.add("void rebuildFuzzy()"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "program"; - } - /** - * - */ - protected enum ProgramAttributes { - BASEFOLDER("baseFolder"), - DEFAULTFLAGS("defaultFlags"), - EXTRAINCLUDES("extraIncludes"), - EXTRALIBS("extraLibs"), - EXTRAPROJECTS("extraProjects"), - EXTRASOURCES("extraSources"), - FILES("files"), - INCLUDEFOLDERS("includeFolders"), - ISCXX("isCxx"), - MAIN("main"), - NAME("name"), - STANDARD("standard"), - STDFLAG("stdFlag"), - USERFLAGS("userFlags"), - WEAVINGFOLDER("weavingFolder"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ProgramAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ProgramAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AQualType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AQualType.java deleted file mode 100644 index 3c9012ccd5..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AQualType.java +++ /dev/null @@ -1,1380 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AQualType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AQualType extends AType { - - protected AType aType; - - /** - * - */ - public AQualType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute qualifiers - * @return the attribute's value - */ - public abstract String[] getQualifiersArrayImpl(); - - /** - * Get value on attribute qualifiers - * @return the attribute's value - */ - public Object getQualifiersImpl() { - String[] stringArrayImpl0 = getQualifiersArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute qualifiers - * @return the attribute's value - */ - public final Object getQualifiers() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "qualifiers", Optional.empty()); - } - Object result = this.getQualifiersImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "qualifiers", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "qualifiers", e); - } - } - - /** - * Get value on attribute unqualifiedType - * @return the attribute's value - */ - public abstract AType getUnqualifiedTypeImpl(); - - /** - * Get value on attribute unqualifiedType - * @return the attribute's value - */ - public final Object getUnqualifiedType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "unqualifiedType", Optional.empty()); - } - AType result = this.getUnqualifiedTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "unqualifiedType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "unqualifiedType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("qualifiers"); - attributes.add("unqualifiedType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "qualType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum QualTypeAttributes { - QUALIFIERS("qualifiers"), - UNQUALIFIEDTYPE("unqualifiedType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private QualTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(QualTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ARecord.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ARecord.java deleted file mode 100644 index ad4aab0cf9..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ARecord.java +++ /dev/null @@ -1,1354 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ARecord - * This class is overwritten by the Weaver Generator. - * - * Common class of struct, union and class - * @author Lara Weaver Generator - */ -public abstract class ARecord extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public ARecord(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute fields - * @return the attribute's value - */ - public abstract AField[] getFieldsArrayImpl(); - - /** - * Get value on attribute fields - * @return the attribute's value - */ - public Object getFieldsImpl() { - AField[] aFieldArrayImpl0 = getFieldsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aFieldArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute fields - * @return the attribute's value - */ - public final Object getFields() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "fields", Optional.empty()); - } - Object result = this.getFieldsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "fields", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "fields", e); - } - } - - /** - * Get value on attribute functions - * @return the attribute's value - */ - public abstract AFunction[] getFunctionsArrayImpl(); - - /** - * Get value on attribute functions - * @return the attribute's value - */ - public Object getFunctionsImpl() { - AFunction[] aFunctionArrayImpl0 = getFunctionsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aFunctionArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute functions - * @return the attribute's value - */ - public final Object getFunctions() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "functions", Optional.empty()); - } - Object result = this.getFunctionsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "functions", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "functions", e); - } - } - - /** - * true if this particular join point is an implementation (i.e. has its body fully specified), false otherwise - */ - public abstract Boolean getIsImplementationImpl(); - - /** - * true if this particular join point is an implementation (i.e. has its body fully specified), false otherwise - */ - public final Object getIsImplementation() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isImplementation", Optional.empty()); - } - Boolean result = this.getIsImplementationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isImplementation", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isImplementation", e); - } - } - - /** - * true if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise - */ - public abstract Boolean getIsPrototypeImpl(); - - /** - * true if this particular join point is a prototype (i.e. does not have its body fully specified), false otherwise - */ - public final Object getIsPrototype() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPrototype", Optional.empty()); - } - Boolean result = this.getIsPrototypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPrototype", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPrototype", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select fields - * @return - */ - public List selectField() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AField.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a field to a record (struct, class). - * @param field - */ - public void addFieldImpl(AField field) { - throw new UnsupportedOperationException(get_class()+": Action addField not implemented "); - } - - /** - * Adds a field to a record (struct, class). - * @param field - */ - public final void addField(AField field) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addField", this, Optional.empty(), field); - } - this.addFieldImpl(field); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addField", this, Optional.empty(), field); - } - } catch(Exception e) { - throw new ActionException(get_class(), "addField", e); - } - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "field": - joinPointList = selectField(); - break; - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - attributes.add("fields"); - attributes.add("functions"); - attributes.add("isImplementation"); - attributes.add("isPrototype"); - attributes.add("kind"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - selects.add("field"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - actions.add("void addField(field)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "record"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum RecordAttributes { - FIELDS("fields"), - FUNCTIONS("functions"), - ISIMPLEMENTATION("isImplementation"), - ISPROTOTYPE("isPrototype"), - KIND("kind"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private RecordAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(RecordAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AReturnStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AReturnStmt.java deleted file mode 100644 index 980f39ab5c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AReturnStmt.java +++ /dev/null @@ -1,1282 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AReturnStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AReturnStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AReturnStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute returnExpr - * @return the attribute's value - */ - public abstract AExpression getReturnExprImpl(); - - /** - * Get value on attribute returnExpr - * @return the attribute's value - */ - public final Object getReturnExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "returnExpr", Optional.empty()); - } - AExpression result = this.getReturnExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "returnExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "returnExpr", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select returnExprs - * @return - */ - public List selectReturnExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "returnExpr": - joinPointList = selectReturnExpr(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("returnExpr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - selects.add("returnExpr"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "returnStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ReturnStmtAttributes { - RETURNEXPR("returnExpr"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ReturnStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ReturnStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AScope.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AScope.java deleted file mode 100644 index dac6409d1a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AScope.java +++ /dev/null @@ -1,1921 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AScope - * This class is overwritten by the Weaver Generator. - * - * Represents a group of statements - * @author Lara Weaver Generator - */ -public abstract class AScope extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AScope(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute allStmts - * @return the attribute's value - */ - public abstract AStatement[] getAllStmtsArrayImpl(); - - /** - * Returns the descendant statements of this scope, excluding other scopes, loops, ifs and wrapper statements - */ - public Object getAllStmtsImpl() { - AStatement[] aStatementArrayImpl0 = getAllStmtsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aStatementArrayImpl0); - return nativeArray0; - } - - /** - * Returns the descendant statements of this scope, excluding other scopes, loops, ifs and wrapper statements - */ - public final Object getAllStmts() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "allStmts", Optional.empty()); - } - Object result = this.getAllStmtsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "allStmts", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "allStmts", e); - } - } - - /** - * Get value on attribute firstStmt - * @return the attribute's value - */ - public abstract AStatement getFirstStmtImpl(); - - /** - * Get value on attribute firstStmt - * @return the attribute's value - */ - public final Object getFirstStmt() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "firstStmt", Optional.empty()); - } - AStatement result = this.getFirstStmtImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "firstStmt", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "firstStmt", e); - } - } - - /** - * - * @param flat - * @return - */ - public abstract Long getNumStatementsImpl(Boolean flat); - - /** - * - * @param flat - * @return - */ - public final Object getNumStatements(Boolean flat) { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getNumStatements", Optional.empty(), flat); - } - Long result = this.getNumStatementsImpl(flat); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getNumStatements", Optional.ofNullable(result), flat); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getNumStatements", e); - } - } - - /** - * Get value on attribute lastStmt - * @return the attribute's value - */ - public abstract AStatement getLastStmtImpl(); - - /** - * Get value on attribute lastStmt - * @return the attribute's value - */ - public final Object getLastStmt() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "lastStmt", Optional.empty()); - } - AStatement result = this.getLastStmtImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "lastStmt", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "lastStmt", e); - } - } - - /** - * true if the scope does not have curly braces - */ - public abstract Boolean getNakedImpl(); - - /** - * true if the scope does not have curly braces - */ - public final Object getNaked() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "naked", Optional.empty()); - } - Boolean result = this.getNakedImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "naked", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "naked", e); - } - } - - /** - * - */ - public void defNakedImpl(Boolean value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def naked with type Boolean not implemented "); - } - - /** - * The statement that owns the scope (e.g., function, loop...) - */ - public abstract AJoinPoint getOwnerImpl(); - - /** - * The statement that owns the scope (e.g., function, loop...) - */ - public final Object getOwner() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "owner", Optional.empty()); - } - AJoinPoint result = this.getOwnerImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "owner", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "owner", e); - } - } - - /** - * Get value on attribute stmts - * @return the attribute's value - */ - public abstract AStatement[] getStmtsArrayImpl(); - - /** - * Returns the direct (children) statements of this scope - */ - public Object getStmtsImpl() { - AStatement[] aStatementArrayImpl0 = getStmtsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aStatementArrayImpl0); - return nativeArray0; - } - - /** - * Returns the direct (children) statements of this scope - */ - public final Object getStmts() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "stmts", Optional.empty()); - } - Object result = this.getStmtsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "stmts", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "stmts", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select stmts - * @return - */ - public List selectStmt() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select childStmts - * @return - */ - public List selectChildStmt() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select scopes - * @return - */ - public List selectScope() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select ifs - * @return - */ - public List selectIf() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AIf.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select loops - * @return - */ - public List selectLoop() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ALoop.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select pragmas - * @return - */ - public List selectPragma() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.APragma.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select markers - * @return - */ - public List selectMarker() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMarker.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select tags - * @return - */ - public List selectTag() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATag.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select omps - * @return - */ - public List selectOmp() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AOmp.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select comments - * @return - */ - public List selectComment() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AComment.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select returnStmts - * @return - */ - public List selectReturnStmt() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AReturnStmt.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select cilkFors - * @return - */ - public List selectCilkFor() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkFor.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select cilkSyncs - * @return - */ - public List selectCilkSync() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkSync.class, SelectOp.DESCENDANTS); - } - - /** - * Adds a new local variable to this scope - * @param name - * @param type - * @param initValue - */ - public AJoinPoint addLocalImpl(String name, AJoinPoint type, String initValue) { - throw new UnsupportedOperationException(get_class()+": Action addLocal not implemented "); - } - - /** - * Adds a new local variable to this scope - * @param name - * @param type - * @param initValue - */ - public final Object addLocal(String name, AJoinPoint type, String initValue) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "addLocal", this, Optional.empty(), name, type, initValue); - } - AJoinPoint result = this.addLocalImpl(name, type, initValue); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "addLocal", this, Optional.ofNullable(result), name, type, initValue); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "addLocal", e); - } - } - - /** - * CFG tester - */ - public String cfgImpl() { - throw new UnsupportedOperationException(get_class()+": Action cfg not implemented "); - } - - /** - * CFG tester - */ - public final Object cfg() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "cfg", this, Optional.empty()); - } - String result = this.cfgImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "cfg", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "cfg", e); - } - } - - /** - * Clears the contents of this scope (untested) - */ - public void clearImpl() { - throw new UnsupportedOperationException(get_class()+": Action clear not implemented "); - } - - /** - * Clears the contents of this scope (untested) - */ - public final void clear() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "clear", this, Optional.empty()); - } - this.clearImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "clear", this, Optional.empty()); - } - } catch(Exception e) { - throw new ActionException(get_class(), "clear", e); - } - } - - /** - * DFG tester - */ - public String dfgImpl() { - throw new UnsupportedOperationException(get_class()+": Action dfg not implemented "); - } - - /** - * DFG tester - */ - public final Object dfg() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "dfg", this, Optional.empty()); - } - String result = this.dfgImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "dfg", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "dfg", e); - } - } - - /** - * - * @param node - */ - public AJoinPoint insertBeginImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertBegin not implemented "); - } - - /** - * - * @param node - */ - public final Object insertBegin(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBegin", this, Optional.empty(), node); - } - AJoinPoint result = this.insertBeginImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBegin", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertBegin", e); - } - } - - /** - * - * @param code - */ - public AJoinPoint insertBeginImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertBegin not implemented "); - } - - /** - * - * @param code - */ - public final Object insertBegin(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertBegin", this, Optional.empty(), code); - } - AJoinPoint result = this.insertBeginImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertBegin", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertBegin", e); - } - } - - /** - * - * @param node - */ - public AJoinPoint insertEndImpl(AJoinPoint node) { - throw new UnsupportedOperationException(get_class()+": Action insertEnd not implemented "); - } - - /** - * - * @param node - */ - public final Object insertEnd(AJoinPoint node) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertEnd", this, Optional.empty(), node); - } - AJoinPoint result = this.insertEndImpl(node); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertEnd", this, Optional.ofNullable(result), node); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertEnd", e); - } - } - - /** - * - * @param code - */ - public AJoinPoint insertEndImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertEnd not implemented "); - } - - /** - * - * @param code - */ - public final Object insertEnd(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertEnd", this, Optional.empty(), code); - } - AJoinPoint result = this.insertEndImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertEnd", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertEnd", e); - } - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - public AJoinPoint insertReturnImpl(AJoinPoint code) { - throw new UnsupportedOperationException(get_class()+": Action insertReturn not implemented "); - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - public final Object insertReturn(AJoinPoint code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertReturn", this, Optional.empty(), code); - } - AJoinPoint result = this.insertReturnImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertReturn", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertReturn", e); - } - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - public AJoinPoint insertReturnImpl(String code) { - throw new UnsupportedOperationException(get_class()+": Action insertReturn not implemented "); - } - - /** - * Inserts the joinpoint before the return points of the scope (return statements and implicitly, at the end of the scope). Returns the last inserted node - * @param code - */ - public final Object insertReturn(String code) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "insertReturn", this, Optional.empty(), code); - } - AJoinPoint result = this.insertReturnImpl(code); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "insertReturn", this, Optional.ofNullable(result), code); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "insertReturn", e); - } - } - - /** - * Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces) - * @param isNaked - */ - public void setNakedImpl(Boolean isNaked) { - throw new UnsupportedOperationException(get_class()+": Action setNaked not implemented "); - } - - /** - * Sets the 'naked' status of a scope (a scope is naked if it does not have curly braces) - * @param isNaked - */ - public final void setNaked(Boolean isNaked) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setNaked", this, Optional.empty(), isNaked); - } - this.setNakedImpl(isNaked); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setNaked", this, Optional.empty(), isNaked); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setNaked", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "stmt": - joinPointList = selectStmt(); - break; - case "childStmt": - joinPointList = selectChildStmt(); - break; - case "scope": - joinPointList = selectScope(); - break; - case "if": - joinPointList = selectIf(); - break; - case "loop": - joinPointList = selectLoop(); - break; - case "pragma": - joinPointList = selectPragma(); - break; - case "marker": - joinPointList = selectMarker(); - break; - case "tag": - joinPointList = selectTag(); - break; - case "omp": - joinPointList = selectOmp(); - break; - case "comment": - joinPointList = selectComment(); - break; - case "returnStmt": - joinPointList = selectReturnStmt(); - break; - case "cilkFor": - joinPointList = selectCilkFor(); - break; - case "cilkSync": - joinPointList = selectCilkSync(); - break; - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "naked": { - if(value instanceof Boolean){ - this.defNakedImpl((Boolean)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("allStmts"); - attributes.add("firstStmt"); - attributes.add("getNumStatements"); - attributes.add("lastStmt"); - attributes.add("naked"); - attributes.add("owner"); - attributes.add("stmts"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - selects.add("stmt"); - selects.add("childStmt"); - selects.add("scope"); - selects.add("if"); - selects.add("loop"); - selects.add("pragma"); - selects.add("marker"); - selects.add("tag"); - selects.add("omp"); - selects.add("comment"); - selects.add("returnStmt"); - selects.add("cilkFor"); - selects.add("cilkSync"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - actions.add("joinpoint addLocal(String, joinpoint, String)"); - actions.add("String cfg()"); - actions.add("void clear()"); - actions.add("String dfg()"); - actions.add("joinpoint insertBegin(joinpoint)"); - actions.add("joinpoint insertBegin(String)"); - actions.add("joinpoint insertEnd(joinpoint)"); - actions.add("joinpoint insertEnd(String)"); - actions.add("joinpoint insertReturn(joinpoint)"); - actions.add("joinpoint insertReturn(String)"); - actions.add("void setNaked(Boolean)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "scope"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ScopeAttributes { - ALLSTMTS("allStmts"), - FIRSTSTMT("firstStmt"), - GETNUMSTATEMENTS("getNumStatements"), - LASTSTMT("lastStmt"), - NAKED("naked"), - OWNER("owner"), - STMTS("stmts"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ScopeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ScopeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStatement.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStatement.java deleted file mode 100644 index 4e1767f5a6..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStatement.java +++ /dev/null @@ -1,447 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AStatement - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AStatement extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - public abstract Boolean getIsFirstImpl(); - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - public final Object getIsFirst() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isFirst", Optional.empty()); - } - Boolean result = this.getIsFirstImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isFirst", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isFirst", e); - } - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - public abstract Boolean getIsLastImpl(); - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - public final Object getIsLast() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isLast", Optional.empty()); - } - Boolean result = this.getIsLastImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isLast", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isLast", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select exprs - * @return - */ - public List selectExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select childExprs - * @return - */ - public List selectChildExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select calls - * @return - */ - public List selectCall() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACall.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select stmtCalls - * @return - */ - public List selectStmtCall() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACall.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select memberCalls - * @return - */ - public List selectMemberCall() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMemberCall.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select memberAccesss - * @return - */ - public List selectMemberAccess() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMemberAccess.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select arrayAccesss - * @return - */ - public List selectArrayAccess() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AArrayAccess.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select vardecls - * @return - */ - public List selectVardecl() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select varrefs - * @return - */ - public List selectVarref() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVarref.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select ops - * @return - */ - public List selectOp() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AOp.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select binaryOps - * @return - */ - public List selectBinaryOp() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ABinaryOp.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select unaryOps - * @return - */ - public List selectUnaryOp() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AUnaryOp.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select newExprs - * @return - */ - public List selectNewExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ANewExpr.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select deleteExprs - * @return - */ - public List selectDeleteExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ADeleteExpr.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select cilkSpawns - * @return - */ - public List selectCilkSpawn() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkSpawn.class, SelectOp.DESCENDANTS); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("isFirst"); - attributes.add("isLast"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - super.fillWithSelects(selects); - selects.add("expr"); - selects.add("childExpr"); - selects.add("call"); - selects.add("stmtCall"); - selects.add("memberCall"); - selects.add("memberAccess"); - selects.add("arrayAccess"); - selects.add("vardecl"); - selects.add("varref"); - selects.add("op"); - selects.add("binaryOp"); - selects.add("unaryOp"); - selects.add("newExpr"); - selects.add("deleteExpr"); - selects.add("cilkSpawn"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - super.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "statement"; - } - /** - * - */ - protected enum StatementAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private StatementAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(StatementAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStruct.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStruct.java deleted file mode 100644 index f2ecb40f1d..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AStruct.java +++ /dev/null @@ -1,1231 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AStruct - * This class is overwritten by the Weaver Generator. - * - * Represets a struct declaration - * @author Lara Weaver Generator - */ -public abstract class AStruct extends ARecord { - - protected ARecord aRecord; - - /** - * - */ - public AStruct(ARecord aRecord){ - super(aRecord); - this.aRecord = aRecord; - } - /** - * Get value on attribute fieldsArrayImpl - * @return the attribute's value - */ - @Override - public AField[] getFieldsArrayImpl() { - return this.aRecord.getFieldsArrayImpl(); - } - - /** - * Get value on attribute functionsArrayImpl - * @return the attribute's value - */ - @Override - public AFunction[] getFunctionsArrayImpl() { - return this.aRecord.getFunctionsArrayImpl(); - } - - /** - * Get value on attribute isImplementation - * @return the attribute's value - */ - @Override - public Boolean getIsImplementationImpl() { - return this.aRecord.getIsImplementationImpl(); - } - - /** - * Get value on attribute isPrototype - * @return the attribute's value - */ - @Override - public Boolean getIsPrototypeImpl() { - return this.aRecord.getIsPrototypeImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aRecord.getKindImpl(); - } - - /** - * Method used by the lara interpreter to select fields - * @return - */ - @Override - public List selectField() { - return this.aRecord.selectField(); - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aRecord.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aRecord.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aRecord.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aRecord.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aRecord.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aRecord.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aRecord.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aRecord.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aRecord.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aRecord.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aRecord.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aRecord.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aRecord.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aRecord.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aRecord.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aRecord.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aRecord.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aRecord.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aRecord.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aRecord.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aRecord.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aRecord.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aRecord.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aRecord.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aRecord.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aRecord.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aRecord.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aRecord.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aRecord.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aRecord.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aRecord.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aRecord.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aRecord.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aRecord.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aRecord.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aRecord.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aRecord.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aRecord.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aRecord.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aRecord.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aRecord.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aRecord.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aRecord.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aRecord.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aRecord.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aRecord.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aRecord.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aRecord.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aRecord.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aRecord.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aRecord.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aRecord.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aRecord.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aRecord.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aRecord.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aRecord.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aRecord.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aRecord.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aRecord.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aRecord.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aRecord.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aRecord.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aRecord.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aRecord.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aRecord.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aRecord.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aRecord.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aRecord.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aRecord.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aRecord.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aRecord.getTypeImpl(); - } - - /** - * Adds a field to a record (struct, class). - * @param field - */ - @Override - public void addFieldImpl(AField field) { - this.aRecord.addFieldImpl(field); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aRecord.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aRecord.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aRecord.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aRecord.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aRecord.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aRecord.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aRecord.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aRecord.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aRecord.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aRecord.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aRecord.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aRecord.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aRecord.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aRecord.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aRecord.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aRecord.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aRecord.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aRecord.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aRecord.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aRecord.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aRecord.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aRecord.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aRecord.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aRecord.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aRecord.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aRecord.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aRecord.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aRecord); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "field": - joinPointList = selectField(); - break; - default: - joinPointList = this.aRecord.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aRecord.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aRecord.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aRecord.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "struct"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aRecord.instanceOf(joinpointClass); - } - /** - * - */ - protected enum StructAttributes { - FIELDS("fields"), - FUNCTIONS("functions"), - ISIMPLEMENTATION("isImplementation"), - ISPROTOTYPE("isPrototype"), - KIND("kind"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private StructAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(StructAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitch.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitch.java deleted file mode 100644 index 1a57183326..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitch.java +++ /dev/null @@ -1,1352 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ASwitch - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ASwitch extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ASwitch(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute cases - * @return the attribute's value - */ - public abstract ACase[] getCasesArrayImpl(); - - /** - * the case statements inside this switch - */ - public Object getCasesImpl() { - ACase[] aCaseArrayImpl0 = getCasesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aCaseArrayImpl0); - return nativeArray0; - } - - /** - * the case statements inside this switch - */ - public final Object getCases() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "cases", Optional.empty()); - } - Object result = this.getCasesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "cases", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "cases", e); - } - } - - /** - * the condition of this switch statement - */ - public abstract AExpression getConditionImpl(); - - /** - * the condition of this switch statement - */ - public final Object getCondition() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "condition", Optional.empty()); - } - AExpression result = this.getConditionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "condition", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "condition", e); - } - } - - /** - * the default case statement of this switch statement or undefined if it does not have a default case - */ - public abstract ACase getGetDefaultCaseImpl(); - - /** - * the default case statement of this switch statement or undefined if it does not have a default case - */ - public final Object getGetDefaultCase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "getDefaultCase", Optional.empty()); - } - ACase result = this.getGetDefaultCaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "getDefaultCase", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "getDefaultCase", e); - } - } - - /** - * true if there is a default case in this switch statement, false otherwise - */ - public abstract Boolean getHasDefaultCaseImpl(); - - /** - * true if there is a default case in this switch statement, false otherwise - */ - public final Object getHasDefaultCase() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasDefaultCase", Optional.empty()); - } - Boolean result = this.getHasDefaultCaseImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasDefaultCase", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasDefaultCase", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("cases"); - attributes.add("condition"); - attributes.add("getDefaultCase"); - attributes.add("hasDefaultCase"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "switch"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum SwitchAttributes { - CASES("cases"), - CONDITION("condition"), - GETDEFAULTCASE("getDefaultCase"), - HASDEFAULTCASE("hasDefaultCase"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private SwitchAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(SwitchAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitchCase.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitchCase.java deleted file mode 100644 index 6dd5bfe90c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ASwitchCase.java +++ /dev/null @@ -1,1240 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ASwitchCase - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ASwitchCase extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public ASwitchCase(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "switchCase"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum SwitchCaseAttributes { - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private SwitchCaseAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(SwitchCaseAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATag.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATag.java deleted file mode 100644 index 0ddd3a545c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATag.java +++ /dev/null @@ -1,1137 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATag - * This class is overwritten by the Weaver Generator. - * - * A pragma that references a point in the code and sticks to it - * @author Lara Weaver Generator - */ -public abstract class ATag extends APragma { - - protected APragma aPragma; - - /** - * - */ - public ATag(APragma aPragma){ - this.aPragma = aPragma; - } - /** - * The ID of the pragma - */ - public abstract String getIdImpl(); - - /** - * The ID of the pragma - */ - public final Object getId() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "id", Optional.empty()); - } - String result = this.getIdImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "id", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "id", e); - } - } - - /** - * Get value on attribute content - * @return the attribute's value - */ - @Override - public String getContentImpl() { - return this.aPragma.getContentImpl(); - } - - /** - * Get value on attribute getTargetNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getTargetNodesArrayImpl(String endPragma) { - return this.aPragma.getTargetNodesArrayImpl(endPragma); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aPragma.getNameImpl(); - } - - /** - * Get value on attribute target - * @return the attribute's value - */ - @Override - public AJoinPoint getTargetImpl() { - return this.aPragma.getTargetImpl(); - } - - /** - * Method used by the lara interpreter to select targets - * @return - */ - @Override - public List selectTarget() { - return this.aPragma.selectTarget(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aPragma.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aPragma.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aPragma.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aPragma.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aPragma.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aPragma.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aPragma.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aPragma.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aPragma.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aPragma.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aPragma.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aPragma.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aPragma.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aPragma.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aPragma.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aPragma.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aPragma.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aPragma.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aPragma.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aPragma.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aPragma.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aPragma.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aPragma.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aPragma.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aPragma.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aPragma.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aPragma.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aPragma.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aPragma.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aPragma.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aPragma.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aPragma.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aPragma.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aPragma.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aPragma.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aPragma.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aPragma.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aPragma.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aPragma.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aPragma.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aPragma.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aPragma.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aPragma.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aPragma.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aPragma.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aPragma.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aPragma.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aPragma.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aPragma.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aPragma.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aPragma.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aPragma.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aPragma.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aPragma.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aPragma.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aPragma.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aPragma.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aPragma.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aPragma.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aPragma.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aPragma.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aPragma.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aPragma.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aPragma.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aPragma.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aPragma.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aPragma.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aPragma.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aPragma.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aPragma.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aPragma.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aPragma.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aPragma.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aPragma.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aPragma.replaceWithStringsImpl(node); - } - - /** - * - * @param content - */ - @Override - public void setContentImpl(String content) { - this.aPragma.setContentImpl(content); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aPragma.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aPragma.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aPragma.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aPragma.setLastChildImpl(node); - } - - /** - * - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aPragma.setNameImpl(name); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aPragma.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aPragma.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aPragma.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aPragma.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aPragma.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aPragma); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "target": - joinPointList = selectTarget(); - break; - default: - joinPointList = this.aPragma.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aPragma.fillWithAttributes(attributes); - attributes.add("id"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aPragma.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aPragma.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "tag"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aPragma.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TagAttributes { - ID("id"), - CONTENT("content"), - GETTARGETNODES("getTargetNodes"), - NAME("name"), - TARGET("target"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TagAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TagAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATagType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATagType.java deleted file mode 100644 index 723f401eb0..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATagType.java +++ /dev/null @@ -1,1368 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATagType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ATagType extends AType { - - protected AType aType; - - /** - * - */ - public ATagType(AType aType){ - this.aType = aType; - } - /** - * a 'decl' join point that represents the declaration of this tag type - */ - public abstract ADecl getDeclImpl(); - - /** - * a 'decl' join point that represents the declaration of this tag type - */ - public final Object getDecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "decl", Optional.empty()); - } - ADecl result = this.getDeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "decl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "decl", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("decl"); - attributes.add("name"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "tagType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TagTypeAttributes { - DECL("decl"), - NAME("name"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TagTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TagTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATemplateSpecializationType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATemplateSpecializationType.java deleted file mode 100644 index 3306b30245..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATemplateSpecializationType.java +++ /dev/null @@ -1,1434 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATemplateSpecializationType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ATemplateSpecializationType extends AType { - - protected AType aType; - - /** - * - */ - public ATemplateSpecializationType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute args - * @return the attribute's value - */ - public abstract String[] getArgsArrayImpl(); - - /** - * Get value on attribute args - * @return the attribute's value - */ - public Object getArgsImpl() { - String[] stringArrayImpl0 = getArgsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute args - * @return the attribute's value - */ - public final Object getArgs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "args", Optional.empty()); - } - Object result = this.getArgsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "args", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "args", e); - } - } - - /** - * Get value on attribute firstArgType - * @return the attribute's value - */ - public abstract AType getFirstArgTypeImpl(); - - /** - * Get value on attribute firstArgType - * @return the attribute's value - */ - public final Object getFirstArgType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "firstArgType", Optional.empty()); - } - AType result = this.getFirstArgTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "firstArgType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "firstArgType", e); - } - } - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - public abstract Integer getNumArgsImpl(); - - /** - * Get value on attribute numArgs - * @return the attribute's value - */ - public final Object getNumArgs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "numArgs", Optional.empty()); - } - Integer result = this.getNumArgsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "numArgs", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "numArgs", e); - } - } - - /** - * Get value on attribute templateName - * @return the attribute's value - */ - public abstract String getTemplateNameImpl(); - - /** - * Get value on attribute templateName - * @return the attribute's value - */ - public final Object getTemplateName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "templateName", Optional.empty()); - } - String result = this.getTemplateNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "templateName", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "templateName", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("args"); - attributes.add("firstArgType"); - attributes.add("numArgs"); - attributes.add("templateName"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "templateSpecializationType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TemplateSpecializationTypeAttributes { - ARGS("args"), - FIRSTARGTYPE("firstArgType"), - NUMARGS("numArgs"), - TEMPLATENAME("templateName"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TemplateSpecializationTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TemplateSpecializationTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATernaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATernaryOp.java deleted file mode 100644 index e3aaebb700..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATernaryOp.java +++ /dev/null @@ -1,1295 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATernaryOp - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class ATernaryOp extends AOp { - - protected AOp aOp; - - /** - * - */ - public ATernaryOp(AOp aOp){ - super(aOp); - this.aOp = aOp; - } - /** - * Get value on attribute cond - * @return the attribute's value - */ - public abstract AExpression getCondImpl(); - - /** - * Get value on attribute cond - * @return the attribute's value - */ - public final Object getCond() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "cond", Optional.empty()); - } - AExpression result = this.getCondImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "cond", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "cond", e); - } - } - - /** - * - */ - public void defCondImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def cond with type AExpression not implemented "); - } - - /** - * Get value on attribute falseExpr - * @return the attribute's value - */ - public abstract AExpression getFalseExprImpl(); - - /** - * Get value on attribute falseExpr - * @return the attribute's value - */ - public final Object getFalseExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "falseExpr", Optional.empty()); - } - AExpression result = this.getFalseExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "falseExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "falseExpr", e); - } - } - - /** - * - */ - public void defFalseExprImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def falseExpr with type AExpression not implemented "); - } - - /** - * Get value on attribute trueExpr - * @return the attribute's value - */ - public abstract AExpression getTrueExprImpl(); - - /** - * Get value on attribute trueExpr - * @return the attribute's value - */ - public final Object getTrueExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "trueExpr", Optional.empty()); - } - AExpression result = this.getTrueExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "trueExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "trueExpr", e); - } - } - - /** - * - */ - public void defTrueExprImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def trueExpr with type AExpression not implemented "); - } - - /** - * Default implementation of the method used by the lara interpreter to select conds - * @return - */ - public List selectCond() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select trueExprs - * @return - */ - public List selectTrueExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Default implementation of the method used by the lara interpreter to select falseExprs - * @return - */ - public List selectFalseExpr() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - @Override - public Boolean getIsBitwiseImpl() { - return this.aOp.getIsBitwiseImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aOp.getKindImpl(); - } - - /** - * Get value on attribute operator - * @return the attribute's value - */ - @Override - public String getOperatorImpl() { - return this.aOp.getOperatorImpl(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aOp.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aOp.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aOp.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aOp.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aOp.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aOp.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aOp.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aOp.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aOp.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aOp.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aOp.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aOp.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aOp.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aOp.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aOp.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aOp.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aOp.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aOp.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aOp.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aOp.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aOp.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aOp.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aOp.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aOp.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aOp.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aOp.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aOp.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aOp.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aOp.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aOp.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aOp.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aOp.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aOp.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aOp.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aOp.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aOp.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aOp.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aOp.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aOp.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aOp.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aOp.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aOp.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aOp.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aOp.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aOp.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aOp.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aOp.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aOp.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aOp.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aOp.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aOp.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aOp.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aOp.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aOp.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aOp.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aOp.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aOp.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aOp.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aOp.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aOp.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aOp.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aOp.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aOp.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aOp.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aOp.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aOp.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aOp.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aOp.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aOp.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aOp.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aOp.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aOp.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aOp.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aOp.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aOp.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aOp.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aOp.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aOp.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aOp.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aOp.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aOp.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aOp.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aOp.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aOp.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aOp.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aOp.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aOp.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aOp.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aOp); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "cond": - joinPointList = selectCond(); - break; - case "trueExpr": - joinPointList = selectTrueExpr(); - break; - case "falseExpr": - joinPointList = selectFalseExpr(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aOp.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "cond": { - if(value instanceof AExpression){ - this.defCondImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "falseExpr": { - if(value instanceof AExpression){ - this.defFalseExprImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "trueExpr": { - if(value instanceof AExpression){ - this.defTrueExprImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aOp.fillWithAttributes(attributes); - attributes.add("cond"); - attributes.add("falseExpr"); - attributes.add("trueExpr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aOp.fillWithSelects(selects); - selects.add("cond"); - selects.add("trueExpr"); - selects.add("falseExpr"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aOp.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "ternaryOp"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aOp.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TernaryOpAttributes { - COND("cond"), - FALSEEXPR("falseExpr"), - TRUEEXPR("trueExpr"), - ISBITWISE("isBitwise"), - KIND("kind"), - OPERATOR("operator"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TernaryOpAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TernaryOpAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AThis.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AThis.java deleted file mode 100644 index a4239821a3..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AThis.java +++ /dev/null @@ -1,1102 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AThis - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AThis extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AThis(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "this"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum ThisAttributes { - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private ThisAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(ThisAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AType.java deleted file mode 100644 index faa62a7989..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AType.java +++ /dev/null @@ -1,940 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.exception.ActionException; -import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AType extends ACxxWeaverJoinPoint { - - /** - * Get value on attribute arrayDims - * @return the attribute's value - */ - public abstract int[] getArrayDimsArrayImpl(); - - /** - * Get value on attribute arrayDims - * @return the attribute's value - */ - public Object getArrayDimsImpl() { - int[] intArrayImpl0 = getArrayDimsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(intArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute arrayDims - * @return the attribute's value - */ - public final Object getArrayDims() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "arrayDims", Optional.empty()); - } - Object result = this.getArrayDimsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "arrayDims", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "arrayDims", e); - } - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - public abstract Integer getArraySizeImpl(); - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - public final Object getArraySize() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "arraySize", Optional.empty()); - } - Integer result = this.getArraySizeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "arraySize", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "arraySize", e); - } - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - public abstract Boolean getConstantImpl(); - - /** - * Get value on attribute constant - * @return the attribute's value - */ - public final Object getConstant() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "constant", Optional.empty()); - } - Boolean result = this.getConstantImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "constant", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "constant", e); - } - } - - /** - * Single-step desugar. Returns the type itself if it does not have sugar - */ - public abstract AType getDesugarImpl(); - - /** - * Single-step desugar. Returns the type itself if it does not have sugar - */ - public final Object getDesugar() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "desugar", Optional.empty()); - } - AType result = this.getDesugarImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "desugar", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "desugar", e); - } - } - - /** - * - */ - public void defDesugarImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def desugar with type AType not implemented "); - } - - /** - * Completely desugars the type - */ - public abstract AType getDesugarAllImpl(); - - /** - * Completely desugars the type - */ - public final Object getDesugarAll() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "desugarAll", Optional.empty()); - } - AType result = this.getDesugarAllImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "desugarAll", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "desugarAll", e); - } - } - - /** - * A tree representation of the fields of this type - */ - public abstract String getFieldTreeImpl(); - - /** - * A tree representation of the fields of this type - */ - public final Object getFieldTree() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "fieldTree", Optional.empty()); - } - String result = this.getFieldTreeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "fieldTree", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "fieldTree", e); - } - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - public abstract Boolean getHasSugarImpl(); - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - public final Object getHasSugar() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasSugar", Optional.empty()); - } - Boolean result = this.getHasSugarImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasSugar", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasSugar", e); - } - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - public abstract Boolean getHasTemplateArgsImpl(); - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - public final Object getHasTemplateArgs() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasTemplateArgs", Optional.empty()); - } - Boolean result = this.getHasTemplateArgsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasTemplateArgs", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasTemplateArgs", e); - } - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - public abstract Boolean getIsArrayImpl(); - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - public final Object getIsArray() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isArray", Optional.empty()); - } - Boolean result = this.getIsArrayImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isArray", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isArray", e); - } - } - - /** - * True if this is a type declared with the 'auto' keyword - */ - public abstract Boolean getIsAutoImpl(); - - /** - * True if this is a type declared with the 'auto' keyword - */ - public final Object getIsAuto() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isAuto", Optional.empty()); - } - Boolean result = this.getIsAutoImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isAuto", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isAuto", e); - } - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - public abstract Boolean getIsBuiltinImpl(); - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - public final Object getIsBuiltin() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isBuiltin", Optional.empty()); - } - Boolean result = this.getIsBuiltinImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isBuiltin", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isBuiltin", e); - } - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - public abstract Boolean getIsPointerImpl(); - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - public final Object getIsPointer() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPointer", Optional.empty()); - } - Boolean result = this.getIsPointerImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPointer", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPointer", e); - } - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - public abstract Boolean getIsTopLevelImpl(); - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - public final Object getIsTopLevel() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isTopLevel", Optional.empty()); - } - Boolean result = this.getIsTopLevelImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isTopLevel", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isTopLevel", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Ignores certain types (e.g., DecayedType) - */ - public abstract AType getNormalizeImpl(); - - /** - * Ignores certain types (e.g., DecayedType) - */ - public final Object getNormalize() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "normalize", Optional.empty()); - } - AType result = this.getNormalizeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "normalize", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "normalize", e); - } - } - - /** - * Get value on attribute templateArgsStrings - * @return the attribute's value - */ - public abstract String[] getTemplateArgsStringsArrayImpl(); - - /** - * Get value on attribute templateArgsStrings - * @return the attribute's value - */ - public Object getTemplateArgsStringsImpl() { - String[] stringArrayImpl0 = getTemplateArgsStringsArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(stringArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute templateArgsStrings - * @return the attribute's value - */ - public final Object getTemplateArgsStrings() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "templateArgsStrings", Optional.empty()); - } - Object result = this.getTemplateArgsStringsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "templateArgsStrings", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "templateArgsStrings", e); - } - } - - /** - * Get value on attribute templateArgsTypes - * @return the attribute's value - */ - public abstract AType[] getTemplateArgsTypesArrayImpl(); - - /** - * Get value on attribute templateArgsTypes - * @return the attribute's value - */ - public Object getTemplateArgsTypesImpl() { - AType[] aTypeArrayImpl0 = getTemplateArgsTypesArrayImpl(); - Object nativeArray0 = getWeaverEngine().getScriptEngine().toNativeArray(aTypeArrayImpl0); - return nativeArray0; - } - - /** - * Get value on attribute templateArgsTypes - * @return the attribute's value - */ - public final Object getTemplateArgsTypes() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "templateArgsTypes", Optional.empty()); - } - Object result = this.getTemplateArgsTypesImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "templateArgsTypes", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "templateArgsTypes", e); - } - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def templateArgsTypes with type AType not implemented "); - } - - /** - * Maps names of join point fields that represent type join points, to their respective values - */ - public abstract Map getTypeFieldsImpl(); - - /** - * Maps names of join point fields that represent type join points, to their respective values - */ - public final Object getTypeFields() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "typeFields", Optional.empty()); - } - Map result = this.getTypeFieldsImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "typeFields", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "typeFields", e); - } - } - - /** - * If the type encapsulates another type, returns the encapsulated type - */ - public abstract AType getUnwrapImpl(); - - /** - * If the type encapsulates another type, returns the encapsulated type - */ - public final Object getUnwrap() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "unwrap", Optional.empty()); - } - AType result = this.getUnwrapImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "unwrap", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "unwrap", e); - } - } - - /** - * Returns a new node based on this type with the qualifier const - */ - public AType asConstImpl() { - throw new UnsupportedOperationException(get_class()+": Action asConst not implemented "); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - public final Object asConst() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "asConst", this, Optional.empty()); - } - AType result = this.asConstImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "asConst", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "asConst", e); - } - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - public void setDesugarImpl(AType desugaredType) { - throw new UnsupportedOperationException(get_class()+": Action setDesugar not implemented "); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - public final void setDesugar(AType desugaredType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setDesugar", this, Optional.empty(), desugaredType); - } - this.setDesugarImpl(desugaredType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setDesugar", this, Optional.empty(), desugaredType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setDesugar", e); - } - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - throw new UnsupportedOperationException(get_class()+": Action setTemplateArgType not implemented "); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - public final void setTemplateArgType(int index, AType templateArgType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setTemplateArgType", this, Optional.empty(), index, templateArgType); - } - this.setTemplateArgTypeImpl(index, templateArgType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setTemplateArgType", this, Optional.empty(), index, templateArgType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setTemplateArgType", e); - } - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - throw new UnsupportedOperationException(get_class()+": Action setTemplateArgsTypes not implemented "); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - public final void setTemplateArgsTypes(Object[] templateArgTypes) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setTemplateArgsTypes", this, Optional.empty(), new Object[] { templateArgTypes}); - } - this.setTemplateArgsTypesImpl(pt.up.fe.specs.util.SpecsCollections.cast(templateArgTypes, AType.class)); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setTemplateArgsTypes", this, Optional.empty(), new Object[] { templateArgTypes}); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setTemplateArgsTypes", e); - } - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - throw new UnsupportedOperationException(get_class()+": Action setTypeFieldByValueRecursive not implemented "); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - public final Object setTypeFieldByValueRecursive(Object currentValue, Object newValue) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setTypeFieldByValueRecursive", this, Optional.empty(), currentValue, newValue); - } - boolean result = this.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setTypeFieldByValueRecursive", this, Optional.ofNullable(result), currentValue, newValue); - } - return result; - } catch(Exception e) { - throw new ActionException(get_class(), "setTypeFieldByValueRecursive", e); - } - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - throw new UnsupportedOperationException(get_class()+": Action setUnderlyingType not implemented "); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - public final Object setUnderlyingType(AType oldValue, AType newValue) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setUnderlyingType", this, Optional.empty(), oldValue, newValue); - } - AType result = this.setUnderlyingTypeImpl(oldValue, newValue); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setUnderlyingType", this, Optional.ofNullable(result), oldValue, newValue); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "setUnderlyingType", e); - } - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = super.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - super.fillWithAttributes(attributes); - attributes.add("arrayDims"); - attributes.add("arraySize"); - attributes.add("constant"); - attributes.add("desugar"); - attributes.add("desugarAll"); - attributes.add("fieldTree"); - attributes.add("hasSugar"); - attributes.add("hasTemplateArgs"); - attributes.add("isArray"); - attributes.add("isAuto"); - attributes.add("isBuiltin"); - attributes.add("isPointer"); - attributes.add("isTopLevel"); - attributes.add("kind"); - attributes.add("normalize"); - attributes.add("templateArgsStrings"); - attributes.add("templateArgsTypes"); - attributes.add("typeFields"); - attributes.add("unwrap"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - super.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - super.fillWithActions(actions); - actions.add("type asConst()"); - actions.add("void setDesugar(type)"); - actions.add("void setTemplateArgType(int, type)"); - actions.add("void setTemplateArgsTypes(type[])"); - actions.add("boolean setTypeFieldByValueRecursive(Object, Object)"); - actions.add("type setUnderlyingType(type, type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "type"; - } - /** - * - */ - protected enum TypeAttributes { - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefDecl.java deleted file mode 100644 index fab53a0980..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefDecl.java +++ /dev/null @@ -1,1160 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATypedefDecl - * This class is overwritten by the Weaver Generator. - * - * Declaration of a typedef-name via the 'typedef' type specifier - * @author Lara Weaver Generator - */ -public abstract class ATypedefDecl extends ATypedefNameDecl { - - protected ATypedefNameDecl aTypedefNameDecl; - - /** - * - */ - public ATypedefDecl(ATypedefNameDecl aTypedefNameDecl){ - super(aTypedefNameDecl); - this.aTypedefNameDecl = aTypedefNameDecl; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aTypedefNameDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aTypedefNameDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aTypedefNameDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aTypedefNameDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aTypedefNameDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aTypedefNameDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aTypedefNameDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aTypedefNameDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aTypedefNameDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aTypedefNameDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aTypedefNameDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aTypedefNameDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aTypedefNameDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aTypedefNameDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aTypedefNameDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aTypedefNameDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aTypedefNameDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aTypedefNameDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aTypedefNameDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aTypedefNameDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aTypedefNameDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aTypedefNameDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aTypedefNameDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aTypedefNameDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aTypedefNameDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aTypedefNameDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aTypedefNameDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aTypedefNameDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aTypedefNameDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aTypedefNameDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aTypedefNameDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aTypedefNameDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aTypedefNameDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aTypedefNameDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aTypedefNameDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aTypedefNameDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aTypedefNameDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aTypedefNameDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aTypedefNameDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aTypedefNameDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aTypedefNameDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aTypedefNameDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aTypedefNameDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aTypedefNameDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aTypedefNameDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aTypedefNameDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aTypedefNameDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aTypedefNameDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aTypedefNameDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aTypedefNameDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aTypedefNameDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aTypedefNameDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aTypedefNameDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aTypedefNameDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aTypedefNameDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aTypedefNameDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aTypedefNameDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aTypedefNameDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aTypedefNameDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aTypedefNameDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aTypedefNameDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aTypedefNameDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aTypedefNameDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aTypedefNameDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aTypedefNameDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aTypedefNameDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aTypedefNameDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aTypedefNameDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aTypedefNameDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aTypedefNameDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aTypedefNameDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aTypedefNameDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aTypedefNameDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aTypedefNameDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aTypedefNameDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aTypedefNameDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aTypedefNameDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aTypedefNameDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aTypedefNameDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aTypedefNameDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aTypedefNameDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aTypedefNameDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aTypedefNameDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aTypedefNameDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aTypedefNameDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aTypedefNameDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aTypedefNameDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aTypedefNameDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aTypedefNameDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aTypedefNameDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aTypedefNameDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aTypedefNameDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aTypedefNameDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aTypedefNameDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aTypedefNameDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aTypedefNameDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aTypedefNameDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aTypedefNameDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aTypedefNameDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aTypedefNameDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aTypedefNameDecl); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aTypedefNameDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aTypedefNameDecl.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aTypedefNameDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aTypedefNameDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "typedefDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aTypedefNameDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TypedefDeclAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TypedefDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TypedefDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefNameDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefNameDecl.java deleted file mode 100644 index eb9a2ed1ab..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefNameDecl.java +++ /dev/null @@ -1,1160 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATypedefNameDecl - * This class is overwritten by the Weaver Generator. - * - * Base node for declarations which introduce a typedef-name - * @author Lara Weaver Generator - */ -public abstract class ATypedefNameDecl extends ANamedDecl { - - protected ANamedDecl aNamedDecl; - - /** - * - */ - public ATypedefNameDecl(ANamedDecl aNamedDecl){ - super(aNamedDecl); - this.aNamedDecl = aNamedDecl; - } - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aNamedDecl.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aNamedDecl.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aNamedDecl.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aNamedDecl.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aNamedDecl.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aNamedDecl.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aNamedDecl.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aNamedDecl.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aNamedDecl.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aNamedDecl.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aNamedDecl.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aNamedDecl.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aNamedDecl.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aNamedDecl.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aNamedDecl.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aNamedDecl.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aNamedDecl.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aNamedDecl.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aNamedDecl.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aNamedDecl.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aNamedDecl.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aNamedDecl.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aNamedDecl.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aNamedDecl.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aNamedDecl.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aNamedDecl.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aNamedDecl.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aNamedDecl.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aNamedDecl.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aNamedDecl.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aNamedDecl.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aNamedDecl.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aNamedDecl.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aNamedDecl.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aNamedDecl.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aNamedDecl.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aNamedDecl.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aNamedDecl.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aNamedDecl.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aNamedDecl.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aNamedDecl.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aNamedDecl.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aNamedDecl.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aNamedDecl.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aNamedDecl.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aNamedDecl.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aNamedDecl.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aNamedDecl.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aNamedDecl.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aNamedDecl.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aNamedDecl.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aNamedDecl.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aNamedDecl.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aNamedDecl.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aNamedDecl.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aNamedDecl.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aNamedDecl.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aNamedDecl.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aNamedDecl.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aNamedDecl.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aNamedDecl.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aNamedDecl.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aNamedDecl.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aNamedDecl.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aNamedDecl.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aNamedDecl.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aNamedDecl.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aNamedDecl.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aNamedDecl.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aNamedDecl.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aNamedDecl.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aNamedDecl.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aNamedDecl.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aNamedDecl.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aNamedDecl.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aNamedDecl.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aNamedDecl.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aNamedDecl.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aNamedDecl.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aNamedDecl.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aNamedDecl.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aNamedDecl.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aNamedDecl.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aNamedDecl.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aNamedDecl.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aNamedDecl.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aNamedDecl.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aNamedDecl.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aNamedDecl.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aNamedDecl.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aNamedDecl.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aNamedDecl.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aNamedDecl.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aNamedDecl.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aNamedDecl.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aNamedDecl); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aNamedDecl.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aNamedDecl.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aNamedDecl.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aNamedDecl.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "typedefNameDecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aNamedDecl.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TypedefNameDeclAttributes { - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TypedefNameDeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TypedefNameDeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefType.java deleted file mode 100644 index 0aed931241..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/ATypedefType.java +++ /dev/null @@ -1,1366 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point ATypedefType - * This class is overwritten by the Weaver Generator. - * - * Represents the type of a typedef. - * @author Lara Weaver Generator - */ -public abstract class ATypedefType extends AType { - - protected AType aType; - - /** - * - */ - public ATypedefType(AType aType){ - this.aType = aType; - } - /** - * the typedef declaration associated with this typedef type - */ - public abstract ATypedefNameDecl getDeclImpl(); - - /** - * the typedef declaration associated with this typedef type - */ - public final Object getDecl() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "decl", Optional.empty()); - } - ATypedefNameDecl result = this.getDeclImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "decl", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "decl", e); - } - } - - /** - * the type that is being typedef'd - */ - public abstract AType getUnderlyingTypeImpl(); - - /** - * the type that is being typedef'd - */ - public final Object getUnderlyingType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "underlyingType", Optional.empty()); - } - AType result = this.getUnderlyingTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "underlyingType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "underlyingType", e); - } - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - attributes.add("decl"); - attributes.add("underlyingType"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "typedefType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum TypedefTypeAttributes { - DECL("decl"), - UNDERLYINGTYPE("underlyingType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private TypedefTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(TypedefTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryExprOrType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryExprOrType.java deleted file mode 100644 index 158400bc8a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryExprOrType.java +++ /dev/null @@ -1,1281 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AUnaryExprOrType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AUnaryExprOrType extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AUnaryExprOrType(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute argExpr - * @return the attribute's value - */ - public abstract AExpression getArgExprImpl(); - - /** - * Get value on attribute argExpr - * @return the attribute's value - */ - public final Object getArgExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "argExpr", Optional.empty()); - } - AExpression result = this.getArgExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "argExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "argExpr", e); - } - } - - /** - * Get value on attribute argType - * @return the attribute's value - */ - public abstract AType getArgTypeImpl(); - - /** - * Get value on attribute argType - * @return the attribute's value - */ - public final Object getArgType() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "argType", Optional.empty()); - } - AType result = this.getArgTypeImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "argType", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "argType", e); - } - } - - /** - * - */ - public void defArgTypeImpl(AType value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def argType with type AType not implemented "); - } - - /** - * Get value on attribute hasArgExpr - * @return the attribute's value - */ - public abstract Boolean getHasArgExprImpl(); - - /** - * Get value on attribute hasArgExpr - * @return the attribute's value - */ - public final Object getHasArgExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasArgExpr", Optional.empty()); - } - Boolean result = this.getHasArgExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasArgExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasArgExpr", e); - } - } - - /** - * Get value on attribute hasTypeExpr - * @return the attribute's value - */ - public abstract Boolean getHasTypeExprImpl(); - - /** - * Get value on attribute hasTypeExpr - * @return the attribute's value - */ - public final Object getHasTypeExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasTypeExpr", Optional.empty()); - } - Boolean result = this.getHasTypeExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasTypeExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasTypeExpr", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * - * @param argType - */ - public void setArgTypeImpl(AType argType) { - throw new UnsupportedOperationException(get_class()+": Action setArgType not implemented "); - } - - /** - * - * @param argType - */ - public final void setArgType(AType argType) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setArgType", this, Optional.empty(), argType); - } - this.setArgTypeImpl(argType); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setArgType", this, Optional.empty(), argType); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setArgType", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "argType": { - if(value instanceof AType){ - this.defArgTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("argExpr"); - attributes.add("argType"); - attributes.add("hasArgExpr"); - attributes.add("hasTypeExpr"); - attributes.add("kind"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - actions.add("void setArgType(type)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "unaryExprOrType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum UnaryExprOrTypeAttributes { - ARGEXPR("argExpr"), - ARGTYPE("argType"), - HASARGEXPR("hasArgExpr"), - HASTYPEEXPR("hasTypeExpr"), - KIND("kind"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private UnaryExprOrTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(UnaryExprOrTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java deleted file mode 100644 index f713ed0c8a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUnaryOp.java +++ /dev/null @@ -1,1202 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AUnaryOp - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AUnaryOp extends AOp { - - protected AOp aOp; - - /** - * - */ - public AUnaryOp(AOp aOp){ - super(aOp); - this.aOp = aOp; - } - /** - * Get value on attribute isPointerDeref - * @return the attribute's value - */ - public abstract Boolean getIsPointerDerefImpl(); - - /** - * Get value on attribute isPointerDeref - * @return the attribute's value - */ - public final Object getIsPointerDeref() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isPointerDeref", Optional.empty()); - } - Boolean result = this.getIsPointerDerefImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isPointerDeref", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isPointerDeref", e); - } - } - - /** - * Get value on attribute operand - * @return the attribute's value - */ - public abstract AExpression getOperandImpl(); - - /** - * Get value on attribute operand - * @return the attribute's value - */ - public final Object getOperand() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "operand", Optional.empty()); - } - AExpression result = this.getOperandImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "operand", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "operand", e); - } - } - - /** - * Default implementation of the method used by the lara interpreter to select operands - * @return - */ - public List selectOperand() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * Get value on attribute isBitwise - * @return the attribute's value - */ - @Override - public Boolean getIsBitwiseImpl() { - return this.aOp.getIsBitwiseImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aOp.getKindImpl(); - } - - /** - * Get value on attribute operator - * @return the attribute's value - */ - @Override - public String getOperatorImpl() { - return this.aOp.getOperatorImpl(); - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aOp.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aOp.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aOp.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aOp.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aOp.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aOp.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aOp.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aOp.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aOp.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aOp.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aOp.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aOp.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aOp.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aOp.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aOp.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aOp.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aOp.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aOp.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aOp.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aOp.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aOp.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aOp.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aOp.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aOp.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aOp.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aOp.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aOp.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aOp.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aOp.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aOp.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aOp.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aOp.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aOp.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aOp.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aOp.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aOp.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aOp.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aOp.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aOp.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aOp.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aOp.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aOp.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aOp.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aOp.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aOp.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aOp.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aOp.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aOp.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aOp.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aOp.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aOp.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aOp.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aOp.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aOp.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aOp.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aOp.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aOp.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aOp.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aOp.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aOp.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aOp.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aOp.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aOp.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aOp.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aOp.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aOp.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aOp.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aOp.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aOp.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aOp.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aOp.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aOp.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aOp.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aOp.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aOp.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aOp.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aOp.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aOp.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aOp.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aOp.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aOp.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aOp.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aOp.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aOp.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aOp.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aOp.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aOp.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aOp.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aOp.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aOp.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aOp.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aOp); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "operand": - joinPointList = selectOperand(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aOp.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aOp.fillWithAttributes(attributes); - attributes.add("isPointerDeref"); - attributes.add("operand"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aOp.fillWithSelects(selects); - selects.add("operand"); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aOp.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "unaryOp"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aOp.instanceOf(joinpointClass); - } - /** - * - */ - protected enum UnaryOpAttributes { - ISPOINTERDEREF("isPointerDeref"), - OPERAND("operand"), - ISBITWISE("isBitwise"), - KIND("kind"), - OPERATOR("operator"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private UnaryOpAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(UnaryOpAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUndefinedType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUndefinedType.java deleted file mode 100644 index 32a10ea073..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AUndefinedType.java +++ /dev/null @@ -1,1314 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Optional; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AUndefinedType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AUndefinedType extends AType { - - protected AType aType; - - /** - * - */ - public AUndefinedType(AType aType){ - this.aType = aType; - } - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aType.defTemplateArgsTypesImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aType.setDesugarImpl(desugaredType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aType.fillWithAttributes(attributes); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aType.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "undefinedType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum UndefinedTypeAttributes { - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private UndefinedTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(UndefinedTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVardecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVardecl.java deleted file mode 100644 index af9e390e27..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVardecl.java +++ /dev/null @@ -1,1499 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.SelectOp; -import org.lara.interpreter.exception.ActionException; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AVardecl - * This class is overwritten by the Weaver Generator. - * - * Represents a variable declaration or definition - * @author Lara Weaver Generator - */ -public abstract class AVardecl extends ADeclarator { - - protected ADeclarator aDeclarator; - - /** - * - */ - public AVardecl(ADeclarator aDeclarator){ - super(aDeclarator); - this.aDeclarator = aDeclarator; - } - /** - * The vardecl corresponding to the actual definition. For global variables, returns the vardecl of the file where it is actually defined (instead of the vardecl that defines an external link to the variable) - */ - public abstract AVardecl getDefinitionImpl(); - - /** - * The vardecl corresponding to the actual definition. For global variables, returns the vardecl of the file where it is actually defined (instead of the vardecl that defines an external link to the variable) - */ - public final Object getDefinition() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "definition", Optional.empty()); - } - AVardecl result = this.getDefinitionImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "definition", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "definition", e); - } - } - - /** - * true, if vardecl has an initialization value - */ - public abstract Boolean getHasInitImpl(); - - /** - * true, if vardecl has an initialization value - */ - public final Object getHasInit() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasInit", Optional.empty()); - } - Boolean result = this.getHasInitImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasInit", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasInit", e); - } - } - - /** - * If vardecl has an initialization value, returns an expression with that value - */ - public abstract AExpression getInitImpl(); - - /** - * If vardecl has an initialization value, returns an expression with that value - */ - public final Object getInit() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "init", Optional.empty()); - } - AExpression result = this.getInitImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "init", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "init", e); - } - } - - /** - * The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit - */ - public abstract String getInitStyleImpl(); - - /** - * The initialization style of this vardecl, which can be no_init, cinit, callinit, listinit - */ - public final Object getInitStyle() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "initStyle", Optional.empty()); - } - String result = this.getInitStyleImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "initStyle", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "initStyle", e); - } - } - - /** - * true, if this variable does not have local storage. This includes all global variables as well as static variables declared within a function. - */ - public abstract Boolean getIsGlobalImpl(); - - /** - * true, if this variable does not have local storage. This includes all global variables as well as static variables declared within a function. - */ - public final Object getIsGlobal() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isGlobal", Optional.empty()); - } - Boolean result = this.getIsGlobalImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isGlobal", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isGlobal", e); - } - } - - /** - * true, if vardecl is a function parameter - */ - public abstract Boolean getIsParamImpl(); - - /** - * true, if vardecl is a function parameter - */ - public final Object getIsParam() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isParam", Optional.empty()); - } - Boolean result = this.getIsParamImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isParam", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isParam", e); - } - } - - /** - * Storage class specifier, which can be none, extern, static, __private_extern__, auto, register - */ - public abstract String getStorageClassImpl(); - - /** - * Storage class specifier, which can be none, extern, static, __private_extern__, auto, register - */ - public final Object getStorageClass() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "storageClass", Optional.empty()); - } - String result = this.getStorageClassImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "storageClass", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "storageClass", e); - } - } - - /** - * - */ - public void defStorageClassImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def storageClass with type String not implemented "); - } - - /** - * Default implementation of the method used by the lara interpreter to select inits - * @return - */ - public List selectInit() { - return select(pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression.class, SelectOp.DESCENDANTS); - } - - /** - * If vardecl already has an initialization, removes it. - * @param removeConst - */ - public void removeInitImpl(boolean removeConst) { - throw new UnsupportedOperationException(get_class()+": Action removeInit not implemented "); - } - - /** - * If vardecl already has an initialization, removes it. - * @param removeConst - */ - public final void removeInit(boolean removeConst) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "removeInit", this, Optional.empty(), removeConst); - } - this.removeInitImpl(removeConst); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "removeInit", this, Optional.empty(), removeConst); - } - } catch(Exception e) { - throw new ActionException(get_class(), "removeInit", e); - } - } - - /** - * Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - public void setInitImpl(AExpression init) { - throw new UnsupportedOperationException(get_class()+": Action setInit not implemented "); - } - - /** - * Sets the given expression as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - public final void setInit(AExpression init) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInit", this, Optional.empty(), init); - } - this.setInitImpl(init); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInit", this, Optional.empty(), init); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInit", e); - } - } - - /** - * Converts the given string to a literal expression and sets it as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - public void setInitImpl(String init) { - throw new UnsupportedOperationException(get_class()+": Action setInit not implemented "); - } - - /** - * Converts the given string to a literal expression and sets it as the initialization of this vardecl. If undefined is passed and vardecl already has an initialization, removes that initialization - * @param init - */ - public final void setInit(String init) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setInit", this, Optional.empty(), init); - } - this.setInitImpl(init); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setInit", this, Optional.empty(), init); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setInit", e); - } - } - - /** - * Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl - * @param storageClass - */ - public void setStorageClassImpl(String storageClass) { - throw new UnsupportedOperationException(get_class()+": Action setStorageClass not implemented "); - } - - /** - * Sets the storage class specifier, which can be none, extern, static, __private_extern__, autovardecl - * @param storageClass - */ - public final void setStorageClass(String storageClass) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setStorageClass", this, Optional.empty(), storageClass); - } - this.setStorageClassImpl(storageClass); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setStorageClass", this, Optional.empty(), storageClass); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setStorageClass", e); - } - } - - /** - * Creates a new varref based on this vardecl - */ - public AVarref varrefImpl() { - throw new UnsupportedOperationException(get_class()+": Action varref not implemented "); - } - - /** - * Creates a new varref based on this vardecl - */ - public final Object varref() { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "varref", this, Optional.empty()); - } - AVarref result = this.varrefImpl(); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "varref", this, Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new ActionException(get_class(), "varref", e); - } - } - - /** - * Get value on attribute isPublic - * @return the attribute's value - */ - @Override - public Boolean getIsPublicImpl() { - return this.aDeclarator.getIsPublicImpl(); - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - @Override - public String getNameImpl() { - return this.aDeclarator.getNameImpl(); - } - - /** - * Get value on attribute qualifiedName - * @return the attribute's value - */ - @Override - public String getQualifiedNameImpl() { - return this.aDeclarator.getQualifiedNameImpl(); - } - - /** - * Get value on attribute qualifiedPrefix - * @return the attribute's value - */ - @Override - public String getQualifiedPrefixImpl() { - return this.aDeclarator.getQualifiedPrefixImpl(); - } - - /** - * Get value on attribute attrsArrayImpl - * @return the attribute's value - */ - @Override - public AAttribute[] getAttrsArrayImpl() { - return this.aDeclarator.getAttrsArrayImpl(); - } - - /** - * - */ - public void defNameImpl(String value) { - this.aDeclarator.defNameImpl(value); - } - - /** - * - */ - public void defQualifiedNameImpl(String value) { - this.aDeclarator.defQualifiedNameImpl(value); - } - - /** - * - */ - public void defQualifiedPrefixImpl(String value) { - this.aDeclarator.defQualifiedPrefixImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aDeclarator.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aDeclarator.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aDeclarator.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aDeclarator.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aDeclarator.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aDeclarator.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aDeclarator.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aDeclarator.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aDeclarator.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aDeclarator.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aDeclarator.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aDeclarator.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aDeclarator.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aDeclarator.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aDeclarator.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aDeclarator.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aDeclarator.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aDeclarator.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aDeclarator.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aDeclarator.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aDeclarator.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aDeclarator.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aDeclarator.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aDeclarator.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aDeclarator.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aDeclarator.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aDeclarator.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aDeclarator.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aDeclarator.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aDeclarator.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aDeclarator.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aDeclarator.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aDeclarator.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aDeclarator.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aDeclarator.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aDeclarator.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aDeclarator.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aDeclarator.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aDeclarator.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aDeclarator.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aDeclarator.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aDeclarator.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aDeclarator.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aDeclarator.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aDeclarator.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aDeclarator.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aDeclarator.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aDeclarator.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aDeclarator.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aDeclarator.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aDeclarator.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aDeclarator.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aDeclarator.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aDeclarator.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aDeclarator.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aDeclarator.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aDeclarator.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aDeclarator.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aDeclarator.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aDeclarator.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aDeclarator.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aDeclarator.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aDeclarator.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aDeclarator.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aDeclarator.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aDeclarator.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aDeclarator.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aDeclarator.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aDeclarator.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aDeclarator.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aDeclarator.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aDeclarator.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aDeclarator.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aDeclarator.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aDeclarator.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aDeclarator.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aDeclarator.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aDeclarator.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aDeclarator.setLastChildImpl(node); - } - - /** - * Sets the name of this namedDecl - * @param name - */ - @Override - public void setNameImpl(String name) { - this.aDeclarator.setNameImpl(name); - } - - /** - * Sets the qualified name of this namedDecl (changes both the name and qualified prefix) - * @param name - */ - @Override - public void setQualifiedNameImpl(String name) { - this.aDeclarator.setQualifiedNameImpl(name); - } - - /** - * Sets the qualified prefix of this namedDecl - * @param qualifiedPrefix - */ - @Override - public void setQualifiedPrefixImpl(String qualifiedPrefix) { - this.aDeclarator.setQualifiedPrefixImpl(qualifiedPrefix); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aDeclarator.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aDeclarator.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aDeclarator.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aDeclarator.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aDeclarator.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aDeclarator); - } - - /** - * - */ - @Override - public List select(String selectName) { - List joinPointList; - switch(selectName) { - case "init": - joinPointList = selectInit(); - break; - default: - joinPointList = this.aDeclarator.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public void defImpl(String attribute, Object value) { - switch(attribute){ - case "storageClass": { - if(value instanceof String){ - this.defStorageClassImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedName": { - if(value instanceof String){ - this.defQualifiedNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "qualifiedPrefix": { - if(value instanceof String){ - this.defQualifiedPrefixImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected void fillWithAttributes(List attributes) { - this.aDeclarator.fillWithAttributes(attributes); - attributes.add("definition"); - attributes.add("hasInit"); - attributes.add("init"); - attributes.add("initStyle"); - attributes.add("isGlobal"); - attributes.add("isParam"); - attributes.add("storageClass"); - } - - /** - * - */ - @Override - protected void fillWithSelects(List selects) { - this.aDeclarator.fillWithSelects(selects); - selects.add("init"); - } - - /** - * - */ - @Override - protected void fillWithActions(List actions) { - this.aDeclarator.fillWithActions(actions); - actions.add("void removeInit(boolean)"); - actions.add("void setInit(expression)"); - actions.add("void setInit(String)"); - actions.add("void setStorageClass(StorageClass)"); - actions.add("varref varref()"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public String get_class() { - return "vardecl"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aDeclarator.instanceOf(joinpointClass); - } - /** - * - */ - protected enum VardeclAttributes { - DEFINITION("definition"), - HASINIT("hasInit"), - INIT("init"), - INITSTYLE("initStyle"), - ISGLOBAL("isGlobal"), - ISPARAM("isParam"), - STORAGECLASS("storageClass"), - ISPUBLIC("isPublic"), - NAME("name"), - QUALIFIEDNAME("qualifiedName"), - QUALIFIEDPREFIX("qualifiedPrefix"), - ATTRS("attrs"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private VardeclAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(VardeclAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVariableArrayType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVariableArrayType.java deleted file mode 100644 index 55751f6c64..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVariableArrayType.java +++ /dev/null @@ -1,1419 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.Map; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.List; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AVariableArrayType - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AVariableArrayType extends AArrayType { - - protected AArrayType aArrayType; - - /** - * - */ - public AVariableArrayType(AArrayType aArrayType){ - super(aArrayType); - this.aArrayType = aArrayType; - } - /** - * Get value on attribute sizeExpr - * @return the attribute's value - */ - public abstract AExpression getSizeExprImpl(); - - /** - * Get value on attribute sizeExpr - * @return the attribute's value - */ - public final Object getSizeExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "sizeExpr", Optional.empty()); - } - AExpression result = this.getSizeExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "sizeExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "sizeExpr", e); - } - } - - /** - * - */ - public void defSizeExprImpl(AExpression value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def sizeExpr with type AExpression not implemented "); - } - - /** - * Sets the size expression of this variable array type - * @param sizeExpr - */ - public void setSizeExprImpl(AExpression sizeExpr) { - throw new UnsupportedOperationException(get_class()+": Action setSizeExpr not implemented "); - } - - /** - * Sets the size expression of this variable array type - * @param sizeExpr - */ - public final void setSizeExpr(AExpression sizeExpr) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setSizeExpr", this, Optional.empty(), sizeExpr); - } - this.setSizeExprImpl(sizeExpr); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setSizeExpr", this, Optional.empty(), sizeExpr); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setSizeExpr", e); - } - } - - /** - * Get value on attribute elementType - * @return the attribute's value - */ - @Override - public AType getElementTypeImpl() { - return this.aArrayType.getElementTypeImpl(); - } - - /** - * Get value on attribute arrayDimsArrayImpl - * @return the attribute's value - */ - @Override - public int[] getArrayDimsArrayImpl() { - return this.aArrayType.getArrayDimsArrayImpl(); - } - - /** - * Get value on attribute arraySize - * @return the attribute's value - */ - @Override - public Integer getArraySizeImpl() { - return this.aArrayType.getArraySizeImpl(); - } - - /** - * Get value on attribute constant - * @return the attribute's value - */ - @Override - public Boolean getConstantImpl() { - return this.aArrayType.getConstantImpl(); - } - - /** - * Get value on attribute desugar - * @return the attribute's value - */ - @Override - public AType getDesugarImpl() { - return this.aArrayType.getDesugarImpl(); - } - - /** - * Get value on attribute desugarAll - * @return the attribute's value - */ - @Override - public AType getDesugarAllImpl() { - return this.aArrayType.getDesugarAllImpl(); - } - - /** - * Get value on attribute fieldTree - * @return the attribute's value - */ - @Override - public String getFieldTreeImpl() { - return this.aArrayType.getFieldTreeImpl(); - } - - /** - * Get value on attribute hasSugar - * @return the attribute's value - */ - @Override - public Boolean getHasSugarImpl() { - return this.aArrayType.getHasSugarImpl(); - } - - /** - * Get value on attribute hasTemplateArgs - * @return the attribute's value - */ - @Override - public Boolean getHasTemplateArgsImpl() { - return this.aArrayType.getHasTemplateArgsImpl(); - } - - /** - * Get value on attribute isArray - * @return the attribute's value - */ - @Override - public Boolean getIsArrayImpl() { - return this.aArrayType.getIsArrayImpl(); - } - - /** - * Get value on attribute isAuto - * @return the attribute's value - */ - @Override - public Boolean getIsAutoImpl() { - return this.aArrayType.getIsAutoImpl(); - } - - /** - * Get value on attribute isBuiltin - * @return the attribute's value - */ - @Override - public Boolean getIsBuiltinImpl() { - return this.aArrayType.getIsBuiltinImpl(); - } - - /** - * Get value on attribute isPointer - * @return the attribute's value - */ - @Override - public Boolean getIsPointerImpl() { - return this.aArrayType.getIsPointerImpl(); - } - - /** - * Get value on attribute isTopLevel - * @return the attribute's value - */ - @Override - public Boolean getIsTopLevelImpl() { - return this.aArrayType.getIsTopLevelImpl(); - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - @Override - public String getKindImpl() { - return this.aArrayType.getKindImpl(); - } - - /** - * Get value on attribute normalize - * @return the attribute's value - */ - @Override - public AType getNormalizeImpl() { - return this.aArrayType.getNormalizeImpl(); - } - - /** - * Get value on attribute templateArgsStringsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getTemplateArgsStringsArrayImpl() { - return this.aArrayType.getTemplateArgsStringsArrayImpl(); - } - - /** - * Get value on attribute templateArgsTypesArrayImpl - * @return the attribute's value - */ - @Override - public AType[] getTemplateArgsTypesArrayImpl() { - return this.aArrayType.getTemplateArgsTypesArrayImpl(); - } - - /** - * Get value on attribute typeFields - * @return the attribute's value - */ - @Override - public Map getTypeFieldsImpl() { - return this.aArrayType.getTypeFieldsImpl(); - } - - /** - * Get value on attribute unwrap - * @return the attribute's value - */ - @Override - public AType getUnwrapImpl() { - return this.aArrayType.getUnwrapImpl(); - } - - /** - * - */ - public void defDesugarImpl(AType value) { - this.aArrayType.defDesugarImpl(value); - } - - /** - * - */ - public void defTemplateArgsTypesImpl(AType[] value) { - this.aArrayType.defTemplateArgsTypesImpl(value); - } - - /** - * - */ - public void defElementTypeImpl(AType value) { - this.aArrayType.defElementTypeImpl(value); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aArrayType.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aArrayType.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aArrayType.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aArrayType.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aArrayType.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aArrayType.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aArrayType.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aArrayType.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aArrayType.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aArrayType.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aArrayType.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aArrayType.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aArrayType.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aArrayType.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aArrayType.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aArrayType.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aArrayType.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aArrayType.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aArrayType.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aArrayType.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aArrayType.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aArrayType.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aArrayType.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aArrayType.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aArrayType.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aArrayType.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aArrayType.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aArrayType.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aArrayType.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aArrayType.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aArrayType.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aArrayType.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aArrayType.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aArrayType.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aArrayType.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aArrayType.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aArrayType.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aArrayType.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aArrayType.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aArrayType.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aArrayType.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aArrayType.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aArrayType.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aArrayType.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aArrayType.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aArrayType.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aArrayType.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aArrayType.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aArrayType.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aArrayType.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aArrayType.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aArrayType.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aArrayType.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aArrayType.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aArrayType.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aArrayType.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aArrayType.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aArrayType.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aArrayType.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aArrayType.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aArrayType.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aArrayType.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aArrayType.getTypeImpl(); - } - - /** - * Returns a new node based on this type with the qualifier const - */ - @Override - public AType asConstImpl() { - return this.aArrayType.asConstImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aArrayType.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aArrayType.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aArrayType.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aArrayType.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aArrayType.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aArrayType.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aArrayType.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aArrayType.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aArrayType.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aArrayType.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aArrayType.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aArrayType.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aArrayType.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aArrayType.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aArrayType.setDataImpl(source); - } - - /** - * Sets the desugared type of this type - * @param desugaredType - */ - @Override - public void setDesugarImpl(AType desugaredType) { - this.aArrayType.setDesugarImpl(desugaredType); - } - - /** - * Sets the element type of the array - * @param arrayElementType - */ - @Override - public void setElementTypeImpl(AType arrayElementType) { - this.aArrayType.setElementTypeImpl(arrayElementType); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aArrayType.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aArrayType.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aArrayType.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aArrayType.setLastChildImpl(node); - } - - /** - * Sets a single template argument type of a template type - * @param index - * @param templateArgType - */ - @Override - public void setTemplateArgTypeImpl(int index, AType templateArgType) { - this.aArrayType.setTemplateArgTypeImpl(index, templateArgType); - } - - /** - * Sets the template argument types of a template type - * @param templateArgTypes - */ - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - this.aArrayType.setTemplateArgsTypesImpl(templateArgTypes); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aArrayType.setTypeImpl(type); - } - - /** - * Changes a single occurence of a type field that has the current value with new value. Returns true if there was a change - * @param currentValue - * @param newValue - */ - @Override - public boolean setTypeFieldByValueRecursiveImpl(Object currentValue, Object newValue) { - return this.aArrayType.setTypeFieldByValueRecursiveImpl(currentValue, newValue); - } - - /** - * Replaces an underlying type of this instance with new type, if it matches the old type. Returns true if there were changes - * @param oldValue - * @param newValue - */ - @Override - public AType setUnderlyingTypeImpl(AType oldValue, AType newValue) { - return this.aArrayType.setUnderlyingTypeImpl(oldValue, newValue); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aArrayType.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aArrayType.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aArrayType.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aArrayType.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aArrayType); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - default: - joinPointList = this.aArrayType.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "sizeExpr": { - if(value instanceof AExpression){ - this.defSizeExprImpl((AExpression)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "elementType": { - if(value instanceof AType){ - this.defElementTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "desugar": { - if(value instanceof AType){ - this.defDesugarImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "templateArgsTypes": { - if(value instanceof AType[]){ - this.defTemplateArgsTypesImpl((AType[])value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aArrayType.fillWithAttributes(attributes); - attributes.add("sizeExpr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aArrayType.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aArrayType.fillWithActions(actions); - actions.add("void setSizeExpr(expression)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "variableArrayType"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aArrayType.instanceOf(joinpointClass); - } - /** - * - */ - protected enum VariableArrayTypeAttributes { - SIZEEXPR("sizeExpr"), - ELEMENTTYPE("elementType"), - ARRAYDIMS("arrayDims"), - ARRAYSIZE("arraySize"), - CONSTANT("constant"), - DESUGAR("desugar"), - DESUGARALL("desugarAll"), - FIELDTREE("fieldTree"), - HASSUGAR("hasSugar"), - HASTEMPLATEARGS("hasTemplateArgs"), - ISARRAY("isArray"), - ISAUTO("isAuto"), - ISBUILTIN("isBuiltin"), - ISPOINTER("isPointer"), - ISTOPLEVEL("isTopLevel"), - KIND("kind"), - NORMALIZE("normalize"), - TEMPLATEARGSSTRINGS("templateArgsStrings"), - TEMPLATEARGSTYPES("templateArgsTypes"), - TYPEFIELDS("typeFields"), - UNWRAP("unwrap"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private VariableArrayTypeAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(VariableArrayTypeAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVarref.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVarref.java deleted file mode 100644 index 74c42f3211..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AVarref.java +++ /dev/null @@ -1,1327 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import org.lara.interpreter.exception.ActionException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AVarref - * This class is overwritten by the Weaver Generator. - * - * A reference to a variable - * @author Lara Weaver Generator - */ -public abstract class AVarref extends AExpression { - - protected AExpression aExpression; - - /** - * - */ - public AVarref(AExpression aExpression){ - this.aExpression = aExpression; - } - /** - * Get value on attribute declaration - * @return the attribute's value - */ - public abstract ADeclarator getDeclarationImpl(); - - /** - * Get value on attribute declaration - * @return the attribute's value - */ - public final Object getDeclaration() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "declaration", Optional.empty()); - } - ADeclarator result = this.getDeclarationImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "declaration", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "declaration", e); - } - } - - /** - * true if this variable reference has a MS-style property, false otherwise - */ - public abstract Boolean getHasPropertyImpl(); - - /** - * true if this variable reference has a MS-style property, false otherwise - */ - public final Object getHasProperty() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "hasProperty", Optional.empty()); - } - Boolean result = this.getHasPropertyImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "hasProperty", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "hasProperty", e); - } - } - - /** - * true if this varref represents a function call - */ - public abstract Boolean getIsFunctionCallImpl(); - - /** - * true if this varref represents a function call - */ - public final Object getIsFunctionCall() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "isFunctionCall", Optional.empty()); - } - Boolean result = this.getIsFunctionCallImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "isFunctionCall", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "isFunctionCall", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute name - * @return the attribute's value - */ - public abstract String getNameImpl(); - - /** - * Get value on attribute name - * @return the attribute's value - */ - public final Object getName() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "name", Optional.empty()); - } - String result = this.getNameImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "name", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "name", e); - } - } - - /** - * - */ - public void defNameImpl(String value) { - throw new UnsupportedOperationException("Join point "+get_class()+": Action def name with type String not implemented "); - } - - /** - * if this variable reference has a MS-style property, returns the property name. Returns undefined otherwise - */ - public abstract String getPropertyImpl(); - - /** - * if this variable reference has a MS-style property, returns the property name. Returns undefined otherwise - */ - public final Object getProperty() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "property", Optional.empty()); - } - String result = this.getPropertyImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "property", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "property", e); - } - } - - /** - * expression from where the attribute 'use' is calculated. In certain cases (e.g., array access, pointer dereference) the 'use' attribute is not calculated on the node itself, but on an ancestor of the node. This attribute returns that node - */ - public abstract AExpression getUseExprImpl(); - - /** - * expression from where the attribute 'use' is calculated. In certain cases (e.g., array access, pointer dereference) the 'use' attribute is not calculated on the node itself, but on an ancestor of the node. This attribute returns that node - */ - public final Object getUseExpr() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "useExpr", Optional.empty()); - } - AExpression result = this.getUseExprImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "useExpr", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "useExpr", e); - } - } - - /** - * - * @param name - */ - public void setNameImpl(String name) { - throw new UnsupportedOperationException(get_class()+": Action setName not implemented "); - } - - /** - * - * @param name - */ - public final void setName(String name) { - try { - if(hasListeners()) { - eventTrigger().triggerAction(Stage.BEGIN, "setName", this, Optional.empty(), name); - } - this.setNameImpl(name); - if(hasListeners()) { - eventTrigger().triggerAction(Stage.END, "setName", this, Optional.empty(), name); - } - } catch(Exception e) { - throw new ActionException(get_class(), "setName", e); - } - } - - /** - * Get value on attribute decl - * @return the attribute's value - */ - @Override - public ADecl getDeclImpl() { - return this.aExpression.getDeclImpl(); - } - - /** - * Get value on attribute implicitCast - * @return the attribute's value - */ - @Override - public ACast getImplicitCastImpl() { - return this.aExpression.getImplicitCastImpl(); - } - - /** - * Get value on attribute isFunctionArgument - * @return the attribute's value - */ - @Override - public Boolean getIsFunctionArgumentImpl() { - return this.aExpression.getIsFunctionArgumentImpl(); - } - - /** - * Get value on attribute use - * @return the attribute's value - */ - @Override - public String getUseImpl() { - return this.aExpression.getUseImpl(); - } - - /** - * Get value on attribute vardecl - * @return the attribute's value - */ - @Override - public AVardecl getVardeclImpl() { - return this.aExpression.getVardeclImpl(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aExpression.selectVardecl(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aExpression.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aExpression.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aExpression.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aExpression.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aExpression.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aExpression.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aExpression.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aExpression.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aExpression.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aExpression.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aExpression.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aExpression.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aExpression.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aExpression.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aExpression.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aExpression.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aExpression.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aExpression.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aExpression.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aExpression.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aExpression.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aExpression.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aExpression.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aExpression.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aExpression.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aExpression.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aExpression.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aExpression.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aExpression.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aExpression.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aExpression.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aExpression.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aExpression.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aExpression.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aExpression.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aExpression.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aExpression.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aExpression.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aExpression.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aExpression.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aExpression.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aExpression.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aExpression.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aExpression.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aExpression.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aExpression.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aExpression.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aExpression.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aExpression.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aExpression.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aExpression.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aExpression.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aExpression.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aExpression.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aExpression.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aExpression.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aExpression.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aExpression.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aExpression.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aExpression.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aExpression.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aExpression.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aExpression.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aExpression.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aExpression.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aExpression.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aExpression.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aExpression.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aExpression.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aExpression.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aExpression.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aExpression.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aExpression.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aExpression.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aExpression.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aExpression.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aExpression.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aExpression.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aExpression.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aExpression.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aExpression.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aExpression.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aExpression.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aExpression.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aExpression); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "vardecl": - joinPointList = selectVardecl(); - break; - default: - joinPointList = this.aExpression.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "name": { - if(value instanceof String){ - this.defNameImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aExpression.fillWithAttributes(attributes); - attributes.add("declaration"); - attributes.add("hasProperty"); - attributes.add("isFunctionCall"); - attributes.add("kind"); - attributes.add("name"); - attributes.add("property"); - attributes.add("useExpr"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aExpression.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aExpression.fillWithActions(actions); - actions.add("void setName(String)"); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "varref"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aExpression.instanceOf(joinpointClass); - } - /** - * - */ - protected enum VarrefAttributes { - DECLARATION("declaration"), - HASPROPERTY("hasProperty"), - ISFUNCTIONCALL("isFunctionCall"), - KIND("kind"), - NAME("name"), - PROPERTY("property"), - USEEXPR("useExpr"), - DECL("decl"), - IMPLICITCAST("implicitCast"), - ISFUNCTIONARGUMENT("isFunctionArgument"), - USE("use"), - VARDECL("vardecl"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private VarrefAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(VarrefAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AWrapperStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AWrapperStmt.java deleted file mode 100644 index 144ec22f34..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/joinpoints/AWrapperStmt.java +++ /dev/null @@ -1,1296 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.joinpoints; - -import org.lara.interpreter.weaver.interf.events.Stage; -import java.util.Optional; -import org.lara.interpreter.exception.AttributeException; -import java.util.List; -import org.lara.interpreter.weaver.interf.JoinPoint; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.Arrays; - -/** - * Auto-Generated class for join point AWrapperStmt - * This class is overwritten by the Weaver Generator. - * - * - * @author Lara Weaver Generator - */ -public abstract class AWrapperStmt extends AStatement { - - protected AStatement aStatement; - - /** - * - */ - public AWrapperStmt(AStatement aStatement){ - this.aStatement = aStatement; - } - /** - * Get value on attribute content - * @return the attribute's value - */ - public abstract AJoinPoint getContentImpl(); - - /** - * Get value on attribute content - * @return the attribute's value - */ - public final Object getContent() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "content", Optional.empty()); - } - AJoinPoint result = this.getContentImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "content", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "content", e); - } - } - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public abstract String getKindImpl(); - - /** - * Get value on attribute kind - * @return the attribute's value - */ - public final Object getKind() { - try { - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.BEGIN, this, "kind", Optional.empty()); - } - String result = this.getKindImpl(); - if(hasListeners()) { - eventTrigger().triggerAttribute(Stage.END, this, "kind", Optional.ofNullable(result)); - } - return result!=null?result:getUndefinedValue(); - } catch(Exception e) { - throw new AttributeException(get_class(), "kind", e); - } - } - - /** - * Get value on attribute isFirst - * @return the attribute's value - */ - @Override - public Boolean getIsFirstImpl() { - return this.aStatement.getIsFirstImpl(); - } - - /** - * Get value on attribute isLast - * @return the attribute's value - */ - @Override - public Boolean getIsLastImpl() { - return this.aStatement.getIsLastImpl(); - } - - /** - * Method used by the lara interpreter to select exprs - * @return - */ - @Override - public List selectExpr() { - return this.aStatement.selectExpr(); - } - - /** - * Method used by the lara interpreter to select childExprs - * @return - */ - @Override - public List selectChildExpr() { - return this.aStatement.selectChildExpr(); - } - - /** - * Method used by the lara interpreter to select calls - * @return - */ - @Override - public List selectCall() { - return this.aStatement.selectCall(); - } - - /** - * Method used by the lara interpreter to select stmtCalls - * @return - */ - @Override - public List selectStmtCall() { - return this.aStatement.selectStmtCall(); - } - - /** - * Method used by the lara interpreter to select memberCalls - * @return - */ - @Override - public List selectMemberCall() { - return this.aStatement.selectMemberCall(); - } - - /** - * Method used by the lara interpreter to select memberAccesss - * @return - */ - @Override - public List selectMemberAccess() { - return this.aStatement.selectMemberAccess(); - } - - /** - * Method used by the lara interpreter to select arrayAccesss - * @return - */ - @Override - public List selectArrayAccess() { - return this.aStatement.selectArrayAccess(); - } - - /** - * Method used by the lara interpreter to select vardecls - * @return - */ - @Override - public List selectVardecl() { - return this.aStatement.selectVardecl(); - } - - /** - * Method used by the lara interpreter to select varrefs - * @return - */ - @Override - public List selectVarref() { - return this.aStatement.selectVarref(); - } - - /** - * Method used by the lara interpreter to select ops - * @return - */ - @Override - public List selectOp() { - return this.aStatement.selectOp(); - } - - /** - * Method used by the lara interpreter to select binaryOps - * @return - */ - @Override - public List selectBinaryOp() { - return this.aStatement.selectBinaryOp(); - } - - /** - * Method used by the lara interpreter to select unaryOps - * @return - */ - @Override - public List selectUnaryOp() { - return this.aStatement.selectUnaryOp(); - } - - /** - * Method used by the lara interpreter to select newExprs - * @return - */ - @Override - public List selectNewExpr() { - return this.aStatement.selectNewExpr(); - } - - /** - * Method used by the lara interpreter to select deleteExprs - * @return - */ - @Override - public List selectDeleteExpr() { - return this.aStatement.selectDeleteExpr(); - } - - /** - * Method used by the lara interpreter to select cilkSpawns - * @return - */ - @Override - public List selectCilkSpawn() { - return this.aStatement.selectCilkSpawn(); - } - - /** - * Get value on attribute ast - * @return the attribute's value - */ - @Override - public String getAstImpl() { - return this.aStatement.getAstImpl(); - } - - /** - * Get value on attribute astChildrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getAstChildrenArrayImpl() { - return this.aStatement.getAstChildrenArrayImpl(); - } - - /** - * Get value on attribute astId - * @return the attribute's value - */ - @Override - public String getAstIdImpl() { - return this.aStatement.getAstIdImpl(); - } - - /** - * Get value on attribute astIsInstance - * @return the attribute's value - */ - @Override - public Boolean astIsInstanceImpl(String className) { - return this.aStatement.astIsInstanceImpl(className); - } - - /** - * Get value on attribute astName - * @return the attribute's value - */ - @Override - public String getAstNameImpl() { - return this.aStatement.getAstNameImpl(); - } - - /** - * Get value on attribute astNumChildren - * @return the attribute's value - */ - @Override - public Integer getAstNumChildrenImpl() { - return this.aStatement.getAstNumChildrenImpl(); - } - - /** - * Get value on attribute bitWidth - * @return the attribute's value - */ - @Override - public Integer getBitWidthImpl() { - return this.aStatement.getBitWidthImpl(); - } - - /** - * Get value on attribute chainArrayImpl - * @return the attribute's value - */ - @Override - public String[] getChainArrayImpl() { - return this.aStatement.getChainArrayImpl(); - } - - /** - * Get value on attribute childrenArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getChildrenArrayImpl() { - return this.aStatement.getChildrenArrayImpl(); - } - - /** - * Get value on attribute code - * @return the attribute's value - */ - @Override - public String getCodeImpl() { - return this.aStatement.getCodeImpl(); - } - - /** - * Get value on attribute column - * @return the attribute's value - */ - @Override - public Integer getColumnImpl() { - return this.aStatement.getColumnImpl(); - } - - /** - * Get value on attribute contains - * @return the attribute's value - */ - @Override - public Boolean containsImpl(AJoinPoint jp) { - return this.aStatement.containsImpl(jp); - } - - /** - * Get value on attribute currentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getCurrentRegionImpl() { - return this.aStatement.getCurrentRegionImpl(); - } - - /** - * Get value on attribute data - * @return the attribute's value - */ - @Override - public Object getDataImpl() { - return this.aStatement.getDataImpl(); - } - - /** - * Get value on attribute depth - * @return the attribute's value - */ - @Override - public Integer getDepthImpl() { - return this.aStatement.getDepthImpl(); - } - - /** - * Get value on attribute descendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl() { - return this.aStatement.getDescendantsArrayImpl(); - } - - /** - * Get value on attribute endColumn - * @return the attribute's value - */ - @Override - public Integer getEndColumnImpl() { - return this.aStatement.getEndColumnImpl(); - } - - /** - * Get value on attribute endLine - * @return the attribute's value - */ - @Override - public Integer getEndLineImpl() { - return this.aStatement.getEndLineImpl(); - } - - /** - * Get value on attribute filename - * @return the attribute's value - */ - @Override - public String getFilenameImpl() { - return this.aStatement.getFilenameImpl(); - } - - /** - * Get value on attribute filepath - * @return the attribute's value - */ - @Override - public String getFilepathImpl() { - return this.aStatement.getFilepathImpl(); - } - - /** - * Get value on attribute firstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstChildImpl() { - return this.aStatement.getFirstChildImpl(); - } - - /** - * Get value on attribute getAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAncestorImpl(String type) { - return this.aStatement.getAncestorImpl(type); - } - - /** - * Get value on attribute getAstAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getAstAncestorImpl(String type) { - return this.aStatement.getAstAncestorImpl(type); - } - - /** - * Get value on attribute getAstChild - * @return the attribute's value - */ - @Override - public AJoinPoint getAstChildImpl(int index) { - return this.aStatement.getAstChildImpl(index); - } - - /** - * Get value on attribute getChainAncestor - * @return the attribute's value - */ - @Override - public AJoinPoint getChainAncestorImpl(String type) { - return this.aStatement.getChainAncestorImpl(type); - } - - /** - * Get value on attribute getChild - * @return the attribute's value - */ - @Override - public AJoinPoint getChildImpl(int index) { - return this.aStatement.getChildImpl(index); - } - - /** - * Get value on attribute getDescendantsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsArrayImpl(String type) { - return this.aStatement.getDescendantsArrayImpl(type); - } - - /** - * Get value on attribute getDescendantsAndSelfArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getDescendantsAndSelfArrayImpl(String type) { - return this.aStatement.getDescendantsAndSelfArrayImpl(type); - } - - /** - * Get value on attribute getFirstJp - * @return the attribute's value - */ - @Override - public AJoinPoint getFirstJpImpl(String type) { - return this.aStatement.getFirstJpImpl(type); - } - - /** - * Get value on attribute getJavaFieldType - * @return the attribute's value - */ - @Override - public String getJavaFieldTypeImpl(String fieldName) { - return this.aStatement.getJavaFieldTypeImpl(fieldName); - } - - /** - * Get value on attribute getKeyType - * @return the attribute's value - */ - @Override - public Object getKeyTypeImpl(String key) { - return this.aStatement.getKeyTypeImpl(key); - } - - /** - * Get value on attribute getUserField - * @return the attribute's value - */ - @Override - public Object getUserFieldImpl(String fieldName) { - return this.aStatement.getUserFieldImpl(fieldName); - } - - /** - * Get value on attribute getValue - * @return the attribute's value - */ - @Override - public Object getValueImpl(String key) { - return this.aStatement.getValueImpl(key); - } - - /** - * Get value on attribute hasChildren - * @return the attribute's value - */ - @Override - public Boolean getHasChildrenImpl() { - return this.aStatement.getHasChildrenImpl(); - } - - /** - * Get value on attribute hasNode - * @return the attribute's value - */ - @Override - public Boolean hasNodeImpl(Object nodeOrJp) { - return this.aStatement.hasNodeImpl(nodeOrJp); - } - - /** - * Get value on attribute hasParent - * @return the attribute's value - */ - @Override - public Boolean getHasParentImpl() { - return this.aStatement.getHasParentImpl(); - } - - /** - * Get value on attribute hasType - * @return the attribute's value - */ - @Override - public Boolean getHasTypeImpl() { - return this.aStatement.getHasTypeImpl(); - } - - /** - * Get value on attribute inlineCommentsArrayImpl - * @return the attribute's value - */ - @Override - public AComment[] getInlineCommentsArrayImpl() { - return this.aStatement.getInlineCommentsArrayImpl(); - } - - /** - * Get value on attribute isCilk - * @return the attribute's value - */ - @Override - public Boolean getIsCilkImpl() { - return this.aStatement.getIsCilkImpl(); - } - - /** - * Get value on attribute isInSystemHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInSystemHeaderImpl() { - return this.aStatement.getIsInSystemHeaderImpl(); - } - - /** - * Get value on attribute isInsideHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideHeaderImpl() { - return this.aStatement.getIsInsideHeaderImpl(); - } - - /** - * Get value on attribute isInsideLoopHeader - * @return the attribute's value - */ - @Override - public Boolean getIsInsideLoopHeaderImpl() { - return this.aStatement.getIsInsideLoopHeaderImpl(); - } - - /** - * Get value on attribute isMacro - * @return the attribute's value - */ - @Override - public Boolean getIsMacroImpl() { - return this.aStatement.getIsMacroImpl(); - } - - /** - * Get value on attribute javaFieldsArrayImpl - * @return the attribute's value - */ - @Override - public String[] getJavaFieldsArrayImpl() { - return this.aStatement.getJavaFieldsArrayImpl(); - } - - /** - * Get value on attribute jpFieldsArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] jpFieldsArrayImpl(Boolean recursive) { - return this.aStatement.jpFieldsArrayImpl(recursive); - } - - /** - * Get value on attribute jpId - * @return the attribute's value - */ - @Override - public String getJpIdImpl() { - return this.aStatement.getJpIdImpl(); - } - - /** - * Get value on attribute keysArrayImpl - * @return the attribute's value - */ - @Override - public String[] getKeysArrayImpl() { - return this.aStatement.getKeysArrayImpl(); - } - - /** - * Get value on attribute lastChild - * @return the attribute's value - */ - @Override - public AJoinPoint getLastChildImpl() { - return this.aStatement.getLastChildImpl(); - } - - /** - * Get value on attribute leftJp - * @return the attribute's value - */ - @Override - public AJoinPoint getLeftJpImpl() { - return this.aStatement.getLeftJpImpl(); - } - - /** - * Get value on attribute line - * @return the attribute's value - */ - @Override - public Integer getLineImpl() { - return this.aStatement.getLineImpl(); - } - - /** - * Get value on attribute location - * @return the attribute's value - */ - @Override - public String getLocationImpl() { - return this.aStatement.getLocationImpl(); - } - - /** - * Get value on attribute numChildren - * @return the attribute's value - */ - @Override - public Integer getNumChildrenImpl() { - return this.aStatement.getNumChildrenImpl(); - } - - /** - * Get value on attribute originNode - * @return the attribute's value - */ - @Override - public AJoinPoint getOriginNodeImpl() { - return this.aStatement.getOriginNodeImpl(); - } - - /** - * Get value on attribute parent - * @return the attribute's value - */ - @Override - public AJoinPoint getParentImpl() { - return this.aStatement.getParentImpl(); - } - - /** - * Get value on attribute parentRegion - * @return the attribute's value - */ - @Override - public AJoinPoint getParentRegionImpl() { - return this.aStatement.getParentRegionImpl(); - } - - /** - * Get value on attribute pragmasArrayImpl - * @return the attribute's value - */ - @Override - public APragma[] getPragmasArrayImpl() { - return this.aStatement.getPragmasArrayImpl(); - } - - /** - * Get value on attribute rightJp - * @return the attribute's value - */ - @Override - public AJoinPoint getRightJpImpl() { - return this.aStatement.getRightJpImpl(); - } - - /** - * Get value on attribute root - * @return the attribute's value - */ - @Override - public AProgram getRootImpl() { - return this.aStatement.getRootImpl(); - } - - /** - * Get value on attribute scopeNodesArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getScopeNodesArrayImpl() { - return this.aStatement.getScopeNodesArrayImpl(); - } - - /** - * Get value on attribute siblingsLeftArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsLeftArrayImpl() { - return this.aStatement.getSiblingsLeftArrayImpl(); - } - - /** - * Get value on attribute siblingsRightArrayImpl - * @return the attribute's value - */ - @Override - public AJoinPoint[] getSiblingsRightArrayImpl() { - return this.aStatement.getSiblingsRightArrayImpl(); - } - - /** - * Get value on attribute stmt - * @return the attribute's value - */ - @Override - public AStatement getStmtImpl() { - return this.aStatement.getStmtImpl(); - } - - /** - * Get value on attribute type - * @return the attribute's value - */ - @Override - public AType getTypeImpl() { - return this.aStatement.getTypeImpl(); - } - - /** - * Performs a copy of the node and its children, but not of the nodes in its fields - */ - @Override - public AJoinPoint copyImpl() { - return this.aStatement.copyImpl(); - } - - /** - * Clears all properties from the .data object - */ - @Override - public void dataClearImpl() { - this.aStatement.dataClearImpl(); - } - - /** - * Performs a copy of the node and its children, including the nodes in their fields (only the first level of field nodes, this function is not recursive) - */ - @Override - public AJoinPoint deepCopyImpl() { - return this.aStatement.deepCopyImpl(); - } - - /** - * Removes the node associated to this joinpoint from the AST - */ - @Override - public AJoinPoint detachImpl() { - return this.aStatement.detachImpl(); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, String code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * - * @param position - * @param code - */ - @Override - public AJoinPoint[] insertImpl(String position, JoinPoint code) { - return this.aStatement.insertImpl(position, code); - } - - /** - * Inserts the given join point after this join point - * @param node - */ - @Override - public AJoinPoint insertAfterImpl(AJoinPoint node) { - return this.aStatement.insertAfterImpl(node); - } - - /** - * Overload which accepts a string - * @param code - */ - @Override - public AJoinPoint insertAfterImpl(String code) { - return this.aStatement.insertAfterImpl(code); - } - - /** - * Inserts the given join point before this join point - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(AJoinPoint node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint insertBeforeImpl(String node) { - return this.aStatement.insertBeforeImpl(node); - } - - /** - * Adds a message that will be printed to the user after weaving finishes. Identical messages are removed - * @param message - */ - @Override - public void messageToUserImpl(String message) { - this.aStatement.messageToUserImpl(message); - } - - /** - * Removes the children of this node - */ - @Override - public void removeChildrenImpl() { - this.aStatement.removeChildrenImpl(); - } - - /** - * Replaces this node with the given node - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a string - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(String node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of join points - * @param node - */ - @Override - public AJoinPoint replaceWithImpl(AJoinPoint[] node) { - return this.aStatement.replaceWithImpl(node); - } - - /** - * Overload which accepts a list of strings - * @param node - */ - @Override - public AJoinPoint replaceWithStringsImpl(String[] node) { - return this.aStatement.replaceWithStringsImpl(node); - } - - /** - * Setting data directly is not supported, this action just emits a warning and does nothing - * @param source - */ - @Override - public void setDataImpl(Object source) { - this.aStatement.setDataImpl(source); - } - - /** - * Replaces the first child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setFirstChildImpl(AJoinPoint node) { - return this.aStatement.setFirstChildImpl(node); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String[] comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Sets the commented that are embedded in a node - * @param comments - */ - @Override - public void setInlineCommentsImpl(String comments) { - this.aStatement.setInlineCommentsImpl(comments); - } - - /** - * Replaces the last child, or inserts the join point if no child is present. Returns the replaced child, or undefined if there was no child present. - * @param node - */ - @Override - public AJoinPoint setLastChildImpl(AJoinPoint node) { - return this.aStatement.setLastChildImpl(node); - } - - /** - * Sets the type of a node, if it has a type - * @param type - */ - @Override - public void setTypeImpl(AType type) { - this.aStatement.setTypeImpl(type); - } - - /** - * Associates arbitrary values to nodes of the AST - * @param fieldName - * @param value - */ - @Override - public Object setUserFieldImpl(String fieldName, Object value) { - return this.aStatement.setUserFieldImpl(fieldName, value); - } - - /** - * Overload which accepts a map - * @param fieldNameAndValue - */ - @Override - public Object setUserFieldImpl(Map fieldNameAndValue) { - return this.aStatement.setUserFieldImpl(fieldNameAndValue); - } - - /** - * Sets the value associated with the given property key - * @param key - * @param value - */ - @Override - public AJoinPoint setValueImpl(String key, Object value) { - return this.aStatement.setValueImpl(key, value); - } - - /** - * Replaces this join point with a comment with the same contents as .code - * @param prefix - * @param suffix - */ - @Override - public AJoinPoint toCommentImpl(String prefix, String suffix) { - return this.aStatement.toCommentImpl(prefix, suffix); - } - - /** - * - */ - @Override - public Optional getSuper() { - return Optional.of(this.aStatement); - } - - /** - * - */ - @Override - public final List select(String selectName) { - List joinPointList; - switch(selectName) { - case "expr": - joinPointList = selectExpr(); - break; - case "childExpr": - joinPointList = selectChildExpr(); - break; - case "call": - joinPointList = selectCall(); - break; - case "stmtCall": - joinPointList = selectStmtCall(); - break; - case "memberCall": - joinPointList = selectMemberCall(); - break; - case "memberAccess": - joinPointList = selectMemberAccess(); - break; - case "arrayAccess": - joinPointList = selectArrayAccess(); - break; - case "vardecl": - joinPointList = selectVardecl(); - break; - case "varref": - joinPointList = selectVarref(); - break; - case "op": - joinPointList = selectOp(); - break; - case "binaryOp": - joinPointList = selectBinaryOp(); - break; - case "unaryOp": - joinPointList = selectUnaryOp(); - break; - case "newExpr": - joinPointList = selectNewExpr(); - break; - case "deleteExpr": - joinPointList = selectDeleteExpr(); - break; - case "cilkSpawn": - joinPointList = selectCilkSpawn(); - break; - default: - joinPointList = this.aStatement.select(selectName); - break; - } - return joinPointList; - } - - /** - * - */ - @Override - public final void defImpl(String attribute, Object value) { - switch(attribute){ - case "data": { - if(value instanceof Object){ - this.defDataImpl((Object)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "firstChild": { - if(value instanceof AJoinPoint){ - this.defFirstChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "inlineComments": { - if(value instanceof String[]){ - this.defInlineCommentsImpl((String[])value); - return; - } - if(value instanceof String){ - this.defInlineCommentsImpl((String)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "lastChild": { - if(value instanceof AJoinPoint){ - this.defLastChildImpl((AJoinPoint)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - case "type": { - if(value instanceof AType){ - this.defTypeImpl((AType)value); - return; - } - this.unsupportedTypeForDef(attribute, value); - } - default: throw new UnsupportedOperationException("Join point "+get_class()+": attribute '"+attribute+"' cannot be defined"); - } - } - - /** - * - */ - @Override - protected final void fillWithAttributes(List attributes) { - this.aStatement.fillWithAttributes(attributes); - attributes.add("content"); - attributes.add("kind"); - } - - /** - * - */ - @Override - protected final void fillWithSelects(List selects) { - this.aStatement.fillWithSelects(selects); - } - - /** - * - */ - @Override - protected final void fillWithActions(List actions) { - this.aStatement.fillWithActions(actions); - } - - /** - * Returns the join point type of this class - * @return The join point type - */ - @Override - public final String get_class() { - return "wrapperStmt"; - } - - /** - * Defines if this joinpoint is an instanceof a given joinpoint class - * @return True if this join point is an instanceof the given class - */ - @Override - public final boolean instanceOf(String joinpointClass) { - boolean isInstance = get_class().equals(joinpointClass); - if(isInstance) { - return true; - } - return this.aStatement.instanceOf(joinpointClass); - } - /** - * - */ - protected enum WrapperStmtAttributes { - CONTENT("content"), - KIND("kind"), - ISFIRST("isFirst"), - ISLAST("isLast"), - AST("ast"), - ASTCHILDREN("astChildren"), - ASTID("astId"), - ASTISINSTANCE("astIsInstance"), - ASTNAME("astName"), - ASTNUMCHILDREN("astNumChildren"), - BITWIDTH("bitWidth"), - CHAIN("chain"), - CHILDREN("children"), - CODE("code"), - COLUMN("column"), - CONTAINS("contains"), - CURRENTREGION("currentRegion"), - DATA("data"), - DEPTH("depth"), - DESCENDANTS("descendants"), - ENDCOLUMN("endColumn"), - ENDLINE("endLine"), - FILENAME("filename"), - FILEPATH("filepath"), - FIRSTCHILD("firstChild"), - GETANCESTOR("getAncestor"), - GETASTANCESTOR("getAstAncestor"), - GETASTCHILD("getAstChild"), - GETCHAINANCESTOR("getChainAncestor"), - GETCHILD("getChild"), - GETDESCENDANTS("getDescendants"), - GETDESCENDANTSANDSELF("getDescendantsAndSelf"), - GETFIRSTJP("getFirstJp"), - GETJAVAFIELDTYPE("getJavaFieldType"), - GETKEYTYPE("getKeyType"), - GETUSERFIELD("getUserField"), - GETVALUE("getValue"), - HASCHILDREN("hasChildren"), - HASNODE("hasNode"), - HASPARENT("hasParent"), - HASTYPE("hasType"), - INLINECOMMENTS("inlineComments"), - ISCILK("isCilk"), - ISINSYSTEMHEADER("isInSystemHeader"), - ISINSIDEHEADER("isInsideHeader"), - ISINSIDELOOPHEADER("isInsideLoopHeader"), - ISMACRO("isMacro"), - JAVAFIELDS("javaFields"), - JPFIELDS("jpFields"), - JPID("jpId"), - KEYS("keys"), - LASTCHILD("lastChild"), - LEFTJP("leftJp"), - LINE("line"), - LOCATION("location"), - NUMCHILDREN("numChildren"), - ORIGINNODE("originNode"), - PARENT("parent"), - PARENTREGION("parentRegion"), - PRAGMAS("pragmas"), - RIGHTJP("rightJp"), - ROOT("root"), - SCOPENODES("scopeNodes"), - SIBLINGSLEFT("siblingsLeft"), - SIBLINGSRIGHT("siblingsRight"), - STMT("stmt"), - TYPE("type"); - private String name; - - /** - * - */ - private WrapperStmtAttributes(String name){ - this.name = name; - } - /** - * Return an attribute enumeration item from a given attribute name - */ - public static Optional fromString(String name) { - return Arrays.asList(values()).stream().filter(attr -> attr.name.equals(name)).findAny(); - } - - /** - * Return a list of attributes in String format - */ - public static List getNames() { - return Arrays.asList(values()).stream().map(WrapperStmtAttributes::name).collect(Collectors.toList()); - } - - /** - * True if the enum contains the given attribute name, false otherwise. - */ - public static boolean contains(String name) { - return fromString(name).isPresent(); - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/AClavaWeaver.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/AClavaWeaver.java deleted file mode 100644 index 2bd4d7f82e..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/AClavaWeaver.java +++ /dev/null @@ -1,61 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.weaver; - -import org.lara.interpreter.weaver.interf.WeaverEngine; -import java.util.Arrays; -import java.util.List; -import java.util.ArrayList; - -/** - * Abstract Weaver Implementation for ClavaWeaver
- * Since the generated abstract classes are always overwritten, their implementation should be done by extending those abstract classes with user-defined classes.
- * The abstract class {@link pt.up.fe.specs.clava.weaver.abstracts.AClavaWeaverJoinPoint} can be used to add user-defined methods and fields which the user intends to add for all join points and are not intended to be used in LARA aspects. - * The implementation of the abstract methods is mandatory! - * @author Lara C. - */ -public abstract class AClavaWeaver extends WeaverEngine { - - /** - * Get the list of available actions in the weaver - * - * @return list with all actions - */ - @Override - public final List getActions() { - String[] weaverActions= {"replaceWith", "insertBefore", "insertBefore", "insertAfter", "insertAfter", "detach", "setType", "rebuild", "addFile", "addInclude", "addInclude", "addIncludeJp", "addGlobal", "messageToUser", "setName", "insertBegin", "insertBegin", "insertEnd", "insertEnd", "insertBegin", "insertBegin", "insertEnd", "insertEnd", "clone", "clear", "insertReturn", "insertReturn", "changeKind", "setNumThreads", "setProcBind"}; - return Arrays.asList(weaverActions); - } - - /** - * Returns the name of the root - * - * @return the root name - */ - @Override - public final String getRoot() { - return "program"; - } - - /** - * Returns a list of classes that may be imported and used in LARA. - * - * @return a list of importable classes - */ - @Override - public final List> getAllImportableClasses() { - Class[] defaultClasses = {}; - List> otherClasses = this.getImportableClasses(); - List> allClasses = new ArrayList<>(Arrays.asList(defaultClasses)); - allClasses.addAll(otherClasses); - return allClasses; - } - - /** - * Does the generated code implements events? - * - * @return true if implements events, false otherwise - */ - @Override - public final boolean implementsEvents() { - return true; - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/ACxxWeaver.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/ACxxWeaver.java deleted file mode 100644 index 2fadc26a0c..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/abstracts/weaver/ACxxWeaver.java +++ /dev/null @@ -1,63 +0,0 @@ -package pt.up.fe.specs.clava.weaver.abstracts.weaver; - -import org.lara.interpreter.weaver.LaraWeaverEngine; -import java.util.Arrays; -import java.util.List; -import pt.up.fe.specs.clava.weaver.enums.StorageClass; -import pt.up.fe.specs.clava.weaver.enums.Relation; -import java.util.ArrayList; - -/** - * Abstract Weaver Implementation for CxxWeaver
- * Since the generated abstract classes are always overwritten, their implementation should be done by extending those abstract classes with user-defined classes.
- * The abstract class {@link pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint} contains attributes and actions common to all join points. - * The implementation of the abstract methods is mandatory! - * @author Lara C. - */ -public abstract class ACxxWeaver extends LaraWeaverEngine { - - /** - * Get the list of available actions in the weaver - * - * @return list with all actions - */ - @Override - public final List getActions() { - String[] weaverActions= {"copy", "dataClear", "deepCopy", "detach", "insertAfter", "insertAfter", "insertBefore", "insertBefore", "messageToUser", "removeChildren", "replaceWith", "replaceWith", "replaceWith", "replaceWithStrings", "setData", "setFirstChild", "setInlineComments", "setInlineComments", "setLastChild", "setType", "setUserField", "setUserField", "setValue", "toComment", "asConst", "setDesugar", "setTemplateArgType", "setTemplateArgsTypes", "setTypeFieldByValueRecursive", "setUnderlyingType", "setElementType", "setLeft", "setRight", "addLocal", "cfg", "clear", "dfg", "insertBegin", "insertBegin", "insertEnd", "insertEnd", "insertReturn", "insertReturn", "setNaked", "addArg", "addArg", "inline", "setArg", "setArgFromString", "setName", "wrap", "interchange", "setBody", "setCond", "setCondRelation", "setEndValue", "setInit", "setInitValue", "setIsParallel", "setKind", "setStep", "tile", "addMethod", "addField", "setName", "setQualifiedName", "setQualifiedPrefix", "setText", "setConfig", "setConfigFromStrings", "addCInclude", "addFunction", "addGlobal", "addInclude", "addIncludeJp", "insertBegin", "insertBegin", "insertEnd", "insertEnd", "rebuild", "rebuildTry", "setName", "setRelativeFolderpath", "write", "addParam", "addParam", "clone", "cloneOnFile", "cloneOnFile", "insertReturn", "insertReturn", "newCall", "setBody", "setFunctionType", "setParam", "setParam", "setParamType", "setParams", "setParamsFromStrings", "setReturnType", "setStorageClass", "setParamType", "setReturnType", "setLabel", "setCond", "setElse", "setThen", "setDecl", "setContent", "setName", "setArrow", "removeRecord", "removeClause", "setCollapse", "setCollapse", "setCopyin", "setDefault", "setFirstprivate", "setKind", "setLastprivate", "setNumThreads", "setOrdered", "setPrivate", "setProcBind", "setReduction", "setScheduleChunkSize", "setScheduleChunkSize", "setScheduleKind", "setScheduleModifiers", "setShared", "removeInit", "setInit", "setInit", "setStorageClass", "varref", "setInnerType", "setPointee", "addExtraInclude", "addExtraIncludeFromGit", "addExtraLib", "addExtraSource", "addExtraSourceFromGit", "addFile", "addFileFromPath", "addProjectFromGit", "atexit", "pop", "push", "rebuild", "rebuildFuzzy", "setArgType", "setSizeExpr", "setName"}; - return Arrays.asList(weaverActions); - } - - /** - * Returns the name of the root - * - * @return the root name - */ - @Override - public final String getRoot() { - return "program"; - } - - /** - * Returns a list of classes that may be imported and used in LARA. - * - * @return a list of importable classes - */ - @Override - public final List> getAllImportableClasses() { - Class[] defaultClasses = {StorageClass.class, Relation.class}; - List> otherClasses = this.getImportableClasses(); - List> allClasses = new ArrayList<>(Arrays.asList(defaultClasses)); - allClasses.addAll(otherClasses); - return allClasses; - } - - /** - * Does the generated code implements events? - * - * @return true if implements events, false otherwise - */ - @Override - public final boolean implementsEvents() { - return true; - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/defs/CxxLoopDefs.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/defs/CxxLoopDefs.java deleted file mode 100644 index 91c6ccf28f..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/defs/CxxLoopDefs.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.defs; - -import org.lara.interpreter.utils.DefMap; - -import pt.up.fe.specs.clava.weaver.joinpoints.CxxLoop; - -public class CxxLoopDefs { - - private static final DefMap DEF_MAP; - static { - DEF_MAP = new DefMap<>(CxxLoop.class); - DEF_MAP.addBool("isParallel", CxxLoopDefs::defIsParallel); - DEF_MAP.addInteger("iterations", CxxLoopDefs::defIterations); - } - - public static DefMap getDefMap() { - return DEF_MAP; - } - - private static void defIsParallel(CxxLoop jp, Boolean value) { - jp.getNode().setParallel(value); - } - - private static void defIterations(CxxLoop jp, Integer iterations) { - jp.getNode().setIterations(iterations); - } - -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/Relation.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/Relation.java deleted file mode 100644 index 89ad5e55a6..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/Relation.java +++ /dev/null @@ -1,48 +0,0 @@ -package pt.up.fe.specs.clava.weaver.enums; - -import org.lara.interpreter.weaver.interf.NamedEnum; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.enums.EnumHelperWithValue; - -/** - * - * - * @author Lara C. - */ -public enum Relation implements NamedEnum{ - EQ("eq"), - GE("ge"), - GT("gt"), - LE("le"), - LT("lt"), - NE("ne"); - private String name; - private static final Lazy> ENUM_HELPER = EnumHelperWithValue.newLazyHelperWithValue(Relation.class); - - /** - * - */ - private Relation(String name){ - this.name = name; - } - /** - * - */ - public String getName() { - return this.name; - } - - /** - * - */ - public String toString() { - return getName(); - } - - /** - * - */ - public static EnumHelperWithValue getHelper() { - return ENUM_HELPER.get(); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/StorageClass.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/StorageClass.java deleted file mode 100644 index 0f1aebe496..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/enums/StorageClass.java +++ /dev/null @@ -1,48 +0,0 @@ -package pt.up.fe.specs.clava.weaver.enums; - -import org.lara.interpreter.weaver.interf.NamedEnum; -import pt.up.fe.specs.util.lazy.Lazy; -import pt.up.fe.specs.util.enums.EnumHelperWithValue; - -/** - * - * - * @author Lara C. - */ -public enum StorageClass implements NamedEnum{ - AUTO("auto"), - EXTERN("extern"), - NONE("none"), - PRIVATE_EXTERN("private_extern"), - REGISTER("register"), - STATIC("static"); - private String name; - private static final Lazy> ENUM_HELPER = EnumHelperWithValue.newLazyHelperWithValue(StorageClass.class); - - /** - * - */ - private StorageClass(String name){ - this.name = name; - } - /** - * - */ - public String getName() { - return this.name; - } - - /** - * - */ - public String toString() { - return getName(); - } - - /** - * - */ - public static EnumHelperWithValue getHelper() { - return ENUM_HELPER.get(); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/ClavaWeaverException.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/ClavaWeaverException.java deleted file mode 100644 index 6da3952eb1..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/ClavaWeaverException.java +++ /dev/null @@ -1,46 +0,0 @@ -package pt.up.fe.specs.clava.weaver.exceptions; - -import pt.up.fe.specs.tools.lara.exception.BaseException; - -/** - * This class can be used as the exception of this weaver in order to follow the message pretty print used by the interpreter - */ -public class ClavaWeaverException extends BaseException { - - private static final long serialVersionUID = 1L; - private final String event; - - /** - * Create a new exception with a message - * @param event the exception message - */ - public ClavaWeaverException(String event){ - this(event,null); - } - /** - * Create a new exception with the cause and the triggering event - * @param event the event that caused the exception - * @param cause the cause of this exception - */ - public ClavaWeaverException(String event, Throwable cause){ - super(cause); - this.event = event; - } - /** - * - * @see pt.up.fe.specs.tools.lara.exception.BaseException#generateSimpleMessage() - */ - @Override - protected String generateSimpleMessage() { - return " [ClavaWeaver] " +this.event; - } - - /** - * - * @see pt.up.fe.specs.tools.lara.exception.BaseException#generateMessage() - */ - @Override - protected String generateMessage() { - return "Exception in "+this.generateSimpleMessage(); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/CxxWeaverException.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/CxxWeaverException.java deleted file mode 100644 index 76c18213c8..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/exceptions/CxxWeaverException.java +++ /dev/null @@ -1,46 +0,0 @@ -package pt.up.fe.specs.clava.weaver.exceptions; - -import pt.up.fe.specs.tools.lara.exception.BaseException; - -/** - * This class can be used as the exception of this weaver in order to follow the message pretty print used by the interpreter - */ -public class CxxWeaverException extends BaseException { - - private static final long serialVersionUID = 1L; - private final String event; - - /** - * Create a new exception with a message - * @param event the exception message - */ - public CxxWeaverException(String event){ - this(event,null); - } - /** - * Create a new exception with the cause and the triggering event - * @param event the event that caused the exception - * @param cause the cause of this exception - */ - public CxxWeaverException(String event, Throwable cause){ - super(cause); - this.event = event; - } - /** - * - * @see pt.up.fe.specs.tools.lara.exception.BaseException#generateSimpleMessage() - */ - @Override - protected String generateSimpleMessage() { - return " [CxxWeaver] " +this.event; - } - - /** - * - * @see pt.up.fe.specs.tools.lara.exception.BaseException#generateMessage() - */ - @Override - protected String generateMessage() { - return "Exception in "+this.generateSimpleMessage(); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/gears/InsideApplyGear.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/gears/InsideApplyGear.java deleted file mode 100644 index 7239b165da..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/gears/InsideApplyGear.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2018 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.gears; - -import org.lara.interpreter.weaver.interf.AGear; -import org.lara.interpreter.weaver.interf.events.data.ApplyEvent; - -import com.google.common.base.Preconditions; - -public class InsideApplyGear extends AGear { - - // State - private int insideApplyCounter; - - public InsideApplyGear() { - insideApplyCounter = 0; - } - - public boolean isInsideApply() { - return insideApplyCounter > 0; - } - - @Override - public void onApply(ApplyEvent data) { - switch (data.getStage()) { - case BEGIN: - insideApplyCounter++; - break; - case END: - Preconditions.checkArgument(insideApplyCounter > 0, - "Leaving apply, expected apply counter to be a number greater than zero, is " + insideApplyCounter); - insideApplyCounter--; - default: - // Do nothing - break; - } - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/hls/HighLevelSynthesisAPI.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/hls/HighLevelSynthesisAPI.java deleted file mode 100644 index 81c0b8b54b..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/hls/HighLevelSynthesisAPI.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Copyright 2020 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.hls; - -import java.io.File; - -import pt.up.fe.specs.clava.ClavaLog; -import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.ast.decl.FunctionDecl; -import pt.up.fe.specs.clava.hls.ClavaHLS; -import pt.up.fe.specs.clava.hls.ClavaHLSOptions; -import pt.up.fe.specs.clava.weaver.CxxWeaver; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunction; - -/** - * Middleman class to establish an API between LARA and the Java HLS module - * - * @author Tiago - * - */ -public class HighLevelSynthesisAPI { - /** - * Applies all generic strategies to a given function - * - * @param cxxFun - * the function to analyze - * @param options - * JSON with HLS options - */ - public static void applyGenericStrategies(AFunction cxxFun, String options) { - ClavaLog.info("HLS API: applying all generic strategies to function " + cxxFun.getNameImpl()); - ClavaHLS hls = createHLS(cxxFun); - ClavaHLSOptions op = new ClavaHLSOptions(); - hls.applyGenericStrategies(op); - } - - /** - * Applies function inlining using the given function as the starting point - * - * @param cxxFun - * the function to analyze - * @param B - * function inlining control parameter (defines whether the inlining should be more - * permissive/aggressive) - */ - public static void applyFunctionInlining(AFunction cxxFun, String B) { - ClavaLog.info("HLS API: applying function inlining to function " + cxxFun.getNameImpl()); - ClavaHLS hls = createHLS(cxxFun); - try { - double b = Double.parseDouble(B); - if (b <= 0.0) { - ClavaLog.warning("HLS API: parameter B of function inlining must be larger than 0.0, aborting..."); - return; - } - hls.applyFunctionInlining(b); - } catch (NumberFormatException e) { - ClavaLog.warning("HLS API: unable to parse parameter B of function inlining, aborting..."); - return; - } - } - - /** - * Applies array streaming to the given function - * - * @param cxxFun - * the function to analyze - */ - public static void applyArrayStreaming(AFunction cxxFun) { - ClavaLog.info("HLS API: applying array streaming to function " + cxxFun.getNameImpl()); - ClavaHLS hls = createHLS(cxxFun); - hls.applyArrayStreaming(); - } - - /** - * Applies the loop strategies to a given function - * - * @param cxxFun - * the function to analyze - */ - public static void applyLoopStrategies(AFunction cxxFun, String P) { - ClavaLog.info("HLS API: applying loop strategies to function " + cxxFun.getNameImpl()); - ClavaHLS hls = createHLS(cxxFun); - - try { - int p = Integer.parseInt(P); - if (p <= 0) { - ClavaLog.warning("HLS API: provided partitioning factor " + p + " is smaller than 1, aborting..."); - return; - } - hls.applyLoopStrategies(p); - } catch (NumberFormatException e) { - ClavaLog.warning("HLS API: unable to parse partitioning factor, aborting..."); - } - } - - /** - * Applies the load/stores strategy to a given function - * - * @param cxxFun - * the function to analyze - * @param N - * the load/stores parameter (positive integer) - */ - public static void applyLoadStoresStrategy(AFunction cxxFun, String N) { - ClavaLog.info("HLS API: applying load/stores strategy to function " + cxxFun.getNameImpl()); - ClavaHLS hls = createHLS(cxxFun); - try { - int n = Integer.parseInt(N); - if (n <= 0) { - ClavaLog.warning("HLS API: provided load/stores value " + n + " is smaller than 1, aborting..."); - return; - } - hls.applyLoadStoresStrategy(n); - } catch (NumberFormatException e) { - ClavaLog.warning("HLS API: unable to parse load/stores parameter, aborting..."); - } - } - - public static boolean canBeInstrumented(AFunction cxxFun) { - ClavaLog.info("HLS API: applying trace verification to a function"); - ClavaHLS hls = createHLS(cxxFun); - boolean can = hls.canBeInstrumented(); - CxxWeaver.getCxxWeaver().getScriptEngine().toJs(can); - return can; - } - - /** - * Creates a ClavaHLS instance for a given function - * - * @param cxxFun - * the function to use on HLS analysis - * @return - */ - private static ClavaHLS createHLS(AFunction cxxFun) { - FunctionDecl fun = (FunctionDecl) cxxFun.getNode(); - DataFlowGraph dfg = new DataFlowGraph(fun); - File fld = CxxWeaver.getCxxWeaver().getWeavingFolder(); - ClavaHLS hls = new ClavaHLS(dfg, fld); - return hls; - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/AstFactory.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/AstFactory.java index 259bcbd779..c38b30445b 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/AstFactory.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/AstFactory.java @@ -36,7 +36,11 @@ import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.*; import pt.up.fe.specs.clava.weaver.joinpoints.CxxFunction; -import pt.up.fe.specs.util.*; +import pt.up.fe.specs.util.SpecsLogs; +import pt.up.fe.specs.util.SpecsCollections; +import pt.up.fe.specs.util.SpecsIo; +import pt.up.fe.specs.util.SpecsEnums; +import pt.up.fe.specs.util.Preconditions; import pt.up.fe.specs.util.utilities.StringLines; import java.io.File; @@ -307,7 +311,7 @@ public static ACxxWeaverJoinPoint constArrayType(String typeCode, String standar */ public static ACxxWeaverJoinPoint constArrayType(Type outType, String standardString, List dims) { - Preconditions.checkNotNull(dims); + Objects.requireNonNull(dims); Preconditions.checkArgument(dims.size() > 0); Type inType = null; @@ -530,10 +534,6 @@ public static AFunction functionDeclFromType(String functionName, AFunctionType AFunction.class); } - public static AFunction functionDecl(String functionName, AType returnTypeJp, Object[] namedDeclJps) { - return functionDecl(functionName, returnTypeJp, SpecsCollections.asListT(AJoinPoint.class, namedDeclJps)); - } - public static AFunction functionDecl(String functionName, AType returnTypeJp, List namedDeclJps) { Type returnType = (Type) returnTypeJp.getNode(); @@ -567,6 +567,10 @@ public static AFunction functionDecl(String functionName, AType returnTypeJp, Li return CxxJoinpoints.create(functionDecl, AFunction.class); } + public static AFunction functionDecl(String functionName, AType returnTypeJp, Object... namedDeclJps) { + return functionDecl(functionName, returnTypeJp, SpecsCollections.asListT(AJoinPoint.class, namedDeclJps)); + } + public static ABinaryOp assignment(AExpression leftHand, AExpression rightHand) { Expr lhs = (Expr) leftHand.getNode(); Expr rhs = (Expr) rightHand.getNode(); @@ -690,10 +694,6 @@ public static ACast cStyleCast(AType type, AExpression expr) { return CxxJoinpoints.create(cast, ACast.class); } - public static AClass classDecl(String className, Object[] fields) { - return classDecl(className, SpecsCollections.asListT(AField.class, fields)); - } - /** * Creates a join point representing a new class. * @@ -707,7 +707,10 @@ public static AClass classDecl(String className, List fields) { var classDecl = CxxWeaver.getFactory().cxxRecordDecl(className, fieldsNodes); return CxxJoinpoints.create(classDecl, AClass.class); + } + public static AClass classDecl(String className, Object... fields) { + return classDecl(className, SpecsCollections.asListT(AField.class, fields)); } /** @@ -718,10 +721,8 @@ public static AClass classDecl(String className, List fields) { * @return */ public static AField field(String fieldName, AType fieldType) { - var fieldDecl = CxxWeaver.getFactory().fieldDecl(fieldName, (Type) fieldType.getNode()); return CxxJoinpoints.create(fieldDecl, AField.class); - } /** @@ -802,10 +803,6 @@ public static AExprStmt exprStmt(AExpression expr) { * @param joinpoint * @return */ - public static ADeclStmt declStmt(Object[] decls) { - return declStmt(SpecsCollections.asListT(ADecl.class, decls)); - } - public static ADeclStmt declStmt(List decls) { var declNodes = decls.stream().map(decl -> (Decl) decl.getNode()) .collect(Collectors.toList()); @@ -815,6 +812,10 @@ public static ADeclStmt declStmt(List decls) { return CxxJoinpoints.create(declStmt, ADeclStmt.class); } + public static ADeclStmt declStmt(Object... decls) { + return declStmt(SpecsCollections.asListT(ADecl.class, decls)); + } + /** * Creates a joinpoint representing a declaration of a label. This is not a `label:` statement. For that, you must * create a `labelStmt` with returned `labelDecl`. This joinpoint is also used to create `gotoStmt`s. diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/ClavaPlatforms.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/ClavaPlatforms.java deleted file mode 100644 index d0f020fd5a..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/ClavaPlatforms.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.importable; - -import pt.up.fe.specs.clang.SupportedPlatform; - -public class ClavaPlatforms { - - public static String getCurrentPlatform() { - return SupportedPlatform.getCurrentPlatform().getName(); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/Format.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/Format.java deleted file mode 100644 index be64451564..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/importable/Format.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2017 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.importable; - -import java.util.stream.Collectors; - -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.utilities.StringLines; - -public class Format { - - public static String addPrefix(String input, String prefix) { - return StringLines.newInstance(input).stream() - .map(line -> prefix + line) - .collect(Collectors.joining("\n")); - } - - public static String escape(String string) { - return SpecsStrings.escapeJson(string); - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CXXCudaKernelCall.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CXXCudaKernelCall.java index cd11a61299..516c4787aa 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CXXCudaKernelCall.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CXXCudaKernelCall.java @@ -31,14 +31,9 @@ public AExpression[] getConfigArrayImpl() { return CxxJoinpoints.create(kernelCall.getConfiguration(), AExpression.class); } - @Override - public void defConfigImpl(AExpression[] args) { - kernelCall.setConfiguration(SpecsCollections.toList(args, jp -> (Expr) jp.getNode())); - } - @Override public void setConfigImpl(AExpression[] args) { - defConfigImpl(args); + kernelCall.setConfiguration(SpecsCollections.toList(args, jp -> (Expr) jp.getNode())); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxArrayAccess.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxArrayAccess.java index 7102098f85..c5528db2ed 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxArrayAccess.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxArrayAccess.java @@ -13,9 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.expr.ArraySubscriptExpr; import pt.up.fe.specs.clava.utils.Nameable; @@ -69,21 +66,6 @@ public ADecl getDeclImpl() { return getVardeclImpl(); } - @Override - public List selectVardecl() { - return CxxExpression.selectVarDecl(this); - } - - @Override - public List selectArrayVar() { - return Arrays.asList(getArrayVarImpl()); - } - - @Override - public List selectSubscript() { - return Arrays.asList(getSubscriptArrayImpl()); - } - @Override public AArrayAccess getParentAccessImpl() { return arraySub.getParentAccess() diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxBinaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxBinaryOp.java index 53e49e4928..6e4a355a74 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxBinaryOp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxBinaryOp.java @@ -40,25 +40,15 @@ public ClavaNode getNode() { return op; } - @Override - public List selectLeft() { - return Arrays.asList((AExpression) CxxJoinpoints.create(op.getLhs())); - } - - @Override - public List selectRight() { - return Arrays.asList((AExpression) CxxJoinpoints.create(op.getRhs())); - } - @Override public AExpression getLeftImpl() { - List left = selectLeft(); + List left = Arrays.asList((AExpression) CxxJoinpoints.create(op.getLhs())); return left.isEmpty() ? null : left.get(0); } @Override public AExpression getRightImpl() { - List right = selectRight(); + List right = Arrays.asList((AExpression) CxxJoinpoints.create(op.getRhs())); return right.isEmpty() ? null : right.get(0); } @@ -72,23 +62,13 @@ public Boolean getIsBitwiseImpl() { return op.getOp().isBitwise(); } - @Override - public void defLeftImpl(AExpression value) { - op.setLhs((Expr) value.getNode()); - } - - @Override - public void defRightImpl(AExpression value) { - op.setRhs((Expr) value.getNode()); - } - @Override public void setLeftImpl(AExpression left) { - defLeftImpl(left); + op.setLhs((Expr) left.getNode()); } @Override public void setRightImpl(AExpression right) { - defRightImpl(right); + op.setRhs((Expr) right.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCall.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCall.java index 39001155dd..1c1fa111ce 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCall.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCall.java @@ -13,8 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; import java.util.stream.Collectors; import pt.up.fe.specs.clava.ClavaNode; @@ -62,13 +60,6 @@ public Integer getNumArgsImpl() { return call.getArgs().size(); } - @Override - public List selectArg() { - return call.getArgs().stream() - .map(expr -> CxxJoinpoints.create(expr, AExpression.class)) - .collect(Collectors.toList()); - } - @Override public CallExpr getNode() { return call; @@ -159,11 +150,6 @@ public AType getTypeImpl() { return CxxJoinpoints.create(calleeType, AType.class); } - @Override - public List selectCallee() { - return Arrays.asList(CxxJoinpoints.create(call.getCallee(), AExpression.class)); - } - @Override public String[] getMemberNamesArrayImpl() { return call.getCallMemberNames().toArray(new String[0]); @@ -171,22 +157,8 @@ public String[] getMemberNamesArrayImpl() { @Override public void setNameImpl(String name) { - defNameImpl(name); - } - - @Override - public void defNameImpl(String value) { - call.setCallName(value); - } - - /* - @Override - public AFunction[] getDeclarationsArrayImpl() { - return call.getPrototypes().stream() - .map(decl -> CxxJoinpoints.create(decl, AFunction.class)) - .toArray(size -> new AFunction[size]); + call.setCallName(name); } - */ @Override public AFunction getDeclarationImpl() { diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCast.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCast.java index 5fa5c64973..e6f354ab6e 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCast.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxCast.java @@ -13,8 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.expr.CastExpr; import pt.up.fe.specs.clava.ast.type.Type; @@ -67,11 +65,6 @@ public ADecl getDeclImpl() { return getVardeclImpl(); } - @Override - public List selectVardecl() { - return CxxExpression.selectVarDecl(this); - } - @Override public AExpression getSubExprImpl() { return (AExpression) CxxJoinpoints.create(cast.getSubExpr()); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxClass.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxClass.java index fad40df208..8c2bc3f60c 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxClass.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxClass.java @@ -13,10 +13,7 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.ast.decl.CXXDestructorDecl; import pt.up.fe.specs.clava.ast.decl.CXXMethodDecl; import pt.up.fe.specs.clava.ast.decl.CXXRecordDecl; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; @@ -58,12 +55,7 @@ public ClavaNode getNode() { @Override public AMethod[] getMethodsArrayImpl() { - return selectMethod().toArray(new AMethod[0]); - } - - @Override - public List selectMethod() { - return CxxSelects.select(AMethod.class, cxxRecordDecl.getMethods(), false, node -> true); + return CxxSelects.select(AMethod.class, cxxRecordDecl.getMethods(), false, node -> true).toArray(new AMethod[0]); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxComment.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxComment.java index f06cada338..5d426c2459 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxComment.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxComment.java @@ -35,14 +35,9 @@ public String getTextImpl() { return comment.getText(); } - @Override - public void defTextImpl(String value) { - comment.setText(value); - } - @Override public void setTextImpl(String text) { - defTextImpl(text); + comment.setText(text); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxEnumDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxEnumDecl.java index 70b2cb7a50..817dc948b4 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxEnumDecl.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxEnumDecl.java @@ -13,8 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.decl.EnumConstantDecl; import pt.up.fe.specs.clava.ast.decl.EnumDecl; @@ -36,14 +34,9 @@ public ClavaNode getNode() { return enumDecl; } - @Override - public List selectEnumerator() { - return CxxSelects.select(AEnumeratorDecl.class, enumDecl.getChildren(), false, EnumConstantDecl.class); - } - @Override public AEnumeratorDecl[] getEnumeratorsArrayImpl() { - return selectEnumerator().toArray(new AEnumeratorDecl[0]); + return CxxSelects.select(AEnumeratorDecl.class, enumDecl.getChildren(), false, EnumConstantDecl.class).toArray(new AEnumeratorDecl[0]); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxExpression.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxExpression.java index c35e49cb25..dbd9f9827d 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxExpression.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxExpression.java @@ -103,11 +103,6 @@ public static List selectVarDecl(AExpression expression) { return Arrays.asList(vardecl); } - @Override - public List selectVardecl() { - return selectVarDecl(this); - } - @Override public Boolean getIsFunctionArgumentImpl() { return expr.isFunctionArgument(); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFile.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFile.java index 18dfbed95b..6d08b6996f 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFile.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFile.java @@ -19,42 +19,23 @@ import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaNode; -import pt.up.fe.specs.clava.ast.comment.Comment; -import pt.up.fe.specs.clava.ast.decl.CXXMethodDecl; -import pt.up.fe.specs.clava.ast.decl.CXXRecordDecl; import pt.up.fe.specs.clava.ast.decl.Decl; import pt.up.fe.specs.clava.ast.decl.FunctionDecl; import pt.up.fe.specs.clava.ast.decl.IncludeDecl; -import pt.up.fe.specs.clava.ast.decl.RecordDecl; -import pt.up.fe.specs.clava.ast.decl.TypedefDecl; import pt.up.fe.specs.clava.ast.decl.VarDecl; import pt.up.fe.specs.clava.ast.expr.LiteralExpr; import pt.up.fe.specs.clava.ast.extra.TranslationUnit; -import pt.up.fe.specs.clava.ast.lara.LaraMarkerPragma; -import pt.up.fe.specs.clava.ast.lara.LaraTagPragma; -import pt.up.fe.specs.clava.ast.pragma.Pragma; import pt.up.fe.specs.clava.ast.stmt.WrapperStmt; import pt.up.fe.specs.clava.ast.type.Type; import pt.up.fe.specs.clava.weaver.CxxActions; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; import pt.up.fe.specs.clava.weaver.CxxSelects; import pt.up.fe.specs.clava.weaver.CxxWeaver; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AClass; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AComment; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ADecl; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFile; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunction; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AInclude; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMarker; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMethod; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.APragma; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ARecord; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStruct; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATag; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AType; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATypedefDecl; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl; import pt.up.fe.specs.clava.weaver.importable.AstFactory; import pt.up.fe.specs.util.SpecsIo; @@ -81,20 +62,6 @@ public void setNameImpl(String filename) { tunit.set(TranslationUnit.SOURCE_FILE, newFile); } - @Override - public List selectFunction() { - return getFunctions().stream() - .map(function -> CxxJoinpoints.create(function, AFunction.class)) - .collect(Collectors.toList()); - } - - @Override - public List selectMethod() { - return getMethods().stream() - .map(function -> CxxJoinpoints.create(function, AMethod.class)) - .collect(Collectors.toList()); - } - @Override public TranslationUnit getNode() { return tunit; @@ -119,14 +86,6 @@ private List getFunctions() { .collect(Collectors.toList()); } - private List getMethods() { - return tunit.getDescendantsStream() - // FunctionDecl represents C function, C++ methods, constructors and destructors - .filter(node -> node instanceof CXXMethodDecl) - .map(function -> (CXXMethodDecl) function) - .collect(Collectors.toList()); - } - @Override public void addIncludeImpl(String name, boolean isAngled) { tunit.addInclude(name, isAngled); @@ -176,42 +135,6 @@ public AJoinPoint insertBeforeImpl(AJoinPoint node) { return node; } - @Override - public List selectPragma() { - return CxxSelects.select(APragma.class, tunit.getChildren(), true, Pragma.class); - - } - - @Override - public List selectMarker() { - return CxxSelects.select(AMarker.class, tunit.getChildren(), true, LaraMarkerPragma.class); - } - - @Override - public List selectTag() { - return CxxSelects.select(ATag.class, tunit.getChildren(), true, LaraTagPragma.class); - } - - @Override - public List selectRecord() { - return CxxSelects.select(ARecord.class, tunit.getChildren(), true, RecordDecl.class); - } - - @Override - public List selectStruct() { - return CxxSelects.select(AStruct.class, tunit.getChildren(), true, - // node -> node instanceof RecordDecl && ((RecordDecl) node).getTagKind() == TagKind.STRUCT); - // Structs: RecordDecls that are not CXXRecordDecls - node -> node instanceof RecordDecl && !(node instanceof CXXRecordDecl)); - } - - @Override - public List selectClass() { - return CxxSelects.select(AClass.class, tunit.getChildren(), true, - // node -> node instanceof CXXRecordDecl && ((CXXRecordDecl) node).getTagKind() == TagKind.CLASS); - CXXRecordDecl.class); - } - @Override public String getPathImpl() { return tunit.getFolderpath().orElse(null); @@ -258,14 +181,9 @@ public String getRelativeFolderpathImpl() { return tunit.getRelativeFolderpath().orElse(null); } - @Override - public void defRelativeFolderpathImpl(String value) { - tunit.setRelativePath(value); - } - @Override public void setRelativeFolderpathImpl(String path) { - defRelativeFolderpathImpl(path); + tunit.setRelativePath(path); } @Override @@ -278,14 +196,6 @@ public Boolean getIsCxxImpl() { return tunit.isCXXUnit(); } - @Override - public List selectVardecl() { - return tunit.getDescendantsStream() - .filter(node -> node instanceof VarDecl) - .map(varDecl -> CxxJoinpoints.create((VarDecl) varDecl, AVardecl.class)) - .collect(Collectors.toList()); - } - @Override public AVardecl addGlobalImpl(String name, AJoinPoint type, String initValue) { @@ -303,19 +213,6 @@ public AVardecl addGlobalImpl(String name, AJoinPoint type, String initValue) { return CxxJoinpoints.create(global, AVardecl.class); } - @Override - public List selectStmt() { - return CxxSelects.select(AStatement.class, tunit.getChildren(), true, CxxSelects::stmtFilter); - - } - - @Override - public List selectChildStmt() { - return tunit.getChildren().stream() - .map(stmt -> (AStatement) CxxJoinpoints.create(stmt)) - .collect(Collectors.toList()); - } - @Override public void insertBeginImpl(AJoinPoint node) { if (!tunit.hasChildren()) { @@ -346,11 +243,6 @@ public void insertEndImpl(String code) { insertEndImpl(AstFactory.declLiteral(code)); } - @Override - public List selectComment() { - return CxxSelects.select(AComment.class, tunit.getChildren(), true, Comment.class::isInstance); - } - @Override public AJoinPoint addFunctionImpl(String name) { CxxFunction function = AstFactory.functionVoid(name); @@ -385,14 +277,9 @@ public Boolean getIsOpenCLImpl() { return tunit.isOpenCLFile(); } - @Override - public List selectInclude() { - return CxxSelects.select(AInclude.class, tunit.getChildren(), false, IncludeDecl.class); - } - @Override public AInclude[] getIncludesArrayImpl() { - return selectInclude().toArray(size -> new AInclude[size]); + return CxxSelects.select(AInclude.class, tunit.getChildren(), false, IncludeDecl.class).toArray(size -> new AInclude[size]); } @Override @@ -402,19 +289,6 @@ public String getBaseSourcePathImpl() { return tunit.getRelativeFolderpath().orElse(null); } - @Override - public List selectDecl() { - return CxxSelects.select(ADecl.class, tunit.getChildren(), true, Decl.class); - } - - @Override - public List selectTypedefDecl() { - return tunit.getDescendantsStream() - .filter(node -> node instanceof TypedefDecl) - .map(varDecl -> CxxJoinpoints.create((TypedefDecl) varDecl, ATypedefDecl.class)) - .collect(Collectors.toList()); - } - @Override public String getDestinationFilepathImpl(String destinationFolderpath) { File file; diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFunction.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFunction.java index 31374f61bc..d98e58cf0b 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFunction.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxFunction.java @@ -28,7 +28,6 @@ import pt.up.fe.specs.clava.ast.type.Type; import pt.up.fe.specs.clava.weaver.CxxActions; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; -import pt.up.fe.specs.clava.weaver.CxxSelects; import pt.up.fe.specs.clava.weaver.CxxWeaver; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.*; import pt.up.fe.specs.clava.weaver.importable.AstFactory; @@ -40,16 +39,10 @@ import java.io.File; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.stream.Collectors; public class CxxFunction extends AFunction { - - // TODO: Move this to generated enums -// private static final Lazy> STORAGE_CLASS = EnumHelperWithValue - // .newLazyHelperWithValue(StorageClass.class); - private final FunctionDecl function; public CxxFunction(FunctionDecl function) { @@ -57,13 +50,6 @@ public CxxFunction(FunctionDecl function) { this.function = function; } - @Override - public List selectBody() { - var body = getBodyImpl(); - - return body == null ? Collections.emptyList() : Arrays.asList(body); - } - @Override public FunctionDecl getNode() { return function; @@ -166,13 +152,6 @@ private AJoinPoint[] insertStmt(Stmt newNode, String position) { } } - @Override - public List selectParam() { - return function.getParameters().stream() - .map(param -> CxxJoinpoints.create(param, AParam.class)) - .collect(Collectors.toList()); - } - @Override public String getDeclarationImpl(Boolean withReturnType) { return function.getDeclarationId(withReturnType); @@ -328,15 +307,6 @@ public AFunction cloneOnFileImpl(String newName, AFile file) { return cloneFunction; } - // /** - // * XXX: copied from CallWrap - // */ - // private List getIncludesCopyFromFile(TranslationUnit tu) { - // - // return TreeNodeUtils.copy(tu.getIncludes().getIncludes()); - // - // } - @Override public String[] getParamNamesArrayImpl() { @@ -349,7 +319,11 @@ public String[] getParamNamesArrayImpl() { @Override public AParam[] getParamsArrayImpl() { - return selectParam().toArray(new AParam[0]); + return function.getParameters() + .stream() + .map(param -> CxxJoinpoints.create(param, AParam.class)) + .collect(Collectors.toList()) + .toArray(new AParam[0]); } @Override @@ -453,7 +427,7 @@ public void setTypeImpl(AType type) { } @Override - public void defNameImpl(String value) { + public void setNameImpl(String name) { // Set both the names of corresponding definition and declaration // Needs to first fetch both definition and declaration. // If one is renamed before fetching the other, the other will not be found @@ -461,13 +435,8 @@ public void defNameImpl(String value) { var impl = function.getImplementation(); var proto = function.getPrototypes(); - impl.ifPresent(node -> node.setName(value)); - proto.stream().forEach(node -> node.setName(value)); - } - - @Override - public void setNameImpl(String name) { - defNameImpl(name); + impl.ifPresent(node -> node.setName(name)); + proto.stream().forEach(node -> node.setName(name)); } @Override @@ -508,12 +477,6 @@ public Boolean getIsDeleteImpl() { return function.get(FunctionDecl.IS_DELETED); } - @Override - public List selectDecl() { - SpecsLogs.info("[DEPRECATED] Selecting 'decl' from 'function' is deprecated"); - return CxxSelects.select(ADecl.class, function.getChildren(), true, Decl.class); - } - @Override public ACall[] getCallsArrayImpl() { return function.getCalls().stream() @@ -522,8 +485,9 @@ public ACall[] getCallsArrayImpl() { } @Override - public void defParamsImpl(AParam[] value) { - List newParams = Arrays.stream(value) + public void setParamsImpl(AParam[] params) { + List newParams = Arrays.stream( + params) .map(param -> (ParmVarDecl) param.getNode()) .collect(Collectors.toList()); @@ -531,29 +495,19 @@ public void defParamsImpl(AParam[] value) { } @Override - public void defParamsImpl(String[] value) { - AParam[] params = new AParam[value.length]; + public void setParamsFromStringsImpl(String[] params) { + AParam[] newParams = new AParam[params.length]; // Each value is a type - varName pair, separate them by last space - for (int i = 0; i < value.length; i++) { - String typeVarname = value[i]; + for (int i = 0; i < params.length; i++) { + String typeVarname = params[i]; var parmVarDecl = ClavaNodes.toParam(typeVarname, function); - params[i] = CxxJoinpoints.create(parmVarDecl, AParam.class); + newParams[i] = CxxJoinpoints.create(parmVarDecl, AParam.class); } - defParamsImpl(params); - } - - @Override - public void setParamsImpl(AParam[] params) { - defParamsImpl(params); - } - - @Override - public void setParamsFromStringsImpl(String[] params) { - defParamsImpl(params); + setParamsImpl(newParams); } @Override @@ -561,24 +515,14 @@ public String getSignatureImpl() { return function.getSignature(); } - @Override - public void defBodyImpl(AScope value) { - function.setBody((CompoundStmt) value.getNode()); - } - @Override public void setBodyImpl(AScope body) { - defBodyImpl(body); - } - - @Override - public void defFunctionTypeImpl(AFunctionType value) { - function.setFunctionType((FunctionType) value.getNode()); + function.setBody((CompoundStmt) body.getNode()); } @Override public void setFunctionTypeImpl(AFunctionType functionType) { - defFunctionTypeImpl(functionType); + function.setFunctionType((FunctionType) functionType.getNode()); } @Override @@ -586,14 +530,9 @@ public AType getReturnTypeImpl() { return CxxJoinpoints.create(function.getReturnType(), AType.class); } - @Override - public void defReturnTypeImpl(AType value) { - function.setReturnType((Type) value.getNode()); - } - @Override public void setReturnTypeImpl(AType returnType) { - defReturnTypeImpl(returnType); + function.setReturnType((Type) returnType.getNode()); } @Override @@ -608,7 +547,7 @@ public void addParamImpl(AParam param) { newParams[newParams.length - 1] = param; - defParamsImpl(newParams); + setParamsImpl(newParams); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxGotoStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxGotoStmt.java index 6079e0b38c..e84a9e7dc2 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxGotoStmt.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxGotoStmt.java @@ -35,14 +35,9 @@ public ClavaNode getNode() { return gotoStmt; } - @Override - public void defLabelImpl(ALabelDecl value) { - gotoStmt.setLabel((LabelDecl) value.getNode()); - } - @Override public void setLabelImpl(ALabelDecl label) { - defLabelImpl(label); + gotoStmt.setLabel((LabelDecl) label.getNode()); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxIf.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxIf.java index 52bf774e73..e055a259ac 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxIf.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxIf.java @@ -45,91 +45,49 @@ public ClavaNode getNode() { } @Override - public List selectCond() { - if (!(ifStmt.getCondition() instanceof Expr)) { - return Collections.emptyList(); - } - - return Arrays.asList(CxxJoinpoints.create(ifStmt.getCondition(), AExpression.class)); - } - - @Override - public List selectThen() { - return ifStmt.getThen().map(then -> Arrays.asList(CxxJoinpoints.create(then, AScope.class))) - .orElse(Collections.emptyList()); - } - - @Override - public List selectElse() { - return SpecsCollections.toStream(ifStmt.getElse()) - .map(stmt -> CxxJoinpoints.create(stmt, AScope.class)) - .collect(Collectors.toList()); - } - - @Override - public List selectBody() { - return selectThen(); - } + public AExpression getCondImpl() { + List list = Collections.emptyList(); - @Override - public List selectCondDecl() { - return SpecsCollections.toList(ifStmt.getDeclCondition() - .map(varDecl -> CxxJoinpoints.create(varDecl, AVardecl.class))); - // if (!(ifStmt.getCondition() instanceof VarDecl)) { - // return Collections.emptyList(); - // } - // - // return Arrays.asList(CxxJoinpoints.create((VarDecl) ifStmt.getCondition(), this, AVardecl.class)); - } + if ((ifStmt.getCondition() instanceof Expr)) { + list = Arrays.asList(CxxJoinpoints.create(ifStmt.getCondition(), AExpression.class)); + } - @Override - public AExpression getCondImpl() { - return SpecsCollections.orElseNull(selectCond()); + return SpecsCollections.orElseNull(list); } @Override public AVardecl getCondDeclImpl() { - return SpecsCollections.orElseNull(selectCondDecl()); + return SpecsCollections.orElseNull(SpecsCollections.toList(ifStmt.getDeclCondition() + .map(varDecl -> CxxJoinpoints.create(varDecl, AVardecl.class)))); } @Override public AScope getThenImpl() { - return SpecsCollections.orElseNull(selectThen()); + return SpecsCollections.orElseNull( + ifStmt.getThen().map(then -> Arrays.asList(CxxJoinpoints.create(then, AScope.class))) + .orElse(Collections.emptyList())); } @Override public AScope getElseImpl() { - return SpecsCollections.orElseNull(selectElse()); - } - - @Override - public void defCondImpl(AExpression value) { - ifStmt.setCondition((Expr) value.getNode()); + return SpecsCollections.orElseNull(SpecsCollections.toStream(ifStmt.getElse()) + .map(stmt -> CxxJoinpoints.create(stmt, AScope.class)) + .collect(Collectors.toList())); } @Override public void setCondImpl(AExpression cond) { - defCondImpl(cond); - } - - @Override - public void defThenImpl(AStatement value) { - ifStmt.setThen((Stmt) value.getNode()); + ifStmt.setCondition((Expr) cond.getNode()); } @Override public void setThenImpl(AStatement then) { - defThenImpl(then); - } - - @Override - public void defElseImpl(AStatement value) { - ifStmt.setElse((Stmt) value.getNode()); + ifStmt.setThen((Stmt) then.getNode()); } @Override public void setElseImpl(AStatement _else) { - defElseImpl(_else); + ifStmt.setElse((Stmt) _else.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLabelStmt.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLabelStmt.java index e0157ea0b3..c19170b491 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLabelStmt.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLabelStmt.java @@ -34,14 +34,9 @@ public ALabelDecl getDeclImpl() { return CxxJoinpoints.create(labelStmt.getLabelDecl(), ALabelDecl.class); } - @Override - public void defDeclImpl(ALabelDecl value) { - labelStmt.setLabelDecl((LabelDecl) value.getNode()); - } - @Override public void setDeclImpl(ALabelDecl label) { - defDeclImpl(label); + labelStmt.setLabelDecl((LabelDecl) label.getNode()); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLoop.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLoop.java index acee190ef7..3245ac2321 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLoop.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxLoop.java @@ -13,8 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import com.google.common.base.Preconditions; -import org.lara.interpreter.utils.DefMap; import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; @@ -30,10 +28,8 @@ import pt.up.fe.specs.clava.weaver.CxxWeaver; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.*; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.enums.ALoopKindEnum; -import pt.up.fe.specs.clava.weaver.defs.CxxLoopDefs; import pt.up.fe.specs.clava.weaver.enums.Relation; import pt.up.fe.specs.util.SpecsEnums; -import pt.up.fe.specs.util.exceptions.NotImplementedException; import pt.up.fe.specs.util.lazy.Lazy; import pt.up.fe.specs.util.lazy.ThreadSafeLazy; @@ -70,39 +66,12 @@ public CxxLoop(LoopStmt loop) { public String getKindImpl() { ALoopKindEnum loopType = LOOP_TYPE.get().get(loop.getClass()); - Preconditions.checkNotNull(loopType, - "Could not determine type of node '" + loop.getClass().getSimpleName() + "'"); + Objects.requireNonNull(loopType, + () -> "Could not determine type of node '" + loop.getClass().getSimpleName() + "'"); return loopType.name().toLowerCase(); } - @Override - protected DefMap getDefMap() { - return CxxLoopDefs.getDefMap(); - } - - /* - @Override - public int getIncrementValue() { - // Only supported for loops of type 'for' - if (!(loop instanceof ForStmt)) { - return 0; - } - - ForStmt forLoop = (ForStmt) loop; - - Stmt inc = forLoop.getInc().orElse(null); - if (inc == null) { - return 0; - } - - // TODO: Regular expression for ++; / --; - System.out.println("INC CODE:" + inc); - - return 0; - } - */ - @Override public Boolean getIsInnermostImpl() { // Loop is innermost if none of its descendants is a loop @@ -172,28 +141,6 @@ public String getControlVarImpl() { return controlVarref.getNameImpl(); } - @Override - public List selectInit() { - if (!(loop instanceof ForStmt)) { - return Collections.emptyList(); - } - - Stmt init = ((ForStmt) loop).getInit().orElse(null); - if (init == null) { - return Collections.emptyList(); - - } - - return Arrays.asList(CxxJoinpoints.create(init, AStatement.class)); - } - - @Override - public List selectCond() { - var condition = getCondImpl(); - - return condition != null ? Arrays.asList(condition) : Collections.emptyList(); - } - @Override public AStatement getCondImpl() { ClavaNode condition = loop.getStmtCondition().orElse(null); @@ -205,13 +152,6 @@ public AStatement getCondImpl() { return CxxJoinpoints.create(ClavaNodes.toStmt(condition), AStatement.class); } - @Override - public List selectStep() { - var step = getStepImpl(); - - return step != null ? Arrays.asList(step) : Collections.emptyList(); - } - @Override public AStatement getStepImpl() { if (!(loop instanceof ForStmt)) { @@ -227,14 +167,6 @@ public AStatement getStepImpl() { return CxxJoinpoints.create(inc, AStatement.class); } - @Override - public List selectBody() { - // return loop.getBody() - // .map(body -> Arrays.asList(CxxJoinpoints.create(body, this, AScope.class))) - // .orElse(Collections.emptyList()); - return Arrays.asList(CxxJoinpoints.create(loop.getBody(), AScope.class)); - } - @Override public LoopStmt getNode() { return loop; @@ -249,27 +181,8 @@ public int[] getRankArrayImpl() { @Override public Boolean getIsParallelImpl() { return loop.isParallel(); - /* - // Map> defMap = new HashMap<>(); - // defMap.put("qq", obj -> consumerString(obj)); - - // Check if loop is annotated with pragma "parallel" - List pragmas = ClavaNodes.getPragmas(getNode()); - - boolean result = pragmas.stream() - .filter(pragma -> pragma.getName().equals("clava")) - .filter(clavaPragma -> clavaPragma.getContent().equals("parallel")) - .findFirst() - .isPresent(); - - return result; - */ } - // private void consumerString(String s) { - // - // } - @Override public Integer getIterationsImpl() { return loop.getIterations(); @@ -318,74 +231,27 @@ private void convertToWhile() { } - @Override - public void defInitImpl(String value) { - if (!(loop instanceof ForStmt)) { - return; // TODO: warn user? - } - - var suffix = value.strip().endsWith(";") ? "" : ";"; - LiteralStmt literalStmt = getFactory().literalStmt(value + suffix); - - ((ForStmt) loop).setInit(literalStmt); - } - @Override public void setInitImpl(String initCode) { - defInitImpl(initCode); - /* - // ClavaLog.deprecated("action $loop.exec setInit is deprecated, please use setInitValue instead"); - // setInitValue(initCode); - if (!(loop instanceof ForStmt)) { return; // TODO: warn user? } - - LiteralStmt literalStmt = ClavaNodeFactory.literalStmt(initCode + ";"); - - ((ForStmt) loop).setInit(literalStmt); - */ - } - /* - @Override - public void setInitValueImpl(String initCode) { - // if (!(loop instanceof ForStmt)) { - // return; // TODO: warn user? - // } - // - // LiteralStmt literalStmt = ClavaNodeFactory.literalStmt(initCode + ";"); - // - // ((ForStmt) loop).setInit(literalStmt); - defInitValueImpl(initCode); - } - - @Override - public void defInitValueImpl(String value) { - if (!(loop instanceof ForStmt)) { - return; // TODO: warn user? - } - - LiteralStmt literalStmt = ClavaNodeFactory.literalStmt(value + ";"); - + var suffix = initCode.strip().endsWith(";") ? "" : ";"; + LiteralStmt literalStmt = getFactory().literalStmt(initCode + suffix); + ((ForStmt) loop).setInit(literalStmt); } - */ @Override public void setInitValueImpl(String initCode) { - defInitValueImpl(initCode); - } - - @Override - public void defInitValueImpl(String value) { if (!(loop instanceof ForStmt)) { return; // TODO: warn user? } Type intType = CxxWeaver.getFactory().builtinType(BuiltinKind.Int); - ((ForStmt) loop).setInitValue(CxxWeaver.getFactory().literalExpr(value, intType)); + ((ForStmt) loop).setInitValue(CxxWeaver.getFactory().literalExpr(initCode, intType)); } @Override @@ -568,12 +434,11 @@ private BinaryOperator getConditionOp(boolean showWarnings) { } @Override - public void defCondRelationImpl(String value) { - BinaryOperatorKind kind = BinaryOperatorKind.getHelper().fromValueTry(value).orElse(null); - // BinaryOperatorKind kind = SpecsEnums.valueOfTry(BinaryOperatorKind.class, value).orElse(null); + public void setCondRelationImpl(String operator) { + BinaryOperatorKind kind = BinaryOperatorKind.getHelper().fromValueTry(operator).orElse(null); if (kind == null) { - ClavaLog.info("def 'condRelation': Invalid binary operator " + value); + ClavaLog.info("def 'condRelation': Invalid binary operator " + operator); return; } @@ -591,30 +456,6 @@ public void defCondRelationImpl(String value) { condOp.set(BinaryOperator.OP, kind); } - @Override - public void setCondRelationImpl(String operator) { - defCondRelationImpl(operator); - } - - private BinaryOperatorKind getOpKind(Relation relation) { - switch (relation) { - case EQ: - return BinaryOperatorKind.EQ; - case GE: - return BinaryOperatorKind.GE; - case GT: - return BinaryOperatorKind.GT; - case LE: - return BinaryOperatorKind.LE; - case LT: - return BinaryOperatorKind.LT; - case NE: - return BinaryOperatorKind.NE; - default: - throw new NotImplementedException(relation); - } - } - @Override public String getIdImpl() { return loop.getLoopId(); @@ -657,19 +498,9 @@ public AStatement tileImpl(String blockSize, AStatement reference, Boolean useTe } - @Override - public void defIsParallelImpl(Boolean value) { - loop.setParallel(value); - } - - @Override - public void defIsParallelImpl(String value) { - loop.setParallel(Boolean.parseBoolean(value)); - } - @Override public void setIsParallelImpl(Boolean isParallel) { - defIsParallelImpl(isParallel); + loop.setParallel(isParallel); } @Override @@ -730,14 +561,9 @@ public AScope getBodyImpl() { return (AScope) CxxJoinpoints.create(loop.getBody()); } - @Override - public void defBodyImpl(AScope value) { - loop.setBody((CompoundStmt) value.getNode()); - } - @Override public void setBodyImpl(AScope body) { - defBodyImpl(body); + loop.setBody((CompoundStmt) body.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMarker.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMarker.java index 20c5c349c3..5c6965104e 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMarker.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMarker.java @@ -13,7 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; import java.util.List; import com.google.common.base.Preconditions; @@ -57,21 +56,4 @@ public AScope getContentsImpl() { return result.get(0); } - - @Override - public List selectContents() { - return Arrays.asList(getContentsImpl()); - /* - List result = CxxSelects.select(AScope.class, SpecsCollections.toList(marker.getTarget()), - false, - node -> node instanceof CompoundStmt && ((CompoundStmt) node).isNestedScope(), - node -> new CxxScope((CompoundStmt) node, this)); - // if (!result.isEmpty()) { - // System.out.println("RESULT:" + result.get(0).getNode().getCode()); - // } - - return result; - */ - } - } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMemberAccess.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMemberAccess.java index 3055effbb3..b674ad1fc2 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMemberAccess.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxMemberAccess.java @@ -67,14 +67,9 @@ public Boolean getArrowImpl() { return memberExpr.get(MemberExpr.IS_ARROW); } - @Override - public void defArrowImpl(Boolean value) { - memberExpr.set(MemberExpr.IS_ARROW, value); - } - @Override public void setArrowImpl(Boolean isArrow) { - defArrowImpl(isArrow); + memberExpr.set(MemberExpr.IS_ARROW, isArrow); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxNamedDecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxNamedDecl.java index 5eb0bf1d04..b3d0a6193f 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxNamedDecl.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxNamedDecl.java @@ -65,12 +65,7 @@ public Boolean getIsPublicImpl() { @Override public void setNameImpl(String name) { - defNameImpl(name); - } - - @Override - public void defNameImpl(String value) { - namedDecl.set(NamedDecl.DECL_NAME, value); + namedDecl.set(NamedDecl.DECL_NAME, name); } @Override @@ -83,24 +78,14 @@ public String getQualifiedNameImpl() { return namedDecl.getFullyQualifiedName(); } - @Override - public void defQualifiedPrefixImpl(String value) { - namedDecl.set(NamedDecl.QUALIFIED_PREFIX, value); - } - - @Override - public void defQualifiedNameImpl(String value) { - namedDecl.setQualifiedName(value); - } - @Override public void setQualifiedPrefixImpl(String qualifiedPrefix) { - defQualifiedPrefixImpl(qualifiedPrefix); + namedDecl.set(NamedDecl.QUALIFIED_PREFIX, qualifiedPrefix); } @Override public void setQualifiedNameImpl(String name) { - defQualifiedNameImpl(name); + namedDecl.setQualifiedName(name); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxOmp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxOmp.java index d3dbae4f8b..dca7b3a99e 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxOmp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxOmp.java @@ -309,14 +309,4 @@ public void setKindImpl(String directiveKindString) { // Update parent join point this.aPragma = new CxxPragma(ompPragma); } - - @Override - public void defNumThreadsImpl(String value) { - setNumThreads(value); - } - - @Override - public void defProcBindImpl(String value) { - setProcBind(value); - } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxPragma.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxPragma.java index 2429d6c37e..ae10b682d0 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxPragma.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxPragma.java @@ -13,9 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.pragma.Pragma; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; @@ -65,11 +62,6 @@ public void setPragma(Pragma pragma) { this.pragma = pragma; } - @Override - public List selectTarget() { - return Arrays.asList(getTargetImpl()); - } - @Override public AJoinPoint[] getTargetNodesArrayImpl(String endPragma) { var pragmaNodes = pragma.getPragmaNodes(endPragma); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxProgram.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxProgram.java index a66d75c81b..b1e32ec8b7 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxProgram.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxProgram.java @@ -28,13 +28,13 @@ import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunction; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AProgram; -import pt.up.fe.specs.util.SpecsCheck; import pt.up.fe.specs.util.SpecsIo; import pt.up.fe.specs.util.SpecsLogs; import java.io.File; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -59,13 +59,6 @@ public CxxProgram(String name, App app, CxxWeaver weaver) { this.weaver = weaver; } - @Override - public List selectFile() { - return app.getTranslationUnits().stream() - .map(tunit -> CxxJoinpoints.create(tunit, AFile.class)) - .collect(Collectors.toList()); - } - @Override public App getNode() { return app; @@ -332,7 +325,7 @@ public void atexitImpl(AFunction function) { // Add include for atexit // ClavaLog.debug("Getting file ancestor"); AFile file = (AFile) mainFunction.getAncestorImpl("file"); - SpecsCheck.checkNotNull(file, () -> "Expected main function to be inside a file: " + mainFunction.getNode()); + Objects.requireNonNull(file, () -> "Expected main function to be inside a file: " + mainFunction.getNode()); // ClavaLog.debug("Adding stdlib.h include"); file.addInclude("stdlib.h", true); @@ -345,6 +338,8 @@ public void atexitImpl(AFunction function) { @Override public AFile[] getFilesArrayImpl() { - return selectFile().toArray(size -> new AFile[size]); + return app.getTranslationUnits().stream() + .map(tunit -> CxxJoinpoints.create(tunit, AFile.class)) + .collect(Collectors.toList()).toArray(size -> new AFile[size]); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxRecord.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxRecord.java index 4456e5fe08..6c0b7a9d3e 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxRecord.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxRecord.java @@ -13,7 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; import java.util.stream.Collectors; import pt.up.fe.specs.clava.ClavaNode; @@ -22,7 +21,6 @@ import pt.up.fe.specs.clava.weaver.CxxJoinpoints; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AField; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunction; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ARecord; public class CxxRecord extends ARecord { @@ -40,15 +38,10 @@ public ClavaNode getNode() { } @Override - public List selectField() { + public AField[] getFieldsArrayImpl() { return recordDecl.getFields().stream() .map(field -> CxxJoinpoints.create(field, AField.class)) - .collect(Collectors.toList()); - } - - @Override - public AField[] getFieldsArrayImpl() { - return selectField().toArray(new AField[0]); + .collect(Collectors.toList()).toArray(new AField[0]); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxScope.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxScope.java index 2df28ad0f1..af5ad1d938 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxScope.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxScope.java @@ -14,26 +14,14 @@ package pt.up.fe.specs.clava.weaver.joinpoints; import java.util.List; -import java.util.stream.Collectors; - import pt.up.fe.specs.clava.ClavaLog; import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; import pt.up.fe.specs.clava.analysis.flow.control.ControlFlowGraph; import pt.up.fe.specs.clava.analysis.flow.data.DataFlowGraph; -import pt.up.fe.specs.clava.ast.cilk.CilkFor; -import pt.up.fe.specs.clava.ast.cilk.CilkSync; -import pt.up.fe.specs.clava.ast.comment.Comment; import pt.up.fe.specs.clava.ast.decl.VarDecl; import pt.up.fe.specs.clava.ast.expr.Expr; -import pt.up.fe.specs.clava.ast.lara.LaraMarkerPragma; -import pt.up.fe.specs.clava.ast.lara.LaraTagPragma; -import pt.up.fe.specs.clava.ast.omp.OmpPragma; -import pt.up.fe.specs.clava.ast.pragma.Pragma; import pt.up.fe.specs.clava.ast.stmt.CompoundStmt; -import pt.up.fe.specs.clava.ast.stmt.IfStmt; -import pt.up.fe.specs.clava.ast.stmt.LoopStmt; -import pt.up.fe.specs.clava.ast.stmt.ReturnStmt; import pt.up.fe.specs.clava.ast.stmt.Stmt; import pt.up.fe.specs.clava.ast.stmt.WrapperStmt; import pt.up.fe.specs.clava.ast.type.Type; @@ -42,19 +30,9 @@ import pt.up.fe.specs.clava.weaver.CxxSelects; import pt.up.fe.specs.clava.weaver.CxxWeaver; import pt.up.fe.specs.clava.weaver.Insert; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkFor; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkSync; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AComment; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AIf; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ALoop; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMarker; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AOmp; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.APragma; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AReturnStmt; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AScope; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATag; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AType; import pt.up.fe.specs.clava.weaver.importable.AstFactory; import pt.up.fe.specs.util.SpecsLogs; @@ -182,78 +160,19 @@ private List getStatements() { return scope.toStatements(); } - @Override - public List selectStmt() { - return CxxSelects.select(AStatement.class, getStatements(), true, CxxSelects::stmtFilter); - } - - @Override - public List selectChildStmt() { - return getStatements().stream().map(stmt -> (AStatement) CxxJoinpoints.create(stmt)) - .collect(Collectors.toList()); - } - - @Override - public List selectScope() { - // It is a scope if the parent is a compound statement - return CxxSelects.select(AScope.class, getStatements(), true, - node -> node instanceof CompoundStmt && ((CompoundStmt) node).isNestedScope()); - - } - - @Override - public List selectIf() { - return CxxSelects.select(AIf.class, getStatements(), true, IfStmt.class); - } - - @Override - public List selectLoop() { - return CxxSelects.select(ALoop.class, getStatements(), true, LoopStmt.class); - } - - @Override - public List selectPragma() { - return CxxSelects.select(APragma.class, getStatements(), true, Pragma.class); - } - - @Override - public List selectMarker() { - return CxxSelects.select(AMarker.class, getStatements(), true, LaraMarkerPragma.class); - } - - @Override - public List selectTag() { - return CxxSelects.select(ATag.class, getStatements(), true, LaraTagPragma.class); - } - @Override public void clearImpl() { CxxActions.removeChildren(scope, getWeaverEngine()); } - @Override - public List selectOmp() { - return CxxSelects.select(AOmp.class, getStatements(), true, OmpPragma.class); - } - - @Override - public List selectComment() { - return CxxSelects.select(AComment.class, getStatements(), true, Comment.class::isInstance); - } - @Override public Boolean getNakedImpl() { return scope.isNaked(); } - @Override - public void defNakedImpl(Boolean value) { - scope.setNaked(value); - } - @Override public void setNakedImpl(Boolean isNaked) { - defNakedImpl(isNaked); + scope.setNaked(isNaked); } @Override @@ -294,7 +213,7 @@ public AStatement[] getStmtsArrayImpl() { @Override public AStatement[] getAllStmtsArrayImpl() { - return selectStmt().toArray(new AStatement[0]); + return CxxSelects.select(AStatement.class, getStatements(), true, CxxSelects::stmtFilter).toArray(new AStatement[0]); } @Override @@ -326,23 +245,6 @@ public AJoinPoint getOwnerImpl() { return getParentImpl(); } - @Override - public List selectReturnStmt() { - return CxxSelects.select(AReturnStmt.class, getStatements(), true, ReturnStmt.class); - } - - @Override - public List selectCilkFor() { - return CxxSelects.select(ACilkFor.class, getStatements(), true, CilkFor.class); - - } - - @Override - public List selectCilkSync() { - return CxxSelects.select(ACilkSync.class, getStatements(), true, CilkSync.class); - - } - @Override public String cfgImpl() { ControlFlowGraph cfg = new ControlFlowGraph(scope); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxStatement.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxStatement.java index f528f7ef03..66cddb1251 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxStatement.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxStatement.java @@ -13,47 +13,13 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.Collections; import java.util.List; -import java.util.stream.Collectors; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; -import pt.up.fe.specs.clava.ast.cilk.CilkSpawn; -import pt.up.fe.specs.clava.ast.decl.DeclaratorDecl; -import pt.up.fe.specs.clava.ast.decl.ValueDecl; -import pt.up.fe.specs.clava.ast.decl.VarDecl; -import pt.up.fe.specs.clava.ast.expr.ArraySubscriptExpr; -import pt.up.fe.specs.clava.ast.expr.BinaryOperator; -import pt.up.fe.specs.clava.ast.expr.CXXDeleteExpr; -import pt.up.fe.specs.clava.ast.expr.CXXMemberCallExpr; -import pt.up.fe.specs.clava.ast.expr.CXXNewExpr; -import pt.up.fe.specs.clava.ast.expr.CallExpr; -import pt.up.fe.specs.clava.ast.expr.DeclRefExpr; -import pt.up.fe.specs.clava.ast.expr.Expr; -import pt.up.fe.specs.clava.ast.expr.MemberExpr; -import pt.up.fe.specs.clava.ast.expr.Operator; -import pt.up.fe.specs.clava.ast.expr.UnaryOperator; -import pt.up.fe.specs.clava.ast.stmt.ExprStmt; import pt.up.fe.specs.clava.ast.stmt.Stmt; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; -import pt.up.fe.specs.clava.weaver.CxxSelects; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AArrayAccess; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ABinaryOp; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACall; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ACilkSpawn; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ADeleteExpr; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMemberAccess; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AMemberCall; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ANewExpr; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AOp; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AStatement; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AUnaryOp; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVarref; import pt.up.fe.specs.util.treenode.NodeInsertUtils; public class CxxStatement extends AStatement { @@ -80,43 +46,6 @@ public AJoinPoint replaceWithImpl(AJoinPoint node) { return CxxJoinpoints.create(newStmt); } - @Override - public List selectStmtCall() { - List statements = stmt.toStatements(); - - if (statements.size() != 1) { - return Collections.emptyList(); - } - - Stmt statement = statements.get(0); - - if (!(statement instanceof ExprStmt)) { - return Collections.emptyList(); - } - - // Expression statement - Expr expr = ((ExprStmt) statement).getExpr(); - if (!(expr instanceof CallExpr)) { - return Collections.emptyList(); - } - - return Arrays.asList((ACall) CxxJoinpoints.create(expr)); - } - - @Override - public List selectCall() { - return stmt.getDescendantsAndSelfStream() - .filter(node -> node instanceof CallExpr) - .map(loop -> (ACall) CxxJoinpoints.create(loop)) - .collect(Collectors.toList()); - } - - @Override - public List selectMemberCall() { - return CxxSelects.select(AMemberCall.class, stmt.getChildren(), true, - node -> node instanceof CXXMemberCallExpr); - } - @Override public Boolean getIsFirstImpl() { // Get parent and check Stmt position on that list @@ -135,126 +64,4 @@ public Boolean getIsLastImpl() { // return stmt.indexOfSelf() == stmt.getParentImpl().numChildren(); } - - @Override - public List selectArrayAccess() { - return stmt.getDescendantsStream() - .filter(ArraySubscriptExpr.class::isInstance) - .map(ArraySubscriptExpr.class::cast) - .filter(ArraySubscriptExpr::isTopLevel) - // .filter(CxxStatement::isTopLevelArraySubscript) - .map(arraySub -> (AArrayAccess) CxxJoinpoints.create(arraySub)) - .collect(Collectors.toList()); - - } - - // private static boolean isTopLevelArraySubscript(ArraySubscriptExpr expr) { - // ClavaNode parent = ClavaNodes.getParentNormalized(expr); - // if (!(parent instanceof ArraySubscriptExpr)) { - // return true; - // } - // - // // Parent can be an ArraySubscriptExpr, if expr is not the first child - // ClavaNode normalizedFirstChild = ClavaNodes.normalize(parent.getChild(0)); - // - // return normalizedFirstChild != expr; - // } - - @Override - public List selectVardecl() { - return CxxSelects.select(AVardecl.class, stmt.getChildren(), true, VarDecl.class); - - } - - @Override - public List selectVarref() { - return CxxSelects.select(AVarref.class, stmt.getChildren(), true, - // node -> node instanceof DeclRefExpr && !((DeclRefExpr) node).isFunctionCall()); - CxxStatement::isVarref); - } - - private static boolean isVarref(ClavaNode node) { - // Must be a DeclRefExpr - if (!(node instanceof DeclRefExpr)) { - return false; - } - - DeclRefExpr declRefExpr = (DeclRefExpr) node; - - // Filter DeclRefExprs that are a FunctionCall - if (declRefExpr.isFunctionCall()) { - return false; - } - - // Filter DeclRefExprs that do not have DeclaratorDecl as decls - /* - Optional declTry = declRefExpr.getDeclaration(); - if (!declTry.isPresent()) { - SpecsLogs.msgInfo("Could not find declaration for reference " + declRefExpr.getRefName() + " at " - + declRefExpr.getLocation()); - return false; - } - */ - ValueDecl decl = declRefExpr.getDeclaration(); - - // declRefExpr.getDeclaration() - // .orElseThrow(() -> new RuntimeException("Could not find declaration of " + declRefExpr.getExprData)); - // if (!(declRefExpr.getDeclaration() instanceof DeclaratorDecl)) { - - // Decl decl = declRefExpr.getDeclaration(); - // if (!(declTry.get() instanceof DeclaratorDecl)) { - if (!(decl instanceof DeclaratorDecl)) { - // if (!(decl instanceof DeclaratorDecl)) { - return false; - } - - return true; - } - - @Override - public List selectExpr() { - return CxxSelects.select(AExpression.class, stmt.getChildren(), true, Expr.class); - } - - @Override - public List selectChildExpr() { - // Since it is direct, normalize children - - return CxxSelects.select(AExpression.class, stmt.getChildrenNormalized(), false, Expr.class); - } - - @Override - public List selectOp() { - return CxxSelects.select(AOp.class, stmt.getChildrenNormalized(), true, Operator.class); - } - - @Override - public List selectBinaryOp() { - return CxxSelects.select(ABinaryOp.class, stmt.getChildrenNormalized(), true, BinaryOperator.class); - } - - @Override - public List selectUnaryOp() { - return CxxSelects.select(AUnaryOp.class, stmt.getChildrenNormalized(), true, UnaryOperator.class); - } - - @Override - public List selectNewExpr() { - return CxxSelects.select(ANewExpr.class, stmt.getChildrenNormalized(), true, CXXNewExpr.class); - } - - @Override - public List selectDeleteExpr() { - return CxxSelects.select(ADeleteExpr.class, stmt.getChildrenNormalized(), true, CXXDeleteExpr.class); - } - - @Override - public List selectMemberAccess() { - return CxxSelects.select(AMemberAccess.class, stmt.getChildrenNormalized(), true, MemberExpr.class); - } - - @Override - public List selectCilkSpawn() { - return CxxSelects.select(ACilkSpawn.class, stmt.getChildrenNormalized(), true, CilkSpawn.class); - } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxTernaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxTernaryOp.java index 671b98ab0b..195fc4b1ee 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxTernaryOp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxTernaryOp.java @@ -13,12 +13,8 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.expr.ConditionalOperator; -import pt.up.fe.specs.clava.ast.expr.Expr; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AExpression; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.ATernaryOp; @@ -52,35 +48,4 @@ public AExpression getTrueExprImpl() { public AExpression getFalseExprImpl() { return CxxJoinpoints.create(op.getFalseExpr(), AExpression.class); } - - @Override - public List selectCond() { - return Arrays.asList(getCondImpl()); - } - - @Override - public List selectTrueExpr() { - return Arrays.asList(getTrueExprImpl()); - } - - @Override - public List selectFalseExpr() { - return Arrays.asList(getFalseExprImpl()); - } - - @Override - public void defCondImpl(AExpression value) { - op.setCondition((Expr) value.getNode()); - } - - @Override - public void defTrueExprImpl(AExpression value) { - op.setTrueExpr((Expr) value.getNode()); - } - - @Override - public void defFalseExprImpl(AExpression value) { - op.setFalseExpr((Expr) value.getNode()); - } - } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryExprOrType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryExprOrType.java index 18c0cc69ac..6586b0c37e 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryExprOrType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryExprOrType.java @@ -66,27 +66,13 @@ public AExpression getArgExprImpl() { } @Override - public void defArgTypeImpl(AType value) { + public void setArgTypeImpl(AType argType) { if (!expr.hasTypeExpression()) { SpecsLogs.msgInfo("UnaryExprOrType '" + expr.getUettKind() + "' does not have a type argument"); return; } - expr.setArgType((Type) value.getNode()); - - // SpecsLogs.msgInfo("Setting the argument type of an UnaryExprOrType is currently disabled"); - return; - // if (!expr.hasTypeExpression()) { - // SpecsLogs.msgInfo("UnaryExprOrType '" + expr.getUettKind() + "' does not have a type argument"); - // return; - // } - // - // expr.setArgType((Type) value.getNode()); - } - - @Override - public void setArgTypeImpl(AType argType) { - defArgTypeImpl(argType); + expr.setArgType((Type) argType.getNode()); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java index 808ed42706..70a784f035 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxUnaryOp.java @@ -13,9 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.Arrays; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ClavaNodes; import pt.up.fe.specs.clava.ast.expr.UnaryOperator; @@ -48,11 +45,6 @@ public Boolean getIsPointerDerefImpl() { return unaryOp.getOp() == UnaryOperatorKind.Deref; } - @Override - public List selectOperand() { - return Arrays.asList((AExpression) getOperandImpl()); - } - @Override public Boolean getIsBitwiseImpl() { return unaryOp.getOp().isBitwise(); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVardecl.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVardecl.java index 6dbb005370..85bbe44b48 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVardecl.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVardecl.java @@ -13,8 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; - import pt.up.fe.specs.clava.ClavaNode; import pt.up.fe.specs.clava.ast.decl.VarDecl; import pt.up.fe.specs.clava.ast.expr.Expr; @@ -24,7 +22,6 @@ import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVardecl; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AVarref; import pt.up.fe.specs.clava.weaver.importable.AstFactory; -import pt.up.fe.specs.util.SpecsCollections; public class CxxVardecl extends AVardecl { @@ -41,14 +38,6 @@ public ClavaNode getNode() { return varDecl; } - @Override - public List selectInit() { - return SpecsCollections.toList( - varDecl.getInit() - .map(init -> (AExpression) CxxJoinpoints.create(init))); - - } - @Override public Boolean getHasInitImpl() { return varDecl.getInit().isPresent(); @@ -63,14 +52,9 @@ public AExpression getInitImpl() { public void setInitImpl(AExpression init) { if (init == null) { removeInitImpl(true); + } else { + varDecl.setInit((Expr) init.getNode()); } - - // if (init instanceof AExpression) { - // SpecsLogs.msgInfo("vardecl.setInit: join point must an instance of 'expression'"); - // return; - // } - - varDecl.setInit((Expr) init.getNode()); } @Override @@ -97,14 +81,9 @@ public String getStorageClassImpl() { return varDecl.get(VarDecl.STORAGE_CLASS).getString(); } - @Override - public void defStorageClassImpl(String value) { - varDecl.setStorageClass(value); - } - @Override public void setStorageClassImpl(String storageClass) { - defStorageClassImpl(storageClass); + varDecl.setStorageClass(storageClass); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVarref.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVarref.java index 179600303d..58277c8424 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVarref.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/CxxVarref.java @@ -13,7 +13,6 @@ package pt.up.fe.specs.clava.weaver.joinpoints; -import java.util.List; import java.util.Optional; import pt.up.fe.specs.clava.ast.decl.DeclaratorDecl; @@ -46,14 +45,9 @@ public String getNameImpl() { return refExpr.getRefName(); } - @Override - public void defNameImpl(String value) { - refExpr.setRefName(value); - } - @Override public void setNameImpl(String name) { - defNameImpl(name); + refExpr.setRefName(name); } @Override @@ -66,15 +60,6 @@ public AExpression getUseExprImpl() { return CxxJoinpoints.create(refExpr.getUseExpr(), AExpression.class); } - /* - @Override - public String getUseImpl() { - ExprUse use = ((Expr) getUseExprImpl().getNode()).use(); - - return CxxAttributes.convertUse(use); - } - */ - @Override public AVardecl getVardeclImpl() { ADeclarator declarator = getDeclarationImpl(); @@ -82,11 +67,6 @@ public AVardecl getVardeclImpl() { return declarator instanceof AVardecl ? (AVardecl) declarator : null; } - @Override - public List selectVardecl() { - return CxxExpression.selectVarDecl(this); - } - @Override public Boolean getIsFunctionCallImpl() { return refExpr.isFunctionCall(); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxArrayType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxArrayType.java index 0c81b40910..d06e86a319 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxArrayType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxArrayType.java @@ -40,14 +40,9 @@ public AType getElementTypeImpl() { return CxxJoinpoints.create(arrayType.getElementType(), AType.class); } - @Override - public void defElementTypeImpl(AType value) { - arrayType.setElementType((Type) value.getNode()); - } - @Override public void setElementTypeImpl(AType arrayElementType) { - defElementTypeImpl(arrayElementType); + arrayType.setElementType((Type) arrayElementType.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxFunctionType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxFunctionType.java index 3fcbb5864c..2936ee35e5 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxFunctionType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxFunctionType.java @@ -17,7 +17,6 @@ import pt.up.fe.specs.clava.ast.type.Type; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AFunctionType; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AType; public class CxxFunctionType extends AFunctionType { @@ -48,15 +47,10 @@ public AType[] getParamTypesArrayImpl() { } - @Override - public void defReturnTypeImpl(AType value) { - Type newClavaType = (Type) value.getNode(); - type.set(FunctionType.RETURN_TYPE, newClavaType); - } - @Override public void setReturnTypeImpl(AType newType) { - defReturnTypeImpl(newType); + Type newClavaType = (Type) newType.getNode(); + type.set(FunctionType.RETURN_TYPE, newClavaType); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxParenType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxParenType.java index 3712a998fc..c464e764ec 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxParenType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxParenType.java @@ -40,14 +40,9 @@ public AType getInnerTypeImpl() { return CxxJoinpoints.create(parenType.getInnerType(), AType.class); } - @Override - public void defInnerTypeImpl(AType value) { - var newType = (Type) value.getNode(); - parenType.setInnerType(newType); - } - @Override public void setInnerTypeImpl(AType innerType) { - defInnerTypeImpl(innerType); + var newType = (Type) innerType.getNode(); + parenType.setInnerType(newType); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxPointerType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxPointerType.java index ed19a43f89..d7e90b6c7b 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxPointerType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxPointerType.java @@ -45,14 +45,9 @@ public Integer getPointerLevelsImpl() { return pointerType.getPointerLevels(); } - @Override - public void defPointeeImpl(AType value) { - pointerType.set(PointerType.POINTEE_TYPE, (Type) value.getNode()); - } - @Override public void setPointeeImpl(AType pointeeType) { - defPointeeImpl(pointeeType); + pointerType.set(PointerType.POINTEE_TYPE, (Type) pointeeType.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxType.java index 42a0d2c339..5c8548a0ea 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxType.java @@ -32,7 +32,6 @@ import pt.up.fe.specs.clava.ast.type.ConstantArrayType; import pt.up.fe.specs.clava.ast.type.Type; import pt.up.fe.specs.clava.weaver.CxxJoinpoints; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AType; public class CxxType extends AType { @@ -109,14 +108,9 @@ public AType getDesugarAllImpl() { return CxxJoinpoints.create(type.desugarAll(), AType.class); } - @Override - public void defDesugarImpl(AType value) { - type.setDesugar((Type) value.getNode()); - } - @Override public void setDesugarImpl(AType desugaredType) { - defDesugarImpl(desugaredType); + type.setDesugar((Type) desugaredType.getNode()); } @Override @@ -166,18 +160,13 @@ public AType[] getTemplateArgsTypesArrayImpl() { } @Override - public void defTemplateArgsTypesImpl(AType[] value) { - List argTypes = Arrays.stream(value) + public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { + List argTypes = Arrays.stream( + templateArgTypes) .map(aType -> (Type) aType.getNode()) .collect(Collectors.toList()); type.setTemplateArgumentTypes(argTypes); - - } - - @Override - public void setTemplateArgsTypesImpl(AType[] templateArgTypes) { - defTemplateArgsTypesImpl(templateArgTypes); } @Override diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxVariableArrayType.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxVariableArrayType.java index 965be1b022..c16e1bb618 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxVariableArrayType.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/joinpoints/types/CxxVariableArrayType.java @@ -40,14 +40,9 @@ public AExpression getSizeExprImpl() { return (AExpression) CxxJoinpoints.create(arrayType.get(VariableArrayType.SIZE_EXPR)); } - @Override - public void defSizeExprImpl(AExpression value) { - arrayType.set(VariableArrayType.SIZE_EXPR, (Expr) value.getNode()); - } - @Override public void setSizeExprImpl(AExpression sizeExpr) { - defSizeExprImpl(sizeExpr); + arrayType.set(VariableArrayType.SIZE_EXPR, (Expr) sizeExpr.getNode()); } } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOption.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOption.java index 7e2959cff2..776949df1d 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOption.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOption.java @@ -1,11 +1,11 @@ /** * Copyright 2016 SPeCS. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. under the License. @@ -19,7 +19,6 @@ import org.suikasoft.jOptions.Datakey.KeyFactory; import org.suikasoft.jOptions.storedefinition.StoreDefinition; import org.suikasoft.jOptions.storedefinition.StoreDefinitionBuilder; - import pt.up.fe.specs.clang.ClangAstKeys; import pt.up.fe.specs.clang.codeparser.CodeParser; import pt.up.fe.specs.clang.codeparser.ParallelCodeParser; @@ -30,7 +29,7 @@ public interface CxxWeaverOption { DataKey WOVEN_CODE_FOLDERNAME = KeyFactory.string("Weaved code foldername") .setLabel("Name of woven code folder") - .setDefault(() -> CxxWeaver.getWovenCodeFoldername()); + .setDefault(CxxWeaver::getWovenCodeFoldername); DataKey DISABLE_CLAVA_INFO = KeyFactory.bool("Disable Clava Info") .setLabel("Disable Clava execution information"); @@ -43,15 +42,15 @@ public interface CxxWeaverOption { DataKey HEADER_INCLUDES = LaraIKeyFactory.folderList("header includes") .setLabel("Normal Includes") - .setDefault(() -> FileList.newInstance()); + .setDefault(FileList::newInstance); // DataKey SKIP_HEADER_INCLUDES_PARSING = KeyFactory.bool("skipHeaderIncludesParsing") // .setLabel("Skip parsing of header files"); // .setDefault(() -> true); DataKey PARSE_INCLUDES = KeyFactory.bool("parseIncludes") - .setLabel("Parses header files"); - // .setDefault(() -> true); + .setLabel("Parses header files") + .setDefault(() -> true); DataKey SYSTEM_INCLUDES = LaraIKeyFactory.folderList("library includes") .setLabel("System Includes") @@ -107,7 +106,7 @@ public interface CxxWeaverOption { .addKey(ParallelCodeParser.PARALLEL_PARSING) .addKey(ParallelCodeParser.PARSING_NUM_THREADS) .addKey(ParallelCodeParser.CONTINUE_ON_PARSING_ERRORS) - .addKey(CodeParser.CUSTOM_CLANG_AST_DUMPER_EXE) + .addKey(CodeParser.DUMPER_FOLDER) .build(); } diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOptions.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOptions.java index ba29632b00..260519dec3 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOptions.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/options/CxxWeaverOptions.java @@ -1,11 +1,11 @@ /** * Copyright 2017 SPeCS. - * + *

* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + *

* http://www.apache.org/licenses/LICENSE-2.0 - * + *

* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. under the License. @@ -13,15 +13,10 @@ package pt.up.fe.specs.clava.weaver.options; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - import org.lara.interpreter.weaver.options.OptionArguments; import org.lara.interpreter.weaver.options.WeaverOption; import org.lara.interpreter.weaver.options.WeaverOptionBuilder; import org.suikasoft.jOptions.Datakey.DataKey; - import pt.up.fe.specs.clang.ClangAstKeys; import pt.up.fe.specs.clang.LibcMode; import pt.up.fe.specs.clang.codeparser.CodeParser; @@ -31,9 +26,14 @@ import pt.up.fe.specs.clava.language.Standard; import pt.up.fe.specs.clava.weaver.CxxWeaver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + public class CxxWeaverOptions { private static final Map WEAVER_OPTIONS; + static { WEAVER_OPTIONS = new HashMap<>(); WEAVER_OPTIONS.put(ClavaOptions.STANDARD.getName(), @@ -141,17 +141,20 @@ public class CxxWeaverOptions { "ignore-header-includes", "", "Headers to ignore when recreating #include directives (Java regexes)"); - addOneArgOption(CodeParser.CUSTOM_CLANG_AST_DUMPER_EXE, "cde", "custom_dumper_exe", "dumper_exe", - "Path to a ClangAstDumper executable file"); + addOneArgOption(CodeParser.DUMPER_FOLDER, "df", "dumper-folder", + "dir", + CodeParser.DUMPER_FOLDER.getLabel()); + + } private static final void addBooleanOption(DataKey key, String shortOption, String longOption, - String description) { + String description) { WEAVER_OPTIONS.put(key.getName(), WeaverOptionBuilder.build(shortOption, longOption, description, key)); } private static final void addOneArgOption(DataKey key, String shortOption, String longOption, String argName, - String description) { + String description) { WEAVER_OPTIONS.put(key.getName(), WeaverOptionBuilder.build(shortOption, longOption, OptionArguments.ONE_ARG, argName, description, key)); diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/AttributeDirective.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/AttributeDirective.java deleted file mode 100644 index b1ee2338c2..0000000000 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/AttributeDirective.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright 2018 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.clava.weaver.pragmas; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import com.google.common.base.Preconditions; - -import pt.up.fe.specs.clava.ClavaLog; -import pt.up.fe.specs.clava.weaver.abstracts.joinpoints.AJoinPoint; -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.parsing.arguments.ArgumentsParser; - -public class AttributeDirective implements ClavaDirective { - - private final List select; - private final Map setters; - - public AttributeDirective(List select, Map setters) { - this.select = select; - this.setters = setters; - } - - // public static Optional parse(Pragma clavaPragma) { - // String pragmaName = clavaPragma.getName(); - // - // Preconditions.checkArgument(pragmaName.toLowerCase().equals("clava"), - // "Expected pragma name to be 'clava', is " + pragmaName); - // - // // Check if is a directive 'attribute' - // StringParser parser = new StringParser(clavaPragma.getContent()); - // if (!parser.apply(StringParsers::hasWord, "attribute")) { - // return Optional.empty(); - // } - // - // return parse(parser.toString()); - // } - - public static AttributeDirective parse(String directiveContent) { - - List clauses = ArgumentsParser.newPragmaText().parse(directiveContent); - - List select = new ArrayList<>(); - Map setters = new HashMap<>(); - - for (String clause : clauses) { - int openParIndex = clause.indexOf('('); - - // If no open parenthesis, assume clause is the key, and value is 'true' - if (openParIndex == -1) { - setters.put(clause, "true"); - continue; - } - - // Split the key name from the value - Preconditions.checkArgument(clause.endsWith(")"), "Expected clause '" + clause + "' to end with ')'"); - String key = clause.substring(0, openParIndex); - String value = clause.substring(openParIndex + 1, clause.length() - 1); - - // Special key 'select' - if (key.equals("select")) { - // Check if there was already a select - if (!select.isEmpty()) { - ClavaLog.info("Overwriting previous 'select' clause with content '" + select + "'"); - } - - select = Arrays.asList(value.split("\\.")); - continue; - } - - // Store key-value pair - setters.put(key, value); - } - - // System.out.println("STRING:" + directiveContent); - // System.out.println("PARSED STRING:\n" + clauses.stream().collect(Collectors.joining("\n"))); - /* - // Apply parsing rules - while (!parser.isEmpty()) { - - } - */ - // System.out.println("SELECT:" + select); - // System.out.println("SETTERS:" + setters); - return new AttributeDirective(select, setters); - } - - @Override - public void apply(AJoinPoint jp) { - - // Apply select - if (!select.isEmpty()) { - List selectedJps = selectJps(Arrays.asList(jp), select); - for (AJoinPoint selectedJp : selectedJps) { - new AttributeDirective(Collections.emptyList(), setters).apply(selectedJp); - } - return; - } - - // Apply each setter on joinpoint using def - for (Entry entry : setters.entrySet()) { - jp.defImpl(entry.getKey(), entry.getValue()); - } - - } - - private static List selectJps(List jps, List select) { - - List currentJps = jps; - - for (String selectName : select) { - // Create select jps - List selectedJps = new ArrayList<>(); - - // For each of current join point, apply select - for (AJoinPoint jp : currentJps) { - selectedJps.addAll(SpecsCollections.cast(jp.select(selectName), AJoinPoint.class)); - } - - // Make select jps be current jps - currentJps = selectedJps; - } - // System.out.println("CURRENT JPS:" + currentJps); - return currentJps; - - // Preconditions.checkArgument(select.isEmpty(), "Select must not be empty"); - // - // if (select.size() == 1) { - // String selectJp = select.get(0); - // List selectedJps = new ArrayList<>(); - // for (AJoinPoint jp : jps) { - // selectedJps.addAll(SpecsCollections.cast(jp.select(selectJp), AJoinPoint.class)); - // } - // - // return selectedJps; - // } - // - // // TODO Auto-generated method stub - // return null; - } -} diff --git a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/ClavaPragmas.java b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/ClavaPragmas.java index 70ce3e7dd9..967ef91ab1 100644 --- a/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/ClavaPragmas.java +++ b/ClavaWeaver/src/pt/up/fe/specs/clava/weaver/pragmas/ClavaPragmas.java @@ -25,18 +25,12 @@ import pt.up.fe.specs.clava.weaver.abstracts.ACxxWeaverJoinPoint; import pt.up.fe.specs.util.stringparser.StringParser; import pt.up.fe.specs.util.stringparser.StringParsers; -import tdrc.utils.StringUtils; public class ClavaPragmas { - private static final String JOINPOINTS_PACKAGE_PREFIX = "pt.up.fe.specs.cxxweaver.abstracts.joinpoints."; - private static final Map> CLAVA_DIRECTIVES_MAP; static { CLAVA_DIRECTIVES_MAP = new HashMap<>(); - CLAVA_DIRECTIVES_MAP.put("attribute", AttributeDirective::parse); - // CLAVA_DIRECTIVES_MAP.put("opencl", OpenCLDirective::parse); - // CLAVA_DIRECTIVES_MAP.put("attribute", content -> AttributeDirective::parse); } public static void processClavaPragmas(App app) { @@ -60,83 +54,9 @@ private static void processClavaPragma(Pragma clavaPragma) { clavaDirective.ifPresent(directive -> directive.apply(jp)); return; } - // Optional<> - // if (parser.apply(StringParsers::hasWord, "attribute")) { - // new ClavaAttributeClause(clavaPragma).parse(parser.toString()); - // return; - // } - - StringParser parser = new StringParser(clavaPragma.getContent()); - - if (!parser.apply(StringParsers::peekStartsWith, "def ")) { - return; - } - - // Check if starts with name of joinpoint - boolean hasJoinpoint = parser.apply(StringParsers::checkStringStarts, "$").isPresent(); - String joinpointName = null; - if (hasJoinpoint) { - joinpointName = parser.apply(StringParsers::parseWord); - } - - var target = clavaPragma.getTarget(); - if (!target.isPresent()) { - ClavaLog.warning(clavaPragma, "Clava pragma could not be associated with a joinpoint"); - return; - } - - // Create joinpoint - ACxxWeaverJoinPoint joinpoint = CxxJoinpoints.create(target.get(), null); - - // Validate joinpoint, if present - if (joinpointName != null) { - // Make first letter uppercase - String className = StringUtils.firstCharToUpper(joinpointName); - // Prefix 'A' - className = "A" + className; - - try { - Class joinpointTestClass = Class.forName(JOINPOINTS_PACKAGE_PREFIX + className); - if (!joinpointTestClass.isInstance(joinpoint)) { - ClavaLog.warning(clavaPragma, - "Clava pragma associated to a joinpoint $" + joinpoint.getJoinPointType() - + ", which is not compatible with the joinpoint $" + joinpointName - + " defined in the pragma"); - } - } catch (ClassNotFoundException e) { - ClavaLog.warning(clavaPragma, - "The weaver does not recognize the joinpoit $" + joinpointName + " in Clava pragma"); - } - } - - // Simple approach for now, enhance it as needed - // Split remaining contents by the comma - String[] defs = parser.getCurrentString().toString().split(","); - for (String def : defs) { - def = def.trim(); - - // Find index of = - int equalIndex = def.indexOf('='); - - // If index is not present, assume that we should set a bool value to true - if (equalIndex == -1) { - joinpoint.def(def, Boolean.TRUE); - continue; - } - - String attribute = def.substring(0, equalIndex).trim(); - String value = def.substring(equalIndex + 1).trim(); - - joinpoint.def(attribute, value); - } } private static Optional getDirective(Pragma clavaPragma) { - // String pragmaName = clavaPragma.getName(); - - // Preconditions.checkArgument(pragmaName.toLowerCase().equals("clava"), - // "Expected pragma name to be 'clava', is " + pragmaName); - // Check directive StringParser parser = new StringParser(clavaPragma.getContent()); @@ -153,14 +73,6 @@ private static Optional getDirective(Pragma clavaPragma) { } return Optional.of(directiveBuilder.apply(parser.toString())); - // if (!parser.apply(StringParsers::parseWordhasWord, "attribute")) { - // return Optional.empty(); - // } - - // return parse(parser.toString()); - // - // // TODO Auto-generated method stub - // return null; } } diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/ClavaWeaverTester.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/ClavaWeaverTester.java deleted file mode 100644 index 62764c4ed6..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/ClavaWeaverTester.java +++ /dev/null @@ -1,323 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver; - -import larai.LaraI; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import org.lara.interpreter.joptions.config.interpreter.VerboseLevel; -import org.lara.interpreter.joptions.keys.FileList; -import org.lara.interpreter.joptions.keys.OptionalFile; -import org.lara.interpreter.weaver.interf.WeaverEngine; -import org.suikasoft.jOptions.Datakey.DataKey; -import org.suikasoft.jOptions.Interfaces.DataStore; -import pt.up.fe.specs.clang.codeparser.ParallelCodeParser; -import pt.up.fe.specs.clang.dumper.ClangAstDumper; -import pt.up.fe.specs.clava.ClavaLog; -import pt.up.fe.specs.clava.ClavaOptions; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.clava.weaver.CxxWeaver; -import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; -import pt.up.fe.specs.util.SpecsCollections; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsStrings; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.providers.ResourceProvider; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class ClavaWeaverTester { - - private static final boolean DEBUG = SpecsSystem.isDebug(); - - private static final String WORK_FOLDER = "cxx_weaver_output"; - - private final String basePackage; - private final Standard standard; - private final String compilerFlags; - - private boolean checkWovenCodeSyntax; - private boolean checkExpectedOutput; - private String srcPackage; - private String resultPackage; - private String resultsFile; - private boolean run; - private final DataStore additionalSettings; - // private boolean debug; - - public ClavaWeaverTester(String basePackage, Standard standard, String compilerFlags) { - this.basePackage = basePackage; - this.standard = standard; - this.compilerFlags = compilerFlags; - - - this.checkWovenCodeSyntax = true; - srcPackage = null; - resultPackage = null; - resultsFile = null; - run = true; - additionalSettings = DataStore.newInstance("Additional Settings"); - checkExpectedOutput = true; - // debug = false; - } - - public ClavaWeaverTester checkExpectedOutput(boolean checkExpectedOutput) { - this.checkExpectedOutput = checkExpectedOutput; - - return this; - } - - /** - * @param checkWovenCodeSyntax - * @return the previous value - */ - public ClavaWeaverTester setCheckWovenCodeSyntax(boolean checkWovenCodeSyntax) { - this.checkWovenCodeSyntax = checkWovenCodeSyntax; - - return this; - } - - public ClavaWeaverTester(String basePackage, Standard standard) { - this(basePackage, standard, ""); - } - - public ClavaWeaverTester setResultPackage(String resultPackage) { - this.resultPackage = sanitizePackage(resultPackage); - - return this; - } - - public ClavaWeaverTester setSrcPackage(String srcPackage) { - this.srcPackage = sanitizePackage(srcPackage); - - return this; - } - - public ClavaWeaverTester doNotRun() { - run = false; - return this; - } - - // public ClavaWeaverTester debug() { - // this.debug = true; - // - // return this; - // } - - public void setResultsFile(String resultsFile) { - this.resultsFile = resultsFile; - } - - public ClavaWeaverTester set(DataKey key, ET value) { - this.additionalSettings.set(key, value); - - return this; - } - - public ClavaWeaverTester set(DataKey key) { - this.additionalSettings.set(key, true); - - return this; - } - - private String sanitizePackage(String packageName) { - String sanitizedPackage = packageName; - if (!sanitizedPackage.endsWith("/")) { - sanitizedPackage += "/"; - } - - return sanitizedPackage; - } - - private ResourceProvider buildCodeResource(String codeResourceName) { - StringBuilder builder = new StringBuilder(); - - builder.append(basePackage); - if (srcPackage != null) { - builder.append(srcPackage); - } - - builder.append(codeResourceName); - - return () -> builder.toString(); - } - - public void test(String laraResource, String... codeResource) { - test(laraResource, Arrays.asList(codeResource)); - } - - public void test(String laraResource, List codeResources) { - SpecsLogs.msgInfo("\n---- Testing '" + laraResource + "' ----\n"); - - if (!run) { - ClavaLog.info("Ignoring test, 'run' flag is not set"); - return; - } - - List codes = SpecsCollections.map(codeResources, this::buildCodeResource); - - File log = runCxxWeaver(() -> basePackage + laraResource, codes); - - // Do not check expected output - if (!this.checkExpectedOutput) { - return; - } - - String logContents = SpecsIo.read(log); - - StringBuilder expectedResourceBuilder = new StringBuilder(); - expectedResourceBuilder.append(basePackage); - if (resultPackage != null) { - expectedResourceBuilder.append(resultPackage); - } - - String actualResultsFile = resultsFile != null ? resultsFile : laraResource + ".txt"; - - // expectedResourceBuilder.append(laraResource).append(".txt"); - expectedResourceBuilder.append(actualResultsFile); - - String expectedResource = expectedResourceBuilder.toString(); - // String expectedResource = basePackage + laraResource + ".txt"; - if (!SpecsIo.hasResource(expectedResource)) { - SpecsLogs.msgInfo("Could not find resource '" + expectedResource - + "', skipping verification. Actual output:\n" + logContents); - - throw new RuntimeException("Expected outputs not found"); - // return; - } - - assertEquals(normalize(SpecsIo.getResource(expectedResource)), normalize(logContents)); - } - - /** - * Normalizes endlines - * - * @param resource - * @return - */ - private static String normalize(String string) { - return SpecsStrings.normalizeFileContents(string, true); - // return string.replaceAll("\r\n", "\n"); - } - - private File runCxxWeaver(ResourceProvider lara, List code) { - // Prepare folder - File workFolder = SpecsIo.mkdir(WORK_FOLDER); - SpecsIo.deleteFolderContents(workFolder); - - // Prepare files - - code.forEach(resource -> resource.write(workFolder)); - // code.forEach(resource -> SpecsIo.resourceCopy(resource.getResource(), workFolder, true, true)); - File laraFile = lara.write(workFolder); - - DataStore data = DataStore.newInstance("CxxWeaverTest"); - - // Set LaraI configurations - data.add(LaraiKeys.LARA_FILE, laraFile); - data.add(LaraiKeys.OUTPUT_FOLDER, workFolder); - // Add workspace folder if code is not empty - if (!code.isEmpty()) { - data.add(LaraiKeys.WORKSPACE_FOLDER, FileList.newInstance(workFolder)); - } - - // data.add(LaraiKeys.VERBOSE, VerboseLevel.all); - data.add(LaraiKeys.VERBOSE, VerboseLevel.errors); - - // data.add(LaraiKeys.DEBUG_MODE, true); - - data.add(LaraiKeys.TRACE_MODE, true); - data.add(LaraiKeys.LOG_JS_OUTPUT, Boolean.TRUE); - data.add(LaraiKeys.LOG_FILE, OptionalFile.newInstance(getWeaverLog().getAbsolutePath())); - - // Set CxxWeaver configurations~ - if (standard != null) { - data.set(ClavaOptions.STANDARD, standard); - } - - data.set(ClavaOptions.FLAGS, compilerFlags); - data.set(CxxWeaverOption.CHECK_SYNTAX, checkWovenCodeSyntax); - data.set(CxxWeaverOption.DISABLE_CLAVA_INFO, false); - data.set(CxxWeaverOption.DISABLE_CODE_GENERATION); - - // Enable parallel parsing - data.set(ParallelCodeParser.PARALLEL_PARSING); - - // TEMP - // data.set(ClavaOptions.DISABLE_NEW_PARSING_METHOD, true); - - if (DEBUG) { - data.set(CxxWeaverOption.CLEAN_INTERMEDIATE_FILES, false); - } - - // Add additional settings - data.addAll(additionalSettings); - - CxxWeaver weaver = new CxxWeaver(); - try { - boolean result = LaraI.exec(data, weaver); - // Check weaver executed correctly - assertTrue(result); - } catch (Exception e) { - // After LaraI execution, static weaver is unset, and it is no longer safe to use the weaver instance, - // unless we set the weaver again - if (weaver.getAppTry().isPresent()) { - weaver.setWeaver(); - SpecsLogs.msgInfo("Current code:\n" + weaver.getApp().getCode()); - WeaverEngine.removeWeaver(); - } else { - SpecsLogs.msgInfo("App not created"); - } - - throw new RuntimeException("Problems during weaving", e); - } - - // Return true if result is 0 - // return result == 0 ? true : false; - - return getWeaverLog(); - } - - public static File getWorkFolder() { - return new File(WORK_FOLDER); - } - - public static File getWeaverLog() { - return new File(WORK_FOLDER, "test.log"); - } - - // public static void clean() { - // clean(DEBUG); - // } - // - // public static void clean(boolean isDebug) { - public static void clean() { - if (DEBUG) { - return; - } - // Delete CWeaver folder - File workFolder = ClavaWeaverTester.getWorkFolder(); - SpecsIo.deleteFolder(workFolder); - - // Delete weaver files - ClangAstDumper.getTempFiles().stream() - .forEach(filename -> new File(filename).delete()); - } - -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CApiTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CApiTest.java deleted file mode 100644 index 1af0a9b545..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CApiTest.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import org.lara.interpreter.joptions.config.interpreter.LaraiKeys; -import pt.up.fe.specs.clava.ClavaOptions; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.lang.SpecsPlatforms; -import pt.up.fe.specs.util.SpecsSystem; - -public class CApiTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/api/", Standard.C99) - .setSrcPackage("c/src/") - .setResultPackage("c/results/"); - } - - @Test - public void testLogger() { - newTester().test("LoggerTest.lara", "logger_test.c"); - } - - @Test - public void testTimer() { - ClavaWeaverTester tester = newTester(); - if (SpecsPlatforms.isUnix()) { - tester.setResultsFile("TimerTest.lara.unix.txt"); - } - - tester.test("TimerTest.lara", "timer_test.c"); - } - - /** - * Compiles C code, but with C++ flag. - */ - @Test - public void testTimerWithCxxFlag() { - ClavaWeaverTester tester = newTester(); - if (SpecsPlatforms.isUnix()) { - // Test not working on Unix - return; - // tester.set(ClavaOptions.STANDARD, Standard.C11).setResultsFile("TimerTest.lara.unix.txt"); - } - - tester.set(ClavaOptions.STANDARD, Standard.CXX11).test("TimerTest.lara", "timer_test.c"); - } - - @Test - public void testEnergy() { - // Disable syntax check of woven code, rapl include is not available - newTester().setCheckWovenCodeSyntax(false) - .test("EnergyTest.lara", "energy_test.c"); - } - - @Test - public void testAutoPar() { - if (SpecsPlatforms.isUnix()) { - // Enable restrict mode, to test if it works - // Using AutoPar example since it needs to call an external program - newTester().set(LaraiKeys.RESTRICT_MODE, Boolean.TRUE) - .test("AutoParTest.lara", "autopar_test.c"); - } - - } - - @Test - public void testCodeInserter() { - newTester() - // .set(LaraiKeys.DEBUG_MODE) - // .set(LaraiKeys.VERBOSE, VerboseLevel.all) - .test("CodeInserterTest.js", "code_inserter.c"); - } - - @Test - public void testArrayLinearizer() { - // newTester().test("ArrayLinearizerTest.lara", "2d_array.c"); - // newTester().test("ArrayLinearizerTest.lara", "3d_array.c"); - newTester().test("ArrayLinearizerTest.lara", "qr.c"); - } - - @Test - public void testSelector() { - newTester().test("SelectorTest.lara", "selector_test.c"); - } - - @Test - public void testAutoParInline() { - // TODO: No expected output, code has bugs to solve - does not take into account existing variable names - newTester().test("AutoParInlineTest.lara", "autopar_inline.c"); - } - - @Test - public void testHls() { - newTester().test("HlsTest.lara", "hls.c"); - } - - @Test - public void testStrcpyChecker() { - newTester().test("StrcpyChecker.lara", "strcpy.c"); - } - - @Test - public void testStaticCallGraph() { - newTester().test("StaticCallGraphTest.js", "static_call_graph.c"); - } - - @Test - public void testPassComposition() { - newTester().test("PassCompositionTest.js", "pass_composition.c"); - } - - @Test - public void testCfgApi() { - newTester().test("CfgApi.js", "cfg_api.c"); - } - - @Test - public void testInliner() { - newTester() - // .setCheckWovenCodeSyntax(false) - .test("InlinerTest.js", "inliner.c"); - } - - @Test - public void testStatementDecomposer() { - newTester().test("StatementDecomposerTest.js", "stmt_decomposer.c"); - } - - @Test - public void testToSingleFile() { - newTester().test("ToSingleFile.js", "to_single_file_1.c", "to_single_file_2.c"); - } - - - @Test - public void testLivenessAnalysis() { - newTester().test("LivenessAnalysisTest.js", "liveness_analysis.c"); - } - - - @Test - public void testSwitchToIf() { - newTester().test("SwitchToIfTransformationTest.js", "switch_to_if.c"); - } - -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CBenchTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CBenchTest.java deleted file mode 100644 index 6efbbd398d..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CBenchTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; - -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.util.SpecsSystem; - -public class CBenchTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/bench/", Standard.C99) - .setResultPackage("c/results") - .setSrcPackage("c/src"); - } - - @Test - public void testHamidRegion() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("HamidRegion.lara", "hamid_region.c", "hamid_region.h"); - } - - @Test - public void testDspMatmul() { - newTester().test("DspMatmul.lara", "dsp_matmul.c"); - } - - @Test - public void testLSIssue1() { - newTester().test("LSIssue1.lara", "ls_issue1.c"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CIssueTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CIssueTest.java deleted file mode 100644 index cdbe4ae36e..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CIssueTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.util.SpecsSystem; - -public class CIssueTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/issues/", Standard.C99) - .setResultPackage("c/results") - .setSrcPackage("c/src"); - } - - - @Test - public void testIssue168() { - newTester().test("Issue168.mjs", "issue_168.c"); - } - - - @Test - public void testIssueAiq1() { - newTester().test("Issue_aiq_1.mjs", "issue_aiq_1.c"); - } - - @Test - public void testIssue187() { - newTester().test("Issue187.mjs", "issue_187.c"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CTest.java deleted file mode 100644 index 227c8dd5c9..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CTest.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import pt.up.fe.specs.clava.ClavaOptions; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; - -public class CTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/weaver/", Standard.C99) - .setResultPackage("c/results") - .setSrcPackage("c/src"); - } - - - @Test - public void testReplaceCallWithStmt() { - newTester().test("ReplaceCallWithStmt.lara", "ReplaceCallWithStmt.c"); - } - - @Test - public void testInsertsLiteral() { - newTester().test("InsertsLiteral.lara", "inserts.c"); - } - - @Test - public void testInsertsJp() { - newTester().test("InsertsJp.lara", "inserts.c"); - } - - @Test - public void testClone() { - newTester().test("Clone.lara", "clone.c"); - } - - @Test - public void testAddGlobal() { - newTester().test("AddGlobal.lara", "add_global_1.c", "add_global_2.c"); - } - - @Test - public void testExpressions() { - newTester().test("Expressions.lara", "expressions.c"); - } - - @Test - public void testDijkstra() { - newTester().setCheckWovenCodeSyntax(false).checkExpectedOutput(false).test("Dijkstra.lara", "dijkstra.c"); - } - - @Test - public void testWrap() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("Wrap.lara", "wrap.c", "wrap.h"); - } - - @Test - public void testVarrefInWhile() { - newTester().test("VarrefInWhile.lara", "varref_in_while.c"); - } - - @Test - public void testInline() { - newTester().test("Inline.lara", "inline.c", "inline_utils.h", "inline_utils.c"); - } - - @Test - public void testSetType() { - newTester().test("SetType.lara", "set_type.c"); - } - - @Test - public void testDetach() { - newTester().test("Detach.lara", "detach.c"); - } - - @Test - public void testInlineNasLu() { - if (SpecsSystem.isWindows()) { - SpecsLogs.info("Skipping test, does not work on Windows"); - return; - } - - newTester().checkExpectedOutput(false).test("InlineNasLu.lara", "inline_nas_lu.c"); - } - - @Test - public void testInlineNasFt() { - newTester().checkExpectedOutput(false).test("InlineNasFt.lara", "inline_nas_ft.c"); - } - - @Test - public void testNullNodes() { - newTester().test("NullNodes.lara", "null_nodes.c"); - } - - @Test - public void testTypeRenamer() { - newTester().test("TypeRenamer.lara", "type_renamer.c"); - } - - @Test - public void testAstNodes() { - newTester().test("AstNodes.lara", "ast_nodes.c"); - } - - @Test - public void testRemoveInclude() { - newTester().test("RemoveInclude.lara", "remove_include.c", "remove_include_0.h", "remove_include_1.h", - "remove_include_2.h"); - } - - @Test - public void testIncludeLocation() { - newTester().test("IncludeLoc.js", "remove_include.c", "remove_include_0.h", "remove_include_1.h", - "remove_include_2.h"); - } - - @Test - public void testDynamicCallGraph() { - newTester().test("DynamicCallGraph.lara", "dynamic_call_graph.c"); - } - - @Test - public void testSelects() { - newTester().test("Selects.lara", "selects.c"); - } - - @Test - public void testScope() { - newTester().test("Scope.js", "scope.c"); - } - - @Test - public void testArray() { - newTester().test("ArrayTest.lara", "array_test.c"); - } - - // @Test - public void testOpenCLType() { - // TODO: Certain attributes are not supported yet (e.g., ReqdWorkGroupSizeAttr, WorkGroupSizeHintAttr, - // VecTypeHintAttr) - newTester().set(ClavaOptions.STANDARD, Standard.OPENCL20).test("OpenCLType.lara", "opencl_type.cl"); - } - - @Test - public void testCilk() { - // Generated code has Cilk directives - newTester().set(ClavaOptions.FLAGS, "-fcilkplus").test("Cilk.lara", "cilk.c"); - } - - @Test - public void testTagDecl() { - newTester().test("TagDecl.lara", "tag_decl.c"); - } - - @Test - public void testFile() { - newTester().test("File.lara", "file.c"); - } - - @Test - public void testSwitch() { - newTester().test("SwitchTest.lara", "switch.c"); - } - - @Test - public void testAddParam() { - newTester().test("AddParamTest.lara", "add_param.c"); - } - - @Test - public void testAddArg() { - newTester().test("AddArgTest.lara", "add_arg.c"); - } - - @Test - public void testCfg() { - newTester().test("Cfg.lara", "cfg.c"); - } - - @Test - public void testExprStmt() { - newTester().test("ExprStmt.js", "expr_stmt.c"); - } - - @Test - public void testTraversal() { - newTester().test("Traversal.js", "traversal.c"); - } - - @Test - public void testIf() { - newTester().test("If.js", "if.c"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CudaTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CudaTest.java deleted file mode 100644 index 559b8d2949..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CudaTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; - -import pt.up.fe.specs.clang.codeparser.CodeParser; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.lang.SpecsPlatforms; -import pt.up.fe.specs.util.SpecsSystem; - -public class CudaTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - var cudaTester = new ClavaWeaverTester("clava/test/weaver/", Standard.CUDA) - .setResultPackage("cuda/results") - .setSrcPackage("cuda/src") - .set(CodeParser.CUDA_PATH, CodeParser.getBuiltinOption()); - - // Windows currently not supported - if (SpecsPlatforms.isWindows()) { - cudaTester.doNotRun(); - } - - return cudaTester; - } - - @Test - public void testCuda() { - newTester().test("Cuda.lara", "atomicAdd.cu"); - } - - @Test - public void testCudaMatrixMul() { - newTester().test("CudaMatrixMul.lara", "mult_matrix.cu"); - } - - @Test - public void testCudaQuery() { - newTester().test("CudaQuery.lara", "sample.cu"); - } - - // Not implemented - // @Test - public void testCudaWscad2023() { - newTester().test("CudaWSCAD2023.js", "wscad2023.cu"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxApiTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxApiTest.java deleted file mode 100644 index 19ba0df74c..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxApiTest.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright 2016 SPeCS. - *

- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.lang.SpecsPlatforms; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.lazy.Lazy; - -import java.util.Arrays; - -public class CxxApiTest { - - private static final Lazy IS_CMAKE_AVAILABLE = Lazy - .newInstance(() -> SpecsSystem.runProcess(Arrays.asList("cmake"), false, false).getReturnValue() == 0); - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/api/", Standard.CXX11) - .setSrcPackage("cpp/src/") - .setResultPackage("cpp/results/"); - } - - @Test - public void testLogger() { - newTester().test("LoggerTest.lara", "logger_test.cpp"); - } - - @Test - public void testLoggerWithLibrary() { - // Disable syntax check of woven code, SpecsLogger includes are not available - newTester().setCheckWovenCodeSyntax(false) - .test("LoggerTestWithLib.lara", "logger_test.cpp"); - } - - @Test - public void testEnergy() { - // Disable syntax check of woven code, rapl include is not available - newTester().setCheckWovenCodeSyntax(false) - .test("EnergyTest.lara", "energy_test.cpp"); - } - - @Test - public void testTimer() { - newTester().test("TimerTest.lara", "timer_test.cpp"); - } - - @Test - public void testClavaFindJp() { - newTester().test("ClavaFindJpTest.lara", "clava_find_jptest.cpp"); - } - - @Test - public void testCMaker() { - if (!IS_CMAKE_AVAILABLE.get()) { - return; - } - - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("CMakerTest.js", "cmaker_test.cpp", "cmaker_test.h"); - } - - @Test - public void testMathExtra() { - newTester().test("MathExtraTest.lara", "math_extra_test.cpp"); - } - - @Test - public void testWeaverLauncher() { - newTester().test("WeaverLauncherTest.lara", "weaver_launcher_test.cpp"); - } - - @Test - public void testClavaDataStore() { - newTester().test("ClavaDataStoreTest.lara", "clava_data_store_test.cpp"); - } - - @Test - public void testUserValues() { - newTester().test("UserValuesTest.lara", "user_values.cpp"); - } - - @Test - public void testClavaCode() { - newTester().test("ClavaCodeTest.lara", "clava_code.cpp"); - } - - @Test - public void testClavaJoinPointsTest() { - newTester().test("ClavaJoinPointsTest.js", "clava_join_points.cpp"); - } - - @Test - public void testJpFilter() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("JpFilter.lara", "jp_filter.hpp"); - } - - @Test - public void testRebuild() { - newTester().test("RebuildTest.lara", "rebuild.cpp"); - } - - @Test - public void testFileIterator() { - newTester().test("FileIteratorTest.lara", "file_iterator_1.cpp", "file_iterator_2.cpp"); - } - - @Test - public void testAddHeaderFile() { - newTester().test("AddHeaderFileTest.lara", "add_header_file.h"); - } - - @Test - public void testClava() { - newTester().test("ClavaTest.lara", "clava.cpp"); - } - - @Test - public void testQuery() { - newTester().test("QueryTest.lara", "query.cpp"); - } - - @Test - public void testQueryJs() { - newTester().test("QueryTest.js", "query.cpp"); - } - - - @Test - public void testLaraCommonLanguage() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("LaraCommonLanguageTest.js", "lara_common_language.cpp", "lara_common_language.h"); - } - - @Test - public void testClavaType() { - newTester().test("ClavaTypeTest.lara"); - } - - @Test - public void testStatementDecomposer() { - newTester().test("StatementDecomposerTest.js", "stmt_decomposer.cpp"); - } - - @Test - public void testCode2Vec() { - newTester().test("Code2VecTest.js", "code2vec.cpp"); - } - - @Test - public void testSimplifyVarDeclarations() { - newTester().test("PassSimplifyVarDeclarations.lara", "pass_simplify_var_declarations.cpp"); - } - - @Test - public void testSingleReturnFunction() { - newTester().test("PassSingleReturnTest.js", "pass_single_return.cpp"); - } - - @Test - public void testSimplifyAssignment() { - newTester().test("CodeSimplifyAssignmentTest.js", "code_simplify_assignment.cpp"); - } - - @Test - public void testSimplifyTernaryOp() { - newTester().test("CodeSimplifyTernaryOpTest.js", "code_simplify_ternary_op.cpp"); - } - - @Test - public void testSimplifyLoops() { - newTester().test("PassSimplifyLoopsTest.js", "pass_simplify_loops.cpp"); - } - - @Test - public void testMpiScatterGather() { - newTester() - // Disable syntax check of woven code, mpi.h may not be available - .setCheckWovenCodeSyntax(false) - .test("MpiScatterGatherTest.js", "mpi_scatter_gather.cpp", "mpi_scatter_gather.h"); - } - - @Test - public void testSubset() { - var tester = newTester(); - - if (SpecsPlatforms.isWindows()) { - tester.setResultsFile("SubsetTest.js.windows.txt"); - } - - tester.test("SubsetTest.js", "subset.cpp"); - } - -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxBenchTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxBenchTest.java deleted file mode 100644 index e5a2a54411..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxBenchTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; - -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.util.SpecsSystem; - -public class CxxBenchTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/bench/", Standard.CXX11) - .setResultPackage("cpp/results") - .setSrcPackage("cpp/src"); - } - - @Test - public void testLoicEx1() { - newTester().test("LoicEx1.lara", "loic_ex1.cpp"); - } - - @Test - public void testLoicEx2() { - newTester().setCheckWovenCodeSyntax(false).checkExpectedOutput(false).test("LoicEx2.lara", "loic_ex2.cpp"); - } - - @Test - public void testLoicEx3() { - // newTester().setCheckWovenCodeSyntax(false).test("LoicEx3.lara", "loic_ex3.cpp"); - newTester().test("LoicEx3.lara", "loic_ex3.cpp"); - } - - @Test - public void testLSIssue2() { - newTester().test("LSIssue2.lara", "ls_issue2.cpp"); - } - - @Test - public void testCbMultios() { - newTester().test("CbMultios.lara", "cb_multios.cpp"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxTest.java deleted file mode 100644 index d7341b08d3..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/CxxTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/** - * Copyright 2016 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.Test; - -import pt.up.fe.specs.clava.ClavaOptions; -import pt.up.fe.specs.clava.language.Standard; -import pt.up.fe.specs.clava.weaver.options.CxxWeaverOption; -import pt.up.fe.specs.cxxweaver.ClavaWeaverTester; -import pt.up.fe.specs.util.SpecsLogs; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.utilities.StringList; - -public class CxxTest { - - @BeforeClass - public static void setupOnce() { - SpecsSystem.programStandardInit(); - ClavaWeaverTester.clean(); - } - - @After - public void tearDown() { - ClavaWeaverTester.clean(); - } - - private static ClavaWeaverTester newTester() { - return new ClavaWeaverTester("clava/test/weaver/", Standard.CXX11) - .setResultPackage("cpp/results") - .setSrcPackage("cpp/src"); - } - - @Test - public void testStatement() { - newTester().test("Statement.lara", "statement.cpp"); - } - - @Test - public void testLoop() { - newTester().test("Loop.lara", "loop.cpp"); - } - - @Test - public void testReplaceCallWithStmt() { - newTester().test("ReplaceCallWithStmt.lara", "ReplaceCallWithStmt.cpp"); - } - - @Test - public void testInsertsLiteral() { - newTester().test("InsertsLiteral.lara", "inserts.cpp"); - } - - @Test - public void testInsertsJp() { - newTester().test("InsertsJp.lara", "inserts.cpp"); - } - - @Test - public void testPragmas() { - newTester().test("Pragmas.lara", "pragma.cpp"); - } - - @Test - public void testPragmas2() { - newTester().test("Pragma2.js", "pragma2.cpp"); - } - - @Test - public void testActions() { - newTester().test("Actions.lara", "actions.cpp"); - } - - @Test - public void testArrayAccess() { - newTester().test("ArrayAccess.lara", "array_access.cpp", "array_access.h"); - } - - @Test - public void testAttributeUse() { - newTester().test("AttributeUse.lara", "attribute_use.cpp"); - } - - @Test - public void testHdf5Types() { - newTester() - // Disable syntax checking, since test system may not have HDF5 includes automatically available - .setCheckWovenCodeSyntax(false) - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("Hdf5Types.lara", "hdf5types.cpp"); - } - - @Test - public void testOmpThreadsExplore() { - newTester() - .set(ClavaOptions.FLAGS_LIST, StringList.newInstance("-fopenmp=libomp")) - .test("OmpThreadsExplore.lara", "omp_threads_explore.cpp"); - } - - @Test - public void testHamidCfg() { - newTester().test("HamidCfg.lara", "dijkstra.cpp"); - } - - @Test - public void testClone() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("Clone.lara", "clone.cpp", "clone.h"); - } - - @Test - public void testAddGlobal() { - newTester().test("AddGlobal.lara", "add_global_1.cpp", "add_global_2.cpp"); - } - - @Test - public void testOmp() { - newTester().test("Omp.lara", "omp.cpp"); - } - - @Test - public void testOmpAttributes() { - newTester().test("OmpAttributes.lara", "omp_attributes.cpp"); - } - - @Test - public void testOmpSetAttributes() { - newTester().test("OmpSetAttributes.lara", "omp_set_attributes.cpp"); - } - - @Test - public void testExpressions() { - newTester().test("Expressions.lara", "expressions.cpp", "classA.h"); - } - - @Test - public void testParentRegion() { - newTester().test("ParentRegion.lara", "parent_region.cpp"); - } - - @Test - public void testVarDecl() { - newTester().test("Vardecl.lara", "vardecl.cpp"); - } - - @Test - public void testParamType() { - newTester().checkExpectedOutput(false).test("ParamType.lara", "param_type.cpp"); - } - - @Test - public void testWrap() { - if (SpecsSystem.isWindows()) { - SpecsLogs.info("Skipping test, results are different on Windows"); - return; - } - - // newTester().test("Wrap.lara", "wrap.cpp", "wrap.h", "lib/lib.h", "lib/lib.cpp"); - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("Wrap.lara", "wrap.cpp", "wrap.h"); - } - - @Test - public void testSelectVarDecl() { - newTester().test("SelectVardecl.lara", "select_vardecl.cpp"); - } - - @Test - public void testMacros() { - newTester().setCheckWovenCodeSyntax(false).test("Macros.lara", "macros.cpp"); - } - - @Test - public void testCall() { - newTester().test("Call.lara", "call.cpp"); - } - - @Test - public void testPragmaClavaAttribute() { - newTester().test("PragmaAttribute.lara", "pragma_attribute.cpp"); - } - - @Test - public void testTypeTemplate() { - newTester().test("TypeTemplate.lara", "type_template.cpp"); - } - - @Test - public void testFunction() { - newTester().test("Function.lara", "function.cpp", "function.h"); - } - - @Test - public void testAstAttributes() { - newTester().test("AstAttributes.lara", "ast_attributes.cpp"); - } - - // @Test - // public void testClass() { - // newTester().test("Class.lara", "class.cpp"); - // } - - @Test - public void testPragmaData() { - newTester().test("PragmaData.lara", "pragma_data.cpp", "pragma_data_2.cpp"); - } - - @Test - public void testGlobalAttributes() { - newTester().test("GlobalAttributes.lara", "global_attributes.cpp"); - } - - @Test - public void testSetType() { - newTester().test("SetTypeCxx.lara", "set_type.cpp"); - } - - @Test - public void testMultiFile() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("MultiFile.lara", "multiFile.cpp", "multiFile.h"); - } - - @Test - public void testField() { - newTester().test("Field.lara", "field.hpp"); - } - - @Test - public void testFileRebuild() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("FileRebuild.lara", "file_rebuild.cpp", "file_rebuild.h", "file_rebuild_2.h"); - } - - @Test - public void testSetters() { - newTester().test("Setters.lara", "setters.cpp"); - } - - @Test - public void testSkipParsingHeaders() { - newTester().test("SkipParsingHeaders.lara", "skip_parsing_headers.cpp", "skip_parsing_headers.h"); - } - - @Test - public void testNoParsing() { - newTester().test("NoParsing.lara"); - } - - @Test - public void testLaraGetter() { - newTester() - // .set(LaraiKeys.DEBUG_MODE) - // .set(LaraiKeys.VERBOSE, VerboseLevel.all) - // .set(LaraiKeys.TRACE_MODE, false) - .test("LaraGetter.lara"); - } - - @Test - public void testVarDeclV2() { - newTester().test("VardeclV2.lara", "vardeclv2.cpp", "vardeclv2_2.cpp"); - } - - @Test - public void testFile() { - newTester().test("File.lara", "file.cpp"); - } - - @Test - public void testDataClass() { - newTester().test("DataClass.lara", "dataclass.cpp"); - } - - @Test - public void testClassManipulation() { - newTester() - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("ClassManipulation.lara", "class_manipulation.cpp", "class_manipulation.h"); - } - - @Test - public void testThis() { - newTester().test("ThisTest.lara", "this.cpp"); - } - - @Test - public void testMember() { - newTester().test("Member.lara", "member.cpp"); - } - - @Test - public void testFieldRef() { - newTester().checkExpectedOutput(false).test("FieldRef.lara", "fieldRef.cpp"); - } - - @Test - public void testExpressionDecls() { - newTester().test("ExpressionDecls.lara", "expressionDecls.cpp"); - } - - @Test - public void testTemplateSpecializationType() { - newTester().test("TemplateSpecializationType.lara", "template_specialization_type.cpp"); - } - - @Test - public void testReverseIterator() { - newTester().test("ReverseIterator.lara", "reverse_iterator.cpp"); - } - - @Test - public void testFunction2() { - newTester().test("Function2.lara", "function2.cpp"); - } - - @Test - public void testCloneOnFile() { - newTester() - // Generates a file in another folder, needs to generate the header file otherwise it will not parse - // correctly the second time - .set(CxxWeaverOption.PARSE_INCLUDES) - .test("CloneOnFile.lara", "clone_on_file.cpp", - "clone_on_file.h"); - } - - @Test - public void testEmptyStmt() { - newTester().test("EmptyStmt.js", "empty_stmt.cpp"); - } - - @Test - public void testClass() { - newTester().test("Class.js", "class.cpp"); - } - - @Test - public void testCanonical() { - newTester().test("CanonicalTest.js", "canonical.cpp"); - } - - @Test - public void testBreak() { - newTester().test("Break.js", "break.cpp"); - } -} diff --git a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/LaraLocTest.java b/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/LaraLocTest.java deleted file mode 100644 index bf047d33c7..0000000000 --- a/ClavaWeaver/test/pt/up/fe/specs/cxxweaver/tests/LaraLocTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2019 SPeCS. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. under the License. - */ - -package pt.up.fe.specs.cxxweaver.tests; - -import static org.junit.Assert.assertEquals; - -import java.io.File; - -import org.junit.BeforeClass; -import org.junit.Test; - -import pt.up.fe.specs.clava.weaver.CxxWeaver; -import pt.up.fe.specs.lara.loc.LaraStats; -import pt.up.fe.specs.util.SpecsIo; -import pt.up.fe.specs.util.SpecsSystem; -import pt.up.fe.specs.util.providers.ResourceProvider; - -public class LaraLocTest { - - @BeforeClass - public static void init() { - SpecsSystem.programStandardInit(); - } - - @Test - public void test() { - - // Create file to test - ResourceProvider laraResource = () -> "clava/test/loc/ClavaAspectsForLoc.lara"; - File tempFile = new File(SpecsIo.getTempFolder("laraloc"), "laraloc-test.lara"); - SpecsIo.write(tempFile, SpecsIo.read(SpecsIo.resourceToStream(laraResource))); - - LaraStats laracLoc = new LaraStats(CxxWeaver.buildLanguageSpecification()); - laracLoc.addFileStats(tempFile); - - assertEquals(Integer.valueOf(50), laracLoc.get(LaraStats.LARA_STMTS)); - assertEquals(Integer.valueOf(9), laracLoc.get(LaraStats.ASPECTS)); - assertEquals(Integer.valueOf(3), laracLoc.get(LaraStats.COMMENTS)); - assertEquals(Integer.valueOf(2), laracLoc.get(LaraStats.FUNCTIONS)); - - // Clean - SpecsIo.delete(tempFile); - } - -} diff --git a/ClavaWeaverSpecs/build.gradle b/ClavaWeaverSpecs/build.gradle deleted file mode 100644 index b226de74a1..0000000000 --- a/ClavaWeaverSpecs/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -plugins { - id 'distribution' -} - -// Java project -apply plugin: 'java' - -java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 -} - - -// Repositories providers -repositories { - // Gearman - maven { url "https://oss.sonatype.org/content/repositories/snapshots"} - - mavenCentral() -} - -dependencies { - implementation ":WeaverGenerator" -} - - -// Weaver Generator -task weaverGenerator(type: JavaExec) { - group = "Execution" - description = "Generates the join point classes from the Language Specification" - classpath = sourceSets.main.runtimeClasspath - mainClass = 'org.lara.interpreter.weaver.generator.commandline.WeaverGenerator' - args = [ - '-w', 'CxxWeaver', - '-x', '../ClavaWeaver/resources/clava/weaverspecs', - '-o', '../ClavaWeaver/src', - '-p', 'pt.up.fe.specs.clava.weaver', - '-n', 'pt.up.fe.specs.clava.ClavaNode', - '-j', - '-e', - '-d' - ] -} diff --git a/ClavaWeaverSpecs/settings.gradle b/ClavaWeaverSpecs/settings.gradle deleted file mode 100644 index ec968affee..0000000000 --- a/ClavaWeaverSpecs/settings.gradle +++ /dev/null @@ -1,20 +0,0 @@ -rootProject.name = 'ClavaWeaverSpecs' - -includeBuild("../../specs-java-libs/CommonsLangPlus") -includeBuild("../../specs-java-libs/GsonPlus") -includeBuild("../../specs-java-libs/jOptions") -includeBuild("../../specs-java-libs/JsEngine") -includeBuild("../../specs-java-libs/SpecsUtils") -includeBuild("../../specs-java-libs/XStreamPlus") -includeBuild("../../specs-java-libs/tdrcLibrary") - -includeBuild("../../lara-framework/LanguageSpecification") -includeBuild("../../lara-framework/LaraCommonLanguageApi") -includeBuild("../../lara-framework/LaraDoc") -includeBuild("../../lara-framework/LaraFramework") -includeBuild("../../lara-framework/LARAI") -includeBuild("../../lara-framework/LaraLoc") -includeBuild("../../lara-framework/LaraUnit") -includeBuild("../../lara-framework/LaraUtils") -includeBuild("../../lara-framework/WeaverGenerator") -includeBuild("../../lara-framework/WeaverInterface") diff --git a/ClavaWrapper/CMakeLists.txt b/ClavaWrapper/CMakeLists.txt deleted file mode 100644 index 35a95cafec..0000000000 --- a/ClavaWrapper/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(ClavaWrapper) - -set(CMAKE_CXX_STANDARD 14) - -add_executable(ClavaWrapper main.cpp) - -target_link_libraries(ClavaWrapper gearman) diff --git a/ClavaWrapper/main.cpp b/ClavaWrapper/main.cpp deleted file mode 100644 index 0b93c98639..0000000000 --- a/ClavaWrapper/main.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -std::string escape_json(const std::string &s) { - std::ostringstream o; - for (auto c = s.cbegin(); c != s.cend(); c++) { - if (*c == '"' || *c == '\\' || ('\x00' <= *c && *c <= '\x1f')) { - o << "\\u" - << std::hex << std::setw(4) << std::setfill('0') << (int)*c; - } else { - o << *c; - } - } - return o.str(); -} - -std::string json_to_string(const std::string &s) { - std::ostringstream o; - for (auto c = s.cbegin(); c != s.cend(); c++) { - if(*c == '\\') { - c++; - if(*c == 'n') { - o << '\n'; - } - else if(*c == 'u') { - std::stringstream ss; - ss << std::hex; - for(int i=0; i<4; i++) { - c++; - ss << *c; - } - - unsigned int unicodeChar; - ss >> unicodeChar; - o << (unsigned char) unicodeChar; - } - else { - o << '\\'; - o << *c; - } - } else { - o << *c; - } - } - - return o.str(); -} - -void launchServer() { - // Get current folder - - const int MAX_PATH_LEGTH = 4096; - char currentExe[MAX_PATH_LEGTH]; - - readlink("/proc/self/exe", currentExe, sizeof(currentExe)); - - std::string currentExeStr(currentExe); - std::string currentFolder = currentExeStr.substr(0, currentExeStr.find_last_of("/")); - ///proc/self/exe - - // Build command - std::string cmd = currentFolder; - cmd += "/clava -server &"; - std::cout << "Launching " << cmd << std::endl; - system(&cmd[0]); -} - -int main(int argc, char** argv) { - - // To check if the server is running - // Taken from here: https://stackoverflow.com/a/13230341 - //(echo status ; sleep 0.1) | nc 127.0.0.1 4730 -w 1 - - //launchServer(); - - gearman_client_st *client= gearman_client_create(NULL); - - // Connect to server - gearman_return_t ret = gearman_client_add_server(client, "localhost", 4733); - if (gearman_failed(ret)) - { - return -1; - } - - - - - // Create json with arguments - std::string jsonArgs("["); - for(int i=1; i - * [Clava Libraries Showcase (FCCM 2025 Demo Night)](https://github.com/specs-feup/clava-fccm-2025-demo) - - * Clava built-in features: * [CMake integration](https://github.com/specs-feup/clava/tree/master/CMake) - Allows Clava to be used in CMake-centered compilation flows * Code transformations: diff --git a/eclipse.build b/eclipse.build deleted file mode 100644 index 7983f03e4e..0000000000 --- a/eclipse.build +++ /dev/null @@ -1,4 +0,0 @@ -https://github.com/specs-feup/specs-java-libs -https://github.com/specs-feup/lara-framework -https://github.com/specs-feup/clava ---build \ No newline at end of file