diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-19 16:15:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-19 16:15:56 +0000 |
commit | 94dc8f640ebea52241412512ed48601626edbc58 (patch) | |
tree | d2f85a840dec17223611a920b85f8e27fb4e60e2 /tools | |
parent | f7ad50026074776bde13fdf790bcf2f647904f1b (diff) | |
download | clang-94dc8f640ebea52241412512ed48601626edbc58.tar.gz |
Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98963 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/CIndex/CIndex.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index c51ca7f119..f20bb75374 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -430,11 +430,11 @@ bool CursorVisitor::VisitChildren(CXCursor Cursor) { return true; // Walk the preprocessing record. - if (CXXUnit->hasPreprocessingRecord()) { + if (PreprocessingRecord *PPRec + = CXXUnit->getPreprocessor().getPreprocessingRecord()) { // FIXME: Once we have the ability to deserialize a preprocessing record, // do so. - PreprocessingRecord &PPRec = CXXUnit->getPreprocessingRecord(); - for (PreprocessingRecord::iterator E = PPRec.begin(), EEnd = PPRec.end(); + for (PreprocessingRecord::iterator E = PPRec->begin(),EEnd = PPRec->end(); E != EEnd; ++E) { if (MacroInstantiation *MI = dyn_cast<MacroInstantiation>(*E)) { if (Visit(MakeMacroInstantiationCursor(MI, CXXUnit))) @@ -1014,7 +1014,8 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx, Args.push_back(source_filename); Args.insert(Args.end(), command_line_args, command_line_args + num_command_line_args); - + Args.push_back("-Xclang"); + Args.push_back("-detailed-preprocessing-record"); unsigned NumErrors = Diags->getNumErrors(); #ifdef USE_CRASHTRACER @@ -1028,8 +1029,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx, CXXIdx->getOnlyLocalDecls(), RemappedFiles.data(), RemappedFiles.size(), - /*CaptureDiagnostics=*/true, - /*WantPreprocessingRecord=*/true)); + /*CaptureDiagnostics=*/true)); // FIXME: Until we have broader testing, just drop the entire AST if we // encountered an error. @@ -1114,6 +1114,9 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx, TemporaryFiles.push_back(DiagnosticsFile); argv.push_back("-fdiagnostics-binary"); + argv.push_back("-Xclang"); + argv.push_back("-detailed-preprocessing-record"); + // Add the null terminator. argv.push_back(NULL); |