瀏覽代碼

Specifying the diagnostic argument through the attribute table generator instead of having to enter it manually as part of the attribute subject list. This only affects attributes appertaining to ObjC interfaces and protocols.

No new tests required as this is covered by existing tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213193 91177308-0d34-0410-b5e6-96231b3b80d8
Aaron Ballman 11 年之前
父節點
當前提交
7b183ffd3e
共有 2 個文件被更改,包括 6 次插入5 次删除
  1. 4 5
      include/clang/Basic/Attr.td
  2. 2 0
      utils/TableGen/ClangAttrEmitter.cpp

+ 4 - 5
include/clang/Basic/Attr.td

@@ -990,11 +990,10 @@ def ObjCDesignatedInitializer : Attr {
 }
 
 def ObjCRuntimeName : Attr {
-    let Spellings = [GNU<"objc_runtime_name">];
-    let Subjects = SubjectList<[ObjCInterface, ObjCProtocol], ErrorDiag,
-    "ExpectedObjectiveCInterfaceOrProtocol">;
-    let Args = [StringArgument<"MetadataName">];
-    let Documentation = [ObjCRuntimeNameDocs];
+  let Spellings = [GNU<"objc_runtime_name">];
+  let Subjects = SubjectList<[ObjCInterface, ObjCProtocol], ErrorDiag>;
+  let Args = [StringArgument<"MetadataName">];
+  let Documentation = [ObjCRuntimeNameDocs];
 }
 
 def OptimizeNone : InheritableAttr {

+ 2 - 0
utils/TableGen/ClangAttrEmitter.cpp

@@ -2154,6 +2154,8 @@ static std::string CalculateDiagnostic(const Record &S) {
                                            "ExpectedVariableOrFunction)";
 
     case ObjCMethod | ObjCProp: return "ExpectedMethodOrProperty";
+    case ObjCProtocol | ObjCInterface:
+      return "ExpectedObjectiveCInterfaceOrProtocol";
     case Field | Var: return "ExpectedFieldOrGlobalVar";
   }