diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-15 02:34:32 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-15 02:34:32 +0000 |
commit | 4caa449adea77d88307e03f0284494c9c33f8dd7 (patch) | |
tree | 8db88112860bca5b8213e14c9d80778bb5078b3f /clang/lib | |
parent | 9953f0886bd37abc37622857c530deec29f097aa (diff) | |
download | bcm5719-llvm-4caa449adea77d88307e03f0284494c9c33f8dd7.tar.gz bcm5719-llvm-4caa449adea77d88307e03f0284494c9c33f8dd7.zip |
Refactor: when exposing a definition in some module, provide listeners with the
module rather than requiring them to work it out themselves.
llvm-svn: 237416
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/MultiplexConsumer.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Serialization/ASTWriter.cpp | 7 |
3 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Frontend/MultiplexConsumer.cpp b/clang/lib/Frontend/MultiplexConsumer.cpp index 1512b5e6ba9..219e9492d28 100644 --- a/clang/lib/Frontend/MultiplexConsumer.cpp +++ b/clang/lib/Frontend/MultiplexConsumer.cpp @@ -111,8 +111,7 @@ public: const ObjCCategoryDecl *ClassExt) override; void DeclarationMarkedUsed(const Decl *D) override; void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override; - void RedefinedHiddenDefinition(const NamedDecl *D, - SourceLocation Loc) override; + void RedefinedHiddenDefinition(const NamedDecl *D, Module *M) override; private: std::vector<ASTMutationListener*> Listeners; @@ -196,10 +195,10 @@ void MultiplexASTMutationListener::DeclarationMarkedOpenMPThreadPrivate( for (size_t i = 0, e = Listeners.size(); i != e; ++i) Listeners[i]->DeclarationMarkedOpenMPThreadPrivate(D); } -void MultiplexASTMutationListener::RedefinedHiddenDefinition( - const NamedDecl *D, SourceLocation Loc) { +void MultiplexASTMutationListener::RedefinedHiddenDefinition(const NamedDecl *D, + Module *M) { for (auto *L : Listeners) - L->RedefinedHiddenDefinition(D, Loc); + L->RedefinedHiddenDefinition(D, M); } } // end namespace clang diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 012c1cf3927..5e7e34a8928 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -25,6 +25,7 @@ #include "clang/Basic/Builtins.h" #include "clang/Basic/LangOptions.h" #include "clang/Lex/ModuleLoader.h" +#include "clang/Lex/Preprocessor.h" #include "clang/Sema/DeclSpec.h" #include "clang/Sema/ExternalSemaSource.h" #include "clang/Sema/Overload.h" @@ -1172,7 +1173,8 @@ static Decl *getInstantiatedFrom(Decl *D, MemberSpecializationInfo *MSInfo) { void Sema::makeMergedDefinitionVisible(NamedDecl *ND, SourceLocation Loc) { if (auto *Listener = getASTMutationListener()) - Listener->RedefinedHiddenDefinition(ND, Loc); + Listener->RedefinedHiddenDefinition(ND, + PP.getModuleContainingLocation(Loc)); ND->setHidden(false); } diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 29a88a13d38..1e7fc5cdb6a 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -4598,7 +4598,7 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) { break; case UPD_DECL_EXPORTED: - Record.push_back(inferSubmoduleIDFromLocation(Update.getLoc())); + Record.push_back(getSubmoduleID(Update.getModule())); break; } } @@ -5743,10 +5743,9 @@ void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(const Decl *D) { DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_MARKED_OPENMP_THREADPRIVATE)); } -void ASTWriter::RedefinedHiddenDefinition(const NamedDecl *D, - SourceLocation Loc) { +void ASTWriter::RedefinedHiddenDefinition(const NamedDecl *D, Module *M) { assert(!WritingAST && "Already writing the AST!"); assert(D->isHidden() && "expected a hidden declaration"); assert(D->isFromASTFile() && "hidden decl not from AST file"); - DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_EXPORTED, Loc)); + DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_EXPORTED, M)); } |