[cfe-commits] r171840 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/attr-availability.c
Rafael Espindola
rafael.espindola at gmail.com
Mon Jan 7 20:04:30 PST 2013
Author: rafael
Date: Mon Jan 7 22:04:30 2013
New Revision: 171840
URL: http://llvm.org/viewvc/llvm-project?rev=171840&view=rev
Log:
Clear the LV cache when merging the availability attribute.
The availability implies default visibility, so it can change the computed
visibility.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/attr-availability.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=171840&r1=171839&r2=171840&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jan 7 22:04:30 2013
@@ -1790,12 +1790,16 @@
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);
Modified: cfe/trunk/test/Sema/attr-availability.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability.c?rev=171840&r1=171839&r2=171840&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability.c (original)
+++ cfe/trunk/test/Sema/attr-availability.c Mon Jan 7 22:04:30 2013
@@ -43,3 +43,6 @@
#if !__has_feature(attribute_availability_with_message)
# error "Missing __has_feature"
#endif
+
+extern int x __attribute__((availability(macosx,introduced=10.5)));
+extern int x;
More information about the cfe-commits
mailing list