[cfe-commits] r59921 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Lex/PPExpressions.cpp lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/ParseStmt.cpp lib/Parse/Parser.cpp test/Parser/recovery-1.c test/Parser/typeof.c test/Sema/invalid-struct-init.c test/SemaCXX/nested-name-spec.cpp test/SemaCXX/new-delete.cpp test/SemaObjC/invalid-typename.m test/SemaObjC/property-9.m test/SemaObjC/protocol-archane.m

Chris Lattner sabre at nondot.org
Sun Nov 23 15:17:08 PST 2008


Author: lattner
Date: Sun Nov 23 17:17:07 2008
New Revision: 59921

URL: http://llvm.org/viewvc/llvm-project?rev=59921&view=rev
Log:
make the 'to match this' diagnostic a note.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticKinds.def
    cfe/trunk/lib/Lex/PPExpressions.cpp
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/lib/Parse/ParseStmt.cpp
    cfe/trunk/lib/Parse/Parser.cpp
    cfe/trunk/test/Parser/recovery-1.c
    cfe/trunk/test/Parser/typeof.c
    cfe/trunk/test/Sema/invalid-struct-init.c
    cfe/trunk/test/SemaCXX/nested-name-spec.cpp
    cfe/trunk/test/SemaCXX/new-delete.cpp
    cfe/trunk/test/SemaObjC/invalid-typename.m
    cfe/trunk/test/SemaObjC/property-9.m
    cfe/trunk/test/SemaObjC/protocol-archane.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sun Nov 23 17:17:07 2008
@@ -37,6 +37,11 @@
 DIAG(note_duplicate_case_prev, NOTE,
      "previous case defined here")
 
+/// note_matching - this is used as a continuation of a previous diagnostic,
+/// e.g. to specify the '(' when we expected a ')'.
+DIAG(note_matching, NOTE,
+     "to match this '%0'")
+
 
 //===----------------------------------------------------------------------===//
 // Lexer Diagnostics
@@ -409,13 +414,6 @@
 DIAG(err_unexpected_at, ERROR,
      "unexpected '@' in program")
 
-/// err_matching - this is used as a continuation of a previous error, e.g. to 
-/// specify the '(' when we expected a ')'.  This should probably be some
-/// special sort of diagnostic kind to indicate that it is the second half of
-/// the previous diagnostic.
-DIAG(err_matching, ERROR,
-     "to match this '%0'")
-
 /// Objective-C parser diagnostics
 DIAG(err_unexpected_interface, ERROR,
      "unexpected interface name '%0': expected expression")

Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Sun Nov 23 17:17:07 2008
@@ -137,7 +137,7 @@
     if (LParenLoc.isValid()) {
       if (PeekTok.isNot(tok::r_paren)) {
         PP.Diag(PeekTok.getLocation(), diag::err_pp_missing_rparen);
-        PP.Diag(LParenLoc, diag::err_matching) << "(";
+        PP.Diag(LParenLoc, diag::note_matching) << "(";
         return true;
       }
       // Consume the ).
@@ -261,7 +261,7 @@
       if (PeekTok.isNot(tok::r_paren)) {
         PP.Diag(PeekTok.getLocation(), diag::err_pp_expected_rparen)
           << Result.getRange();
-        PP.Diag(Start, diag::err_matching) << "(";
+        PP.Diag(Start, diag::note_matching) << "(";
         return true;
       }
       DT.State = DefinedTracker::Unknown;
@@ -606,7 +606,7 @@
       if (PeekTok.isNot(tok::colon)) {
         PP.Diag(PeekTok.getLocation(), diag::err_expected_colon)
           << LHS.getRange(), RHS.getRange();
-        PP.Diag(OpLoc, diag::err_matching) << "?";
+        PP.Diag(OpLoc, diag::note_matching) << "?";
         return true;
       }
       // Consume the :.

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sun Nov 23 17:17:07 2008
@@ -271,7 +271,7 @@
       
       if (Tok.isNot(tok::colon)) {
         Diag(Tok, diag::err_expected_colon);
-        Diag(OpToken, diag::err_matching) << "?";
+        Diag(OpToken, diag::note_matching) << "?";
         Actions.DeleteExpr(LHS.Val);
         Actions.DeleteExpr(TernaryMiddle.Val);
         return ExprResult(true);

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Nov 23 17:17:07 2008
@@ -199,7 +199,7 @@
   SourceLocation RAngleBracketLoc = Tok.getLocation();
 
   if (ExpectAndConsume(tok::greater, diag::err_expected_greater))
-    return Diag(LAngleBracketLoc, diag::err_matching) << "<";
+    return Diag(LAngleBracketLoc, diag::note_matching) << "<";
 
   SourceLocation LParenLoc = Tok.getLocation(), RParenLoc;
 

Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Sun Nov 23 17:17:07 2008
@@ -733,7 +733,7 @@
     ExitScope();
     if (!Body.isInvalid) {
       Diag(Tok, diag::err_expected_while);
-      Diag(DoLoc, diag::err_matching) << "do";
+      Diag(DoLoc, diag::note_matching) << "do";
       SkipUntil(tok::semi, false, true);
     }
     return true;

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Sun Nov 23 17:17:07 2008
@@ -71,7 +71,7 @@
   case tok::greater:  LHSName = "<"; DID = diag::err_expected_greater; break;
   }
   Diag(Tok, DID);
-  Diag(LHSLoc, diag::err_matching) << LHSName;
+  Diag(LHSLoc, diag::note_matching) << LHSName;
   SkipUntil(RHSTok);
   return R;
 }

Modified: cfe/trunk/test/Parser/recovery-1.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/recovery-1.c?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/Parser/recovery-1.c (original)
+++ cfe/trunk/test/Parser/recovery-1.c Sun Nov 23 17:17:07 2008
@@ -1,7 +1,7 @@
 // RUN: clang -fsyntax-only -fno-caret-diagnostics -pedantic %s 2>&1 | grep warning | wc -l | grep 1 &&
 // RUN: clang -fsyntax-only -verify -pedantic %s
 
-char ((((                       /* expected-error {{to match this '('}} */
+char ((((                       /* expected-note {{to match this '('}} */
 *X x ] ))));                    /* expected-error {{expected ')'}} */
 
 ;   // expected-warning {{ISO C does not allow an extra ';' outside of a function}}

Modified: cfe/trunk/test/Parser/typeof.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/typeof.c?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/Parser/typeof.c (original)
+++ cfe/trunk/test/Parser/typeof.c Sun Nov 23 17:17:07 2008
@@ -11,7 +11,7 @@
   typeof(TInt) anInt; 
   short TInt eee; // expected-error{{parse error}}
   void ary[7] fff; // expected-error{{array has incomplete element type 'void'}} expected-error{{parse error}}
-  typeof(void ary[7]) anIntError; // expected-error{{expected ')'}} expected-error{{to match this '('}}
+  typeof(void ary[7]) anIntError; // expected-error{{expected ')'}} expected-note {{to match this '('}}
   typeof(const int) aci; 
   const typeof (*pi) aConstInt; 
   int xx;

Modified: cfe/trunk/test/Sema/invalid-struct-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/invalid-struct-init.c?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/Sema/invalid-struct-init.c (original)
+++ cfe/trunk/test/Sema/invalid-struct-init.c Sun Nov 23 17:17:07 2008
@@ -15,7 +15,7 @@
 static int zm_startup_pcre(int type, int module_number ) { }
 
 static int zm_shutdown_pcre(int type, int module_number ) {
-  zend_function_entry pcre_functions[] = {{ }; // expected-error{{expected '}'}} expected-error{{to match this '{'}}
+  zend_function_entry pcre_functions[] = {{ }; // expected-error{{expected '}'}} expected-note {{to match this '{'}}
   zend_module_entry pcre_module_entry = {
     sizeof(zend_module_entry), 20071006, 0, 0, ((void *)0), ((void *)0),    
     "pcre",  pcre_functions,  zm_startup_pcre,  zm_shutdown_pcre,  ((void *)0),  

Modified: cfe/trunk/test/SemaCXX/nested-name-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nested-name-spec.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/nested-name-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/nested-name-spec.cpp Sun Nov 23 17:17:07 2008
@@ -72,4 +72,4 @@
 }
 
 // make sure the following doesn't hit any asserts
-void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} // expected-error {{expected ')'}} expected-error {{to match this '('}} // expected-error {{variable has incomplete type 'void'}}
+void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} // expected-error {{expected ')'}} expected-note {{to match this '('}} // expected-error {{variable has incomplete type 'void'}}

Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Sun Nov 23 17:17:07 2008
@@ -50,7 +50,7 @@
 {
   delete 0; // expected-error {{cannot delete expression of type 'int'}}
   delete [0] (int*)0; // expected-error {{expected ']'}} \
-                      // expected-error {{to match this '['}}
+                      // expected-note {{to match this '['}}
   delete (void*)0; // expected-error {{cannot delete expression}}
   delete (T*)0; // expected-warning {{deleting pointer to incomplete type}}
 }

Modified: cfe/trunk/test/SemaObjC/invalid-typename.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-typename.m?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-typename.m (original)
+++ cfe/trunk/test/SemaObjC/invalid-typename.m Sun Nov 23 17:17:07 2008
@@ -7,6 +7,6 @@
                    canBeginSyncingPlanWithId:(bycopy NSString *)planId
                    syncModes:(bycopy NSArray /* ISDSyncState */ *)syncModes
                    entities:(bycopy NSArray /* ISDEntity */ *)entities
-                   truthPullers:(bycopy NSDictionary /* NSString -> [NSString] */ *)truthPullers; // expected-error{{expected ')'}} expected-error{{to match this '('}}
+                   truthPullers:(bycopy NSDictionary /* NSString -> [NSString] */ *)truthPullers; // expected-error{{expected ')'}} expected-note {{to match this '('}}
 @end
 

Modified: cfe/trunk/test/SemaObjC/property-9.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-9.m?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/property-9.m (original)
+++ cfe/trunk/test/SemaObjC/property-9.m Sun Nov 23 17:17:07 2008
@@ -50,14 +50,16 @@
 
 
 // test parser recovery: rdar://6254579
- at property (readonly getter=isAwesome) // expected-error {{error: expected ')'}}  \
-                                      // expected-error {{to match this '('}}
+ at property (                           // expected-note {{to match this '('}}
+           readonly getter=isAwesome) // expected-error {{error: expected ')'}}
+           
   int _awesome;
 @property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}}
   int _awesome2;
 
- at property (+)  // expected-error {{error: expected ')'}}  \
-               // expected-error {{to match this '('}}
+ at property (    // expected-note {{to match this '('}}
+           +)  // expected-error {{error: expected ')'}}
+           
   int _awesome3;
 
 @end

Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=59921&r1=59920&r2=59921&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-archane.m Sun Nov 23 17:17:07 2008
@@ -6,7 +6,7 @@
 @end
 
 void foo(id x) {
-  bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-error {{to match this '('}}
+  bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}}
   bar((<SomeProtocol>)x);      // expected-warning {{protocol qualifiers without 'id' is archaic}}
 
   [(<SomeProtocol>)x bar];      // expected-warning {{protocol qualifiers without 'id' is archaic}}





More information about the cfe-commits mailing list