r196417 - Getting rid of some hard-coded strings. No functional changes intended, though some test cases needed to be updated for attribute names becoming quoted.

Aaron Ballman aaron at aaronballman.com
Wed Dec 4 14:02:33 PST 2013


Author: aaronballman
Date: Wed Dec  4 16:02:33 2013
New Revision: 196417

URL: http://llvm.org/viewvc/llvm-project?rev=196417&view=rev
Log:
Getting rid of some hard-coded strings. No functional changes intended, though some test cases needed to be updated for attribute names becoming quoted.

Modified:
    cfe/trunk/lib/Sema/TargetAttributesSema.cpp
    cfe/trunk/test/Sema/dllimport-dllexport.c

Modified: cfe/trunk/lib/Sema/TargetAttributesSema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TargetAttributesSema.cpp?rev=196417&r1=196416&r2=196417&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TargetAttributesSema.cpp (original)
+++ cfe/trunk/lib/Sema/TargetAttributesSema.cpp Wed Dec  4 16:02:33 2013
@@ -61,7 +61,7 @@ namespace {
     ARMAttributesSema() { }
     bool ProcessDeclAttribute(Scope *scope, Decl *D,
                               const AttributeList &Attr, Sema &S) const {
-      if (Attr.getName()->getName() == "interrupt") {
+      if (Attr.getKind() == AttributeList::AT_ARMInterrupt) {
         HandleARMInterruptAttr(D, Attr, S);
         return true;
       }
@@ -195,7 +195,7 @@ static void HandleDLLImportAttr(Decl *D,
   // Currently, the dllimport attribute is ignored for inlined functions.
   // Warning is emitted.
   if (FD && FD->isInlineSpecified()) {
-    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllimport";
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
     return;
   }
 
@@ -239,7 +239,7 @@ static void HandleDLLExportAttr(Decl *D,
   // the -fkeep-inline-functions flag has been used. Warning is emitted;
   if (FD && FD->isInlineSpecified()) {
     // FIXME: ... unless the -fkeep-inline-functions flag has been used.
-    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllexport";
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
     return;
   }
 
@@ -317,10 +317,10 @@ namespace {
     MipsAttributesSema() { }
     bool ProcessDeclAttribute(Scope *scope, Decl *D, const AttributeList &Attr,
                               Sema &S) const {
-      if (Attr.getName()->getName() == "mips16") {
+      if (Attr.getKind() == AttributeList::AT_Mips16) {
         HandleMips16Attr(D, Attr, S);
         return true;
-      } else if (Attr.getName()->getName() == "nomips16") {
+      } else if (Attr.getKind() == AttributeList::AT_NoMips16) {
         HandleNoMips16Attr(D, Attr, S);
         return true;
       }

Modified: cfe/trunk/test/Sema/dllimport-dllexport.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/dllimport-dllexport.c?rev=196417&r1=196416&r2=196417&view=diff
==============================================================================
--- cfe/trunk/test/Sema/dllimport-dllexport.c (original)
+++ cfe/trunk/test/Sema/dllimport-dllexport.c Wed Dec  4 16:02:33 2013
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -triple x86_64-mingw32 -fsyntax-only -verify %s
 
-inline void __attribute__((dllexport)) foo1(){} // expected-warning{{dllexport attribute ignored}}
-inline void __attribute__((dllimport)) foo2(){} // expected-warning{{dllimport attribute ignored}}
+inline void __attribute__((dllexport)) foo1(){} // expected-warning{{'dllexport' attribute ignored}}
+inline void __attribute__((dllimport)) foo2(){} // expected-warning{{'dllimport' attribute ignored}}
 
 void __attribute__((dllimport)) foo3(){} // expected-error{{dllimport attribute can be applied only to symbol declaration}}
 
@@ -19,8 +19,8 @@ void __attribute__((dllimport)) foo6();
 void foo6(){} // expected-warning {{'foo6' redeclared without dllimport attribute: previous dllimport ignored}}
 
 // PR6269
-inline void __declspec(dllexport) foo7(){} // expected-warning{{dllexport attribute ignored}}
-inline void __declspec(dllimport) foo8(){} // expected-warning{{dllimport attribute ignored}}
+inline void __declspec(dllexport) foo7(){} // expected-warning{{'dllexport' attribute ignored}}
+inline void __declspec(dllimport) foo8(){} // expected-warning{{'dllimport' attribute ignored}}
 
 void __declspec(dllimport) foo9(){} // expected-error{{dllimport attribute can be applied only to symbol declaration}}
 





More information about the cfe-commits mailing list