Don't reject attribute used in an "extern const" variable definition.
Before this patch we would warn and drop the attribute in
extern const char test3[] __attribute__((used)) = "";
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188588 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 77b242d..a82b396 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1944,7 +1944,7 @@
}
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
- if (VD->hasLocalStorage() || VD->hasExternalStorage()) {
+ if (VD->hasLocalStorage()) {
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "used";
return;
}