diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 3 | ||||
-rw-r--r-- | clang/lib/Lex/PreprocessingRecord.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 4 |
5 files changed, 11 insertions, 22 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 82255c722eb..3ffb6ecb4b2 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -220,7 +220,6 @@ ASTUnit::ASTUnit(bool _MainFileIsAST) PreambleRebuildCounter(0), SavedMainFileBuffer(0), PreambleBuffer(0), NumWarningsInPreamble(0), ShouldCacheCodeCompletionResults(false), - NestedMacroExpansions(true), CompletionCacheTopLevelHashValue(0), PreambleTopLevelHashValue(0), CurrentTopLevelHashValue(0), @@ -1093,8 +1092,6 @@ bool ASTUnit::Parse(llvm::MemoryBuffer *OverrideMainBuffer) { // If the main file has been overridden due to the use of a preamble, // make that override happen and introduce the preamble. PreprocessorOptions &PreprocessorOpts = Clang->getPreprocessorOpts(); - PreprocessorOpts.DetailedRecordIncludesNestedMacroExpansions - = NestedMacroExpansions; if (OverrideMainBuffer) { PreprocessorOpts.addRemappedFile(OriginalSourceFile, OverrideMainBuffer); PreprocessorOpts.PrecompiledPreambleBytes.first = Preamble.size(); @@ -1832,8 +1829,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, bool CaptureDiagnostics, bool PrecompilePreamble, TranslationUnitKind TUKind, - bool CacheCodeCompletionResults, - bool NestedMacroExpansions) { + bool CacheCodeCompletionResults) { // Create the AST unit. OwningPtr<ASTUnit> AST; AST.reset(new ASTUnit(false)); @@ -1844,7 +1840,6 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, AST->TUKind = TUKind; AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults; AST->Invocation = CI; - AST->NestedMacroExpansions = NestedMacroExpansions; // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit> @@ -1867,8 +1862,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, bool RemappedFilesKeepOriginalName, bool PrecompilePreamble, TranslationUnitKind TUKind, - bool CacheCodeCompletionResults, - bool NestedMacroExpansions) { + bool CacheCodeCompletionResults) { if (!Diags.getPtr()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. @@ -1926,7 +1920,6 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, AST->StoredDiagnostics.swap(StoredDiagnostics); AST->Invocation = CI; CI = 0; // Zero out now to ease cleanup during crash recovery. - AST->NestedMacroExpansions = NestedMacroExpansions; // Recover resources if we crash before exiting this method. llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit> diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 8d84277f015..2ade1c17e13 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -257,8 +257,7 @@ void CompilerInstance::createPreprocessor() { } if (PPOpts.DetailedRecord) - PP->createPreprocessingRecord( - PPOpts.DetailedRecordIncludesNestedMacroExpansions); + PP->createPreprocessingRecord(); InitializePreprocessor(*PP, PPOpts, getHeaderSearchOpts(), getFrontendOpts()); diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp index 6c36e73ad33..c87088d2dec 100644 --- a/clang/lib/Lex/PreprocessingRecord.cpp +++ b/clang/lib/Lex/PreprocessingRecord.cpp @@ -37,10 +37,8 @@ InclusionDirective::InclusionDirective(PreprocessingRecord &PPRec, this->FileName = StringRef(Memory, FileName.size()); } -PreprocessingRecord::PreprocessingRecord(SourceManager &SM, - bool IncludeNestedMacroExpansions) - : SourceMgr(SM), IncludeNestedMacroExpansions(IncludeNestedMacroExpansions), - ExternalSource(0) +PreprocessingRecord::PreprocessingRecord(SourceManager &SM) + : SourceMgr(SM), ExternalSource(0) { } @@ -331,7 +329,8 @@ MacroDefinition *PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) { void PreprocessingRecord::MacroExpands(const Token &Id, const MacroInfo* MI, SourceRange Range) { - if (!IncludeNestedMacroExpansions && Id.getLocation().isMacroID()) + // We don't record nested macro expansions. + if (Id.getLocation().isMacroID()) return; if (MI->isBuiltinMacro()) diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 75ab89d4d9b..96dfe360069 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -654,12 +654,10 @@ CommentHandler::~CommentHandler() { } CodeCompletionHandler::~CodeCompletionHandler() { } -void Preprocessor::createPreprocessingRecord( - bool IncludeNestedMacroExpansions) { +void Preprocessor::createPreprocessingRecord() { if (Record) return; - Record = new PreprocessingRecord(getSourceManager(), - IncludeNestedMacroExpansions); + Record = new PreprocessingRecord(getSourceManager()); addPPCallbacks(Record); } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index dde54d6b791..efe70e095a1 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1744,7 +1744,7 @@ ASTReader::ReadASTBlock(ModuleFile &F) { = F.PreprocessorDetailCursor.GetCurrentBitNo(); if (!PP.getPreprocessingRecord()) - PP.createPreprocessingRecord(true); + PP.createPreprocessingRecord(); if (!PP.getPreprocessingRecord()->getExternalSource()) PP.getPreprocessingRecord()->SetExternalSource(*this); break; @@ -2288,7 +2288,7 @@ ASTReader::ReadASTBlock(ModuleFile &F) { unsigned StartingID; if (!PP.getPreprocessingRecord()) - PP.createPreprocessingRecord(true); + PP.createPreprocessingRecord(); if (!PP.getPreprocessingRecord()->getExternalSource()) PP.getPreprocessingRecord()->SetExternalSource(*this); StartingID |