diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/MacroInfo.cpp | 21 | ||||
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 14 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 15 |
5 files changed, 4 insertions, 57 deletions
diff --git a/clang/lib/Lex/MacroInfo.cpp b/clang/lib/Lex/MacroInfo.cpp index dbc804490b2..7581fe3cd7a 100644 --- a/clang/lib/Lex/MacroInfo.cpp +++ b/clang/lib/Lex/MacroInfo.cpp @@ -218,8 +218,6 @@ void MacroDirective::dump() const { if (auto *Prev = getPrevious()) Out << " prev " << Prev; if (IsFromPCH) Out << " from_pch"; - if (IsImported) Out << " imported"; - if (IsAmbiguous) Out << " ambiguous"; if (IsPublic) Out << " public"; @@ -235,25 +233,6 @@ void MacroDirective::dump() const { Out << "\n"; } -DefMacroDirective * -DefMacroDirective::createImported(Preprocessor &PP, MacroInfo *MI, - SourceLocation Loc, - ModuleMacro *ImportedFrom) { - void *Mem = PP.getPreprocessorAllocator().Allocate( - sizeof(DefMacroDirective) + sizeof(MacroDirective::ImportData), - llvm::alignOf<DefMacroDirective>()); - return new (Mem) DefMacroDirective(MI, Loc, ImportedFrom); -} - -UndefMacroDirective * -UndefMacroDirective::createImported(Preprocessor &PP, SourceLocation Loc, - ModuleMacro *ImportedFrom) { - void *Mem = PP.getPreprocessorAllocator().Allocate( - sizeof(UndefMacroDirective) + sizeof(MacroDirective::ImportData), - llvm::alignOf<UndefMacroDirective>()); - return new (Mem) UndefMacroDirective(Loc, ImportedFrom); -} - ModuleMacro *ModuleMacro::create(Preprocessor &PP, Module *OwningModule, IdentifierInfo *II, MacroInfo *Macro, ArrayRef<ModuleMacro *> Overrides) { diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 6c25bd87a27..1c66aac533b 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -78,15 +78,6 @@ Preprocessor::AllocateVisibilityMacroDirective(SourceLocation Loc, return new (BP) VisibilityMacroDirective(Loc, isPublic); } -MacroDirective * -Preprocessor::AllocateImportedMacroDirective(ModuleMacro *MM, - SourceLocation Loc) { - if (auto *MI = MM->getMacroInfo()) - return DefMacroDirective::createImported(*this, MI, Loc, MM); - else - return UndefMacroDirective::createImported(*this, Loc, MM); -} - /// \brief Read and discard all tokens remaining on the current line until /// the tok::eod token is found. void Preprocessor::DiscardUntilEndOfDirective() { diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index cc8b7fe6dbd..0aff712abbc 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -55,7 +55,7 @@ void Preprocessor::appendMacroDirective(IdentifierInfo *II, MacroDirective *MD){ II->setHasMacroDefinition(true); if (!MD->isDefined() && LeafModuleMacros.find(II) == LeafModuleMacros.end()) II->setHasMacroDefinition(false); - if (II->isFromAST() && !MD->isImported()) + if (II->isFromAST()) II->setChangedSinceDeserialization(); } diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 921c06ce670..7225d2f610a 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1809,21 +1809,11 @@ void ASTReader::resolvePendingMacro(IdentifierInfo *II, switch (K) { case MacroDirective::MD_Define: { MacroInfo *MI = getMacro(getGlobalMacroID(M, Record[Idx++])); - bool IsAmbiguous = Record[Idx++]; - ModuleMacro *MM = nullptr; - if (SubmoduleID ImportedFrom = getGlobalSubmoduleID(M, Record[Idx++])) - MM = PP.getModuleMacro(getSubmodule(ImportedFrom), II); - MD = MM ? PP.AllocateImportedMacroDirective(MM, Loc) - : PP.AllocateDefMacroDirective(MI, Loc); - cast<DefMacroDirective>(MD)->setAmbiguous(IsAmbiguous); + MD = PP.AllocateDefMacroDirective(MI, Loc); break; } case MacroDirective::MD_Undefine: { - ModuleMacro *MM = nullptr; - if (SubmoduleID ImportedFrom = getGlobalSubmoduleID(M, Record[Idx++])) - MM = PP.getModuleMacro(getSubmodule(ImportedFrom), II); - MD = MM ? PP.AllocateImportedMacroDirective(MM, Loc) - : PP.AllocateUndefMacroDirective(Loc); + MD = PP.AllocateUndefMacroDirective(Loc); break; } case MacroDirective::MD_Visibility: diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 9fe83234a1a..38436977341 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1979,10 +1979,6 @@ static bool shouldIgnoreMacro(MacroDirective *MD, bool IsModule, return true; if (IsModule) { - // Re-export any imported directives. - if (MD->isImported()) - return false; - SourceLocation Loc = MD->getLocation(); if (Loc.isInvalid()) return true; @@ -2066,19 +2062,10 @@ void ASTWriter::WritePreprocessor(const Preprocessor &PP, bool IsModule) { AddSourceLocation(MD->getLocation(), Record); Record.push_back(MD->getKind()); if (auto *DefMD = dyn_cast<DefMacroDirective>(MD)) { - MacroID InfoID = getMacroRef(DefMD->getInfo(), Name); - Record.push_back(InfoID); - Record.push_back(DefMD->isAmbiguous()); + Record.push_back(getMacroRef(DefMD->getInfo(), Name)); } else if (auto *VisMD = dyn_cast<VisibilityMacroDirective>(MD)) { Record.push_back(VisMD->isPublic()); - // No owning module macro. - continue; } - - if (auto *MM = MD->getOwningModuleMacro()) - Record.push_back(getSubmoduleID(MM->getOwningModule())); - else - Record.push_back(0); } // Write out any exported module macros. |