]> granicus.if.org Git - clang/commitdiff
Clear the LV cache when merging the availability attribute.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Jan 2013 04:04:30 +0000 (04:04 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 8 Jan 2013 04:04:30 +0000 (04:04 +0000)
The availability implies default visibility, so it can change the computed
visibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171840 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/attr-availability.c

index 84b0d3f36bffe7f08e21a96a3a43e9c74120d105..3b37890f218d80c306a9211cd6a09ccbc85f02ee 100644 (file)
@@ -1790,12 +1790,16 @@ DeclHasAttr(const Decl *D, const Attr *A) {
 
 bool Sema::mergeDeclAttribute(Decl *D, InheritableAttr *Attr) {
   InheritableAttr *NewAttr = NULL;
-  if (AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attr))
+  if (AvailabilityAttr *AA = dyn_cast<AvailabilityAttr>(Attr)) {
     NewAttr = mergeAvailabilityAttr(D, AA->getRange(), AA->getPlatform(),
                                     AA->getIntroduced(), AA->getDeprecated(),
                                     AA->getObsoleted(), AA->getUnavailable(),
                                     AA->getMessage());
-  else if (VisibilityAttr *VA = dyn_cast<VisibilityAttr>(Attr)) {
+    if (NewAttr) {
+      NamedDecl *ND = cast<NamedDecl>(D);
+      ND->ClearLVCache();
+    }
+  } else if (VisibilityAttr *VA = dyn_cast<VisibilityAttr>(Attr)) {
     NewAttr = mergeVisibilityAttr(D, VA->getRange(), VA->getVisibility());
     if (NewAttr) {
       NamedDecl *ND = cast<NamedDecl>(D);
index e0c541e8d839bd9a34371b4ebf5ad80873184b9a..1d4b0efed645a69e7c5ea7f5c22f75ddc559fa78 100644 (file)
@@ -43,3 +43,6 @@ void f7(int) __attribute__((availability(ios,deprecated=4.0))); // expected-warn
 #if !__has_feature(attribute_availability_with_message)
 # error "Missing __has_feature"
 #endif
+
+extern int x __attribute__((availability(macosx,introduced=10.5)));
+extern int x;