diff options
author | Daniel Jasper <djasper@google.com> | 2017-05-15 07:51:10 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2017-05-15 07:51:10 +0000 |
commit | 89f9ad8636c672eb26e881f0f9f31f7de8c303a0 (patch) | |
tree | f72d01e8924b0206ceca2284f28c79cfca738e15 /clang/lib/AST/DeclBase.cpp | |
parent | 06c61e863962f56ca0a8213eb3e2fa0666f5c53e (diff) | |
download | bcm5719-llvm-89f9ad8636c672eb26e881f0f9f31f7de8c303a0.tar.gz bcm5719-llvm-89f9ad8636c672eb26e881f0f9f31f7de8c303a0.zip |
Revert r302965 - [modules] When creating a declaration, cache its owning
module immediately
Also revert dependent r302969. This is leading to crashes.
Will provide more details reproduction instructions to Richard.
llvm-svn: 303037
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index e0c626c585b..5c2c9cbd018 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -75,7 +75,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Ctx, assert(!Parent || &Parent->getParentASTContext() == &Ctx); // With local visibility enabled, we track the owning module even for local // declarations. - if (Ctx.getLangOpts().trackLocalOwningModule()) { + if (Ctx.getLangOpts().ModulesLocalVisibility) { // Ensure required alignment of the resulting object by adding extra // padding at the start if required. size_t ExtraAlign = @@ -83,9 +83,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Ctx, char *Buffer = reinterpret_cast<char *>( ::operator new(ExtraAlign + sizeof(Module *) + Size + Extra, Ctx)); Buffer += ExtraAlign; - auto *ParentModule = - Parent ? cast<Decl>(Parent)->getOwningModule() : nullptr; - return new (Buffer) Module*(ParentModule) + 1; + return new (Buffer) Module*(nullptr) + 1; } return ::operator new(Size + Extra, Ctx); } @@ -96,7 +94,7 @@ Module *Decl::getOwningModuleSlow() const { } bool Decl::hasLocalOwningModuleStorage() const { - return getASTContext().getLangOpts().trackLocalOwningModule(); + return getASTContext().getLangOpts().ModulesLocalVisibility; } const char *Decl::getDeclKindName() const { @@ -275,11 +273,6 @@ void Decl::setLexicalDeclContext(DeclContext *DC) { getMultipleDC()->LexicalDC = DC; } Hidden = cast<Decl>(DC)->Hidden; - if (Hidden && !isFromASTFile()) { - assert(hasLocalOwningModuleStorage() && - "hidden local declaration without local submodule visibility?"); - setLocalOwningModule(cast<Decl>(DC)->getOwningModule()); - } } void Decl::setDeclContextsImpl(DeclContext *SemaDC, DeclContext *LexicalDC, |