[cfe-dev] Define macro in program manually
Wen-Han Gu
nowar100 at gmail.com
Sat Mar 19 05:08:03 PDT 2011
Hi all,
I want to define macro by hand before running compile.
In code, I already setup a clang::Preprocessor.
I use:
mPP->setMacroInfo(&mPP->getIdentifierTable().get("__cplusplus"),
new
clang::MacroInfo( mSourceMgr->getLocForStartOfFile( mSourceMgr->getMainFileID()
) ) );
But it segmentation fault and this is backtrace:
#0 llvm::StringMapImpl::LookupBucketFor (this=0xac, Name=...) at
external/llvm/lib/Support/StringMap.cpp:56
#1 0x0805d180 in GetOrCreateValue<clang::IdentifierInfo*> (this=0xffea172c)
at external/llvm/include/llvm/ADT/StringMap.h:370
#2 llvm::StringMap<clang::IdentifierInfo*,
llvm::BumpPtrAllocator>::GetOrCreateValue (this=0xffea172c) at
external/llvm/include/llvm/ADT/StringMap.h:392
#3 clang::IdentifierTable::get (this=0xffea172c) at
external/clang/include/clang/Basic/IdentifierTable.h:362
#4 pndk::Compiler::setMacro (this=0xffea172c) at Compiler.cpp:269
#5 0x0805b259 in main (argc=8, argv=0xffea1a84) at Driver.cpp:71
I have no experience and no idea on clang macro handling.
Could someone help?
Big thanks!
--
Best regards,
Wen-Han
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110319/5613b5ab/attachment.html>
More information about the cfe-dev
mailing list