[cfe-dev] Is loading a plugin expected to change include search directories?

Philip Reames listmail at philipreames.com
Thu Mar 15 20:07:38 PDT 2012


I'm seeing some unexpected behavior when loading a plugin for Clang. 
Essentially, it appears that loading a plugin clears the default paths 
from the include search list.  I haven't noticed any other unexpected 
side effects.  I suspect I'm doing something wrong, but wanted to check 
to see if anyone else has seen this and had a clue what that might be.  :)


The behavior can be replicated with the PrintHeaderNames example plugin 
provided with Clang build with "make BUILD_EXAMPLES=1" with a default 
configured build.  The test case I'm using is:
#include <string>

int main() {
}


$~/tools/clang-3.0/bin/clang++ -c test.cxx
$~/tools/clang-3.0/bin/clang++ -cc1 -load 
Release/lib/libPrintFunctionNames.so -plugin print-fns test.cxx
top-level-decl: "__va_list_tag"
top-level-decl: "__va_list_tag"
test.cxx:2:10: fatal error: 'string' file not found
#include <string>
          ^
top-level-decl: "__builtin_va_list"
top-level-decl: "main"
1 error generated.
$~/tools/clang-3.0/bin/clang++ -cc1 -load 
Release/lib/libPrintFunctionNames.so -add-plugin print-fns test.cxx
top-level-decl: "__va_list_tag"
top-level-decl: "__va_list_tag"
test.cxx:2:10: fatal error: 'string' file not found
#include <string>
          ^
top-level-decl: "__builtin_va_list"
top-level-decl: "main"
1 error generated.
$ ~/tools/clang-3.0/bin/clang++ -cc1 -load 
Release/lib/libPrintFunctionNames.so test.cxx
test.cxx:2:10: fatal error: 'string' file not found
#include <string>
          ^
1 error generated.


Yours,
Philip Reames



More information about the cfe-dev mailing list