[cfe-dev] #line directive ignored

Frank Redeker via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 13 08:53:16 PST 2018


Hello list,

I'm using ClangTool.buildASTs() to create the ASTs for a given set of
source files.

I wonder why #line directives are ignored. (Or have I missed some option
when setting up my ClangTool instance. Or must I fix the line numbers in
my own DiagnosticsConsumer)


When compiling the following source

#line 123 "foo"
void foo () {
  if (condition) {
  }
}

clang -c test.c gives the following output:

foo:123:6: error: use of undeclared identifier 'condition'
        if (condition) {
            ^
1 error generated.


But my program gives the following output:

t:\test.c:3:6: error: use of undeclared identifier 'condition'
        if (condition) {
            ^
IDB32++: Fatal - Analyze terminated with errors


Frank



More information about the cfe-dev mailing list