[cfe-commits] r171906 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/attr-availability.c

Rafael Espindola rafael.espindola at gmail.com
Tue Jan 8 14:31:36 PST 2013


Author: rafael
Date: Tue Jan  8 16:31:36 2013
New Revision: 171906

URL: http://llvm.org/viewvc/llvm-project?rev=171906&view=rev
Log:
Clear LV cache when dropping availability attributes.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Sema/attr-availability.c

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=171906&r1=171905&r2=171906&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jan  8 16:31:36 2013
@@ -2043,6 +2043,7 @@
   VersionTuple MergedDeprecated = Deprecated;
   VersionTuple MergedObsoleted = Obsoleted;
   bool FoundAny = false;
+  bool DroppedAny = false;
 
   if (D->hasAttrs()) {
     AttrVec &Attrs = D->getAttrs();
@@ -2077,6 +2078,7 @@
         Diag(OldAA->getLocation(), diag::warn_mismatched_availability);
         Diag(Range.getBegin(), diag::note_previous_attribute);
         Attrs.erase(Attrs.begin() + i);
+        DroppedAny = true;
         --e;
         continue;
       }
@@ -2096,6 +2098,7 @@
                                 MergedIntroduced2, MergedDeprecated2,
                                 MergedObsoleted2)) {
         Attrs.erase(Attrs.begin() + i);
+        DroppedAny = true;
         --e;
         continue;
       }
@@ -2107,6 +2110,9 @@
     }
   }
 
+  if (DroppedAny)
+    D->ClearLVCache();
+
   if (FoundAny &&
       MergedIntroduced == Introduced &&
       MergedDeprecated == Deprecated &&

Modified: cfe/trunk/test/Sema/attr-availability.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability.c?rev=171906&r1=171905&r2=171906&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability.c (original)
+++ cfe/trunk/test/Sema/attr-availability.c Tue Jan  8 16:31:36 2013
@@ -51,3 +51,6 @@
   int (^b)(int);
   b = ^ (int i) __attribute__((availability(macosx,introduced=10.2))) { return 1; }; // expected-warning {{'availability' attribute ignored}}
 }
+
+extern int x2 __attribute__((availability(macosx,introduced=10.2))); // expected-note {{previous attribute is here}}
+extern int x2 __attribute__((availability(macosx,introduced=10.5))); // expected-warning {{availability does not match previous declaration}}





More information about the cfe-commits mailing list