]> granicus.if.org Git - clang/commitdiff
Enhance attribute machinery to include ObjCProtocols as "subjects" in attribute decla...
authorTed Kremenek <kremenek@apple.com>
Tue, 10 Dec 2013 19:43:42 +0000 (19:43 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 10 Dec 2013 19:43:42 +0000 (19:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196954 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/AttributeList.h
utils/TableGen/ClangAttrEmitter.cpp

index 23339fe7ef100f1492b7948eec4a587214d4d872..ddfac336ded0fae4a35a2d0b8c45f8f4191c87b3 100644 (file)
@@ -2038,7 +2038,7 @@ def warn_attribute_wrong_decl_type : Warning<
   "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 : Error<
   "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">,
index f661dd08739217b78b310a5e244af47f3e06998c..9d870a22c2fef6f73d625a6ffcaae5b3308d393f 100644 (file)
@@ -910,7 +910,8 @@ enum AttributeDeclKind {
   ExpectedType,
   ExpectedObjCInstanceMethod,
   ExpectedObjCInterfaceDeclInitMethod,
-  ExpectedFunctionVariableOrClass
+  ExpectedFunctionVariableOrClass,
+  ExpectedObjectiveCProtocol
 };
 
 }  // end namespace clang
index 395400ea854669320a7f42c7d8c3c5bff7d51b05..21920644f39ee44b086da4bdd50d0cc095217fd6 100644 (file)
@@ -1723,7 +1723,8 @@ static std::string CalculateDiagnostic(const Record &S) {
     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(const Record &S) {
                    .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(const Record &S) {
     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