]> granicus.if.org Git - clang/commitdiff
add fixit advice to an archiac ObjC issue.
authorChris Lattner <sabre@nondot.org>
Fri, 3 Apr 2009 18:38:42 +0000 (18:38 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 3 Apr 2009 18:38:42 +0000 (18:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68395 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/FixIt/fixit-objc.m [new file with mode: 0644]

index 1f8d4738919b352e09d038114578228aaf88d23e..83c02490fe4fa6bc4e0023a0a085111cb6c495cd 100644 (file)
@@ -832,6 +832,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
         DS.SetRangeEnd(EndProtoLoc);
 
         Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id)
+          << CodeModificationHint::CreateInsertion(Loc, "id")
           << SourceRange(Loc, EndProtoLoc);
         // Need to support trailing type qualifiers (e.g. "id<p> const").
         // If a type specifier follows, it will be diagnosed elsewhere.
diff --git a/test/FixIt/fixit-objc.m b/test/FixIt/fixit-objc.m
new file mode 100644 (file)
index 0000000..baef233
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang-cc -fsyntax-only -fixit-at=fixit-at.c:3:1 %s -o %t.m &&
+// RUN: clang-cc -verify %t.m
+
+@protocol X;
+
+void foo() {
+  <X> *P;    // should be fixed to 'id<X>'.
+}