usethesource / clair

C Language Analysis in Rascal
BSD 2-Clause "Simplified" License
25 stars 12 forks source link

Missing varialbe and parameter types from C functions inside M3 Model #80

Open matteasu opened 10 months ago

matteasu commented 10 months ago

Setup:

Given a simple C program, such as:

#include <stdio.h>

int main(int argc, char argv[]){
    int a=0;
    printf("Hello world!");
    return 0;
}

Similar to issue #69, but this time, it regards the type of variables that may be defined inside a program

"declaredType": [
        [
            "c+variable:///main(int,char.*)/a",
            "any"
        ],
]
"declaredType": [
        [
            "cpp+variable:///main(int,char.*)/a",
            {
                "modifiers": [],
                "baseType": "int"
            }
        ],
]
jurgenvinju commented 10 months ago

Thanks for the report! Are you analyzing this in TS or JS? I would suggest using the pattern matching features of Rascal, and then export the analysis result to JSON.

I'll try and fix this issue on Monday. Please keep reporting, this is very helpful!

matteasu commented 10 months ago

Are you analyzing this in TS or JS?

I export the JSON from Rascal and then process it using Python

I'll try and fix this issue on Monday. Please keep reporting, this is very helpful!

Thanks!