Parsing inactive code in CDT [message #1706963] |
Tue, 01 September 2015 08:09 |
Fadi J Messages: 11 Registered: June 2013 |
Junior Member |
|
|
Hello everyone,
I'm developing a new Codan checker for C code static analysis purposes. My checker requires that the inactive code has to be included in the AST.
for example lets take the following code
#define z 10
int main(void) {
int x = 0, y = 0;
#if (z > 0)
x = 1;
#else
y = 2;
#endif
}
The generated AST for this code will not contain the statement y=2 because it will be marked as inactive code by the preprocessor.
I tried to solve the problem by calling the function
org.eclipse.cdt.internal.core.parser.scanner.ScannerContext.setParseInactiveCode(ture)
but it doesn't works.
the problem can be solved by modifying the class (org.eclipse.cdt.internal.core.parser.scanner.ScannerContext) or (org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor)
but I'm looking for a better solution so my checker can work with newer CDT releases without the need to modify the source code.
So my questions are: is there is a better solution, or can I commit my changes to the repository?
P.S. I'm using the C language preprocessor, not C++.
Thanks in advance.
|
|
|
Powered by
FUDForum. Page generated in 0.03713 seconds