summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-19 16:15:56 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-19 16:15:56 +0000
commit7f6d60dcc2cea9975c125fe6750ecc39af6a6fb0 (patch)
treebe9ba62d824d411415b67cc23233856110c3bdff /clang/tools/CIndex/CIndex.cpp
parent45a967cd628f44cdb8e3430ccddbd8c8c6a3b1af (diff)
downloadbcm5719-llvm-7f6d60dcc2cea9975c125fe6750ecc39af6a6fb0.tar.gz
bcm5719-llvm-7f6d60dcc2cea9975c125fe6750ecc39af6a6fb0.zip
Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record. llvm-svn: 98963
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
-rw-r--r--clang/tools/CIndex/CIndex.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp
index c51ca7f1190..f20bb753747 100644
--- a/clang/tools/CIndex/CIndex.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud