Antonio Martínez-Álvarez
2013-Feb-19 17:54 UTC
[LLVMdev] LLVM/Clang 3.1: Add a new include path in a clang C++ based parser
Hi, I'm having troubles to add a custom include path to a clang based C++ parser. I'd like to properly support this opencv code under Linux: ... #include "cv.h" #include "highgui.h" ... This is what I'm using: TheCompInst->getHeaderSearchOpts().AddPath(StringRef("/usr/include/opencv"),clang::frontend::Quoted ,false, true, false, false, false); Note: I have tried also with clang::frontend::Angled without success. Can you see the problem? Could you please say me where can I find some Clang 3.1 based related example? Many thanks in advance. This is a more extended captured of how I am using "AddPath". ... CompilerInstance *TheCompInst = new CompilerInstance(); TheCompInst->getHeaderSearchOpts().AddPath(StringRef("/usr/include/opencv"),clang::frontend::Quoted ,false, true, false, false, false); TheCompInst->createDiagnostics(0, 0); TargetOptions TO; TO.Triple = llvm::sys::getDefaultTargetTriple(); TargetInfo *TI = TargetInfo::CreateTargetInfo(TheCompInst->getDiagnostics(), TO); TheCompInst->setTarget(TI); TheCompInst->createFileManager(); FileManager &FileMgr = TheCompInst->getFileManager(); TheCompInst->createSourceManager(FileMgr); SourceManager &SourceMgr = TheCompInst->getSourceManager(); TheCompInst->createPreprocessor(); TheCompInst->createASTContext(); Rewriter TheRewriter; TheRewriter.setSourceMgr(SourceMgr, TheCompInst->getLangOpts()); ... -- ==================================================================Dr. Antonio Martínez Álvarez Profesor Contratado Doctor (LOM-LOU) Dept. Tecnología Informática y Computación (TIC) Escuela Politécnica Superior Universidad de Alicante Campus de San Vicente Ap. Correos 99, E-03080 Alicante ESPAÑA (SPAIN) email : amartinez at dtic.ua.es Phone : +34 965 90 34 00 (3043) Fax : +34 965 90 96 43 ===================================================================