r198054 - Removed a string literal for an attribute name, which means the attribute name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate.
Aaron Ballman
aaron at aaronballman.com
Thu Dec 26 09:30:44 PST 2013
Author: aaronballman
Date: Thu Dec 26 11:30:44 2013
New Revision: 198054
URL: http://llvm.org/viewvc/llvm-project?rev=198054&view=rev
Log:
Removed a string literal for an attribute name, which means the attribute name will be quoted in the diagnostic. Manually added some quotes to a diagnostic for consistency. Updated the test cases as appropriate.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-used.c
cfe/trunk/test/SemaCXX/attr-used.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=198054&r1=198053&r2=198054&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 26 11:30:44 2013
@@ -8934,7 +8934,7 @@ Sema::FinalizeDeclaration(Decl *ThisDecl
if (UsedAttr *Attr = VD->getAttr<UsedAttr>()) {
if (!Attr->isInherited() && !VD->isThisDeclarationADefinition()) {
- Diag(Attr->getLocation(), diag::warn_attribute_ignored) << "used";
+ Diag(Attr->getLocation(), diag::warn_attribute_ignored) << "'used'";
VD->dropAttr<UsedAttr>();
}
}
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=198054&r1=198053&r2=198054&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Dec 26 11:30:44 2013
@@ -1622,7 +1622,7 @@ static void handleUnusedAttr(Sema &S, De
static void handleUsedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
if (VD->hasLocalStorage()) {
- S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "used";
+ S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
return;
}
} else if (!isFunctionOrMethod(D)) {
Modified: cfe/trunk/test/Sema/attr-used.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-used.c?rev=198054&r1=198053&r2=198054&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-used.c (original)
+++ cfe/trunk/test/Sema/attr-used.c Thu Dec 26 11:30:44 2013
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s
-extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
-__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}
+extern int l0 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
+__private_extern__ int l1 __attribute__((used)); // expected-warning {{'used' attribute ignored}}
struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
int x;
@@ -13,8 +13,8 @@ static void __attribute__((used)) f0(voi
}
void f1() {
- static int a __attribute__((used));
- int b __attribute__((used)); // expected-warning {{used attribute ignored}}
+ static int a __attribute__((used));
+ int b __attribute__((used)); // expected-warning {{'used' attribute ignored}}
}
static void __attribute__((used)) f0(void);
Modified: cfe/trunk/test/SemaCXX/attr-used.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-used.cpp?rev=198054&r1=198053&r2=198054&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-used.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-used.cpp Thu Dec 26 11:30:44 2013
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-extern char test1[] __attribute__((used)); // expected-warning {{used attribute ignored}}
-extern const char test2[] __attribute__((used)); // expected-warning {{used attribute ignored}}
+extern char test1[] __attribute__((used)); // expected-warning {{'used' attribute ignored}}
+extern const char test2[] __attribute__((used)); // expected-warning {{'used' attribute ignored}}
extern const char test3[] __attribute__((used)) = "";
More information about the cfe-commits
mailing list