r196954 - Enhance attribute machinery to include ObjCProtocols as "subjects" in attribute declarations.

Ted Kremenek kremenek at apple.com
Tue Dec 10 11:43:43 PST 2013


Author: kremenek
Date: Tue Dec 10 13:43:42 2013
New Revision: 196954

URL: http://llvm.org/viewvc/llvm-project?rev=196954&view=rev
Log:
Enhance attribute machinery to include ObjCProtocols as "subjects" in attribute declarations.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/include/clang/Sema/AttributeList.h
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=196954&r1=196953&r2=196954&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec 10 13:43:42 2013
@@ -2038,7 +2038,7 @@ def warn_attribute_wrong_decl_type : War
   "types and namespaces|Objective-C interfaces|methods and properties|"
   "struct or union|struct, union or class|types|"
   "Objective-C instance methods|init methods of interface declarations|"
-  "variables, functions and classes}1">,
+  "variables, functions and classes|Objective-C protocols}1">,
   InGroup<IgnoredAttributes>;
 def err_attribute_wrong_decl_type : Error<
   "%0 attribute only applies to %select{functions|unions|"
@@ -2051,7 +2051,7 @@ def err_attribute_wrong_decl_type : Erro
   "types and namespaces|Objective-C interfaces|methods and properties|"
   "struct or union|struct, union or class|types|"
   "Objective-C instance methods|init methods of interface declarations|"
-  "variables, functions and classes}1">;
+  "variables, functions and classes|Objective-C protocols}1">;
 def warn_type_attribute_wrong_type : Warning<
   "'%0' only applies to %select{function|pointer|"
   "Objective-C object or block pointer}1 types; type here is %2">,

Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=196954&r1=196953&r2=196954&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Tue Dec 10 13:43:42 2013
@@ -910,7 +910,8 @@ enum AttributeDeclKind {
   ExpectedType,
   ExpectedObjCInstanceMethod,
   ExpectedObjCInterfaceDeclInitMethod,
-  ExpectedFunctionVariableOrClass
+  ExpectedFunctionVariableOrClass,
+  ExpectedObjectiveCProtocol
 };
 
 }  // end namespace clang

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=196954&r1=196953&r2=196954&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Tue Dec 10 13:43:42 2013
@@ -1723,7 +1723,8 @@ static std::string CalculateDiagnostic(c
     Namespace = 1U << 11,
     FuncTemplate = 1U << 12,
     Field = 1U << 13,
-    CXXMethod = 1U << 14
+    CXXMethod = 1U << 14,
+    ObjCProtocol = 1U << 15
   };
   uint32_t SubMask = 0;
 
@@ -1752,6 +1753,7 @@ static std::string CalculateDiagnostic(c
                    .Case("ObjCProperty", ObjCProp)
                    .Case("Record", GenericRecord)
                    .Case("ObjCInterface", ObjCInterface)
+                   .Case("ObjCProtocol", ObjCProtocol)
                    .Case("Block", Block)
                    .Case("CXXRecord", Class)
                    .Case("Namespace", Namespace)
@@ -1783,6 +1785,7 @@ static std::string CalculateDiagnostic(c
     case ObjCMethod:  return "ExpectedMethod";
     case Type:  return "ExpectedType";
     case ObjCInterface: return "ExpectedObjectiveCInterface";
+    case ObjCProtocol: return "ExpectedObjectiveCProtocol";
     
     // "GenericRecord" means struct, union or class; check the language options
     // and if not compiling for C++, strip off the class part. Note that this





More information about the cfe-commits mailing list