diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-25 00:39:58 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-25 00:39:58 +0000 |
commit | f92a59f0cb84d91cb34986b98c6516ed8abba6d7 (patch) | |
tree | 8268a88575c95d2e09bd867719438b068a1a6f20 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | fe73ac34c5a4aabd3f95f71f21257ab90ce6165c (diff) | |
download | bcm5719-llvm-f92a59f0cb84d91cb34986b98c6516ed8abba6d7.tar.gz bcm5719-llvm-f92a59f0cb84d91cb34986b98c6516ed8abba6d7.zip |
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.
llvm-svn: 171048
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 22aad165e96..437e2a826be 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2147,8 +2147,11 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, Deprecated.Version, Obsoleted.Version, IsUnavailable, Str); - if (NewAttr) + if (NewAttr) { D->addAttr(NewAttr); + NamedDecl *ND = cast<NamedDecl>(D); + ND->ClearLVCache(); + } } VisibilityAttr *Sema::mergeVisibilityAttr(Decl *D, SourceRange Range, @@ -2165,6 +2168,8 @@ VisibilityAttr *Sema::mergeVisibilityAttr(Decl *D, SourceRange Range, Diag(ExistingAttr->getLocation(), diag::err_mismatched_visibility); Diag(Range.getBegin(), diag::note_previous_attribute); D->dropAttr<VisibilityAttr>(); + NamedDecl *ND = cast<NamedDecl>(D); + ND->ClearLVCache(); } return ::new (Context) VisibilityAttr(Range, Context, Vis); } @@ -2208,8 +2213,11 @@ static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { } VisibilityAttr *NewAttr = S.mergeVisibilityAttr(D, Attr.getRange(), type); - if (NewAttr) + if (NewAttr) { D->addAttr(NewAttr); + NamedDecl *ND = cast<NamedDecl>(D); + ND->ClearLVCache(); + } } static void handleObjCMethodFamilyAttr(Sema &S, Decl *decl, |