diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-25 07:31:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-25 07:31:49 +0000 |
commit | 140aadf5b927ae294388c680a7db44e5de39578a (patch) | |
tree | 96812eae4bd863a8b2633b922d8d8fb41ebef6c5 /lib/Sema/SemaDecl.cpp | |
parent | eaf5ec43ec52f650a00254d1c20d51fb7671aead (diff) |
Add 171048 back but invalidate the cache of all redeclarations when setting
the body of a functions. The problem was that hasBody looks at the entire chain
and causes problems to -fvisibility-inlines-hidden if the cache was not
invalidated.
Original message:
Cache visibility of decls.
This unifies the linkage and visibility caching. I first implemented this when
working on pr13844, but the previous fixes removed the performance advantage of
this one.
This is still a step in the right direction for making linkage and visibility
cheap to use.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 105ef49bd8..e1d772b084 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1775,9 +1775,13 @@ bool Sema::mergeDeclAttribute(Decl *D, InheritableAttr *Attr) { AA->getIntroduced(), AA->getDeprecated(), AA->getObsoleted(), AA->getUnavailable(), AA->getMessage()); - else if (VisibilityAttr *VA = dyn_cast<VisibilityAttr>(Attr)) + else if (VisibilityAttr *VA = dyn_cast<VisibilityAttr>(Attr)) { NewAttr = mergeVisibilityAttr(D, VA->getRange(), VA->getVisibility()); - else if (DLLImportAttr *ImportA = dyn_cast<DLLImportAttr>(Attr)) + if (NewAttr) { + NamedDecl *ND = cast<NamedDecl>(D); + ND->ClearLVCache(); + } + } else if (DLLImportAttr *ImportA = dyn_cast<DLLImportAttr>(Attr)) NewAttr = mergeDLLImportAttr(D, ImportA->getRange()); else if (DLLExportAttr *ExportA = dyn_cast<DLLExportAttr>(Attr)) NewAttr = mergeDLLExportAttr(D, ExportA->getRange()); @@ -6611,7 +6615,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } VDecl->setTypeSourceInfo(DeducedType); VDecl->setType(DeducedType->getType()); - VDecl->ClearLinkageCache(); + VDecl->ClearLVCache(); // In ARC, infer lifetime. if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(VDecl)) |