[cfe-commits] r100722 - in /cfe/trunk: lib/Parse/ParseDecl.cpp lib/Parse/Parser.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaType.cpp test/SemaCXX/nested-name-spec.cpp test/SemaTemplate/explicit-specialization-member.cpp

Jeffrey Yasskin jyasskin at google.com
Wed Apr 7 16:29:58 PDT 2010


Author: jyasskin
Date: Wed Apr  7 18:29:58 2010
New Revision: 100722

URL: http://llvm.org/viewvc/llvm-project?rev=100722&view=rev
Log:
Fix some redundant errors by changing CXXScopeSpec::isSet calls into
isNotEmpty calls.


Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/lib/Parse/Parser.cpp
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaCXX/nested-name-spec.cpp
    cfe/trunk/test/SemaTemplate/explicit-specialization-member.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Apr  7 18:29:58 2010
@@ -2427,7 +2427,7 @@
     CXXScopeSpec SS;
     ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, true); // ignore fail
 
-    if (SS.isSet()) {
+    if (SS.isNotEmpty()) {
       if (Tok.isNot(tok::star)) {
         // The scope spec really belongs to the direct-declarator.
         D.getCXXScopeSpec() = SS;

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Wed Apr  7 18:29:58 2010
@@ -1046,7 +1046,7 @@
   CXXScopeSpec SS;
   if (ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, EnteringContext))
     return true;
-  if (!SS.isSet())
+  if (SS.isEmpty())
     return false;
 
   // Push the current token back into the token stream (or revert it if it is

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Apr  7 18:29:58 2010
@@ -70,7 +70,7 @@
     QualType ObjectType = QualType::getFromOpaquePtr(ObjectTypePtr);
     if (ObjectType->isRecordType())
       LookupCtx = computeDeclContext(ObjectType);
-  } else if (SS && SS->isSet()) {
+  } else if (SS && SS->isNotEmpty()) {
     LookupCtx = computeDeclContext(*SS, false);
 
     if (!LookupCtx) {

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Apr  7 18:29:58 2010
@@ -1253,8 +1253,11 @@
       }
       // The scope spec must refer to a class, or be dependent.
       QualType ClsType;
-      if (isDependentScopeSpecifier(DeclType.Mem.Scope())
-            || dyn_cast_or_null<CXXRecordDecl>(
+      if (DeclType.Mem.Scope().isInvalid()) {
+        // Avoid emitting extra errors if we already errored on the scope.
+        D.setInvalidType(true);
+      } else if (isDependentScopeSpecifier(DeclType.Mem.Scope())
+                 || dyn_cast_or_null<CXXRecordDecl>(
                                    computeDeclContext(DeclType.Mem.Scope()))) {
         NestedNameSpecifier *NNS
           = (NestedNameSpecifier *)DeclType.Mem.Scope().getScopeRep();

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=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nested-name-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/nested-name-spec.cpp Wed Apr  7 18:29:58 2010
@@ -13,9 +13,9 @@
 }
 
 A:: ; // expected-error {{expected unqualified-id}}
-// FIXME: redundant errors
-::A::ax::undef ex3; // expected-error {{no member named}} expected-error {{unknown type name}}
-A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}} expected-error {{unknown type name}}
+// FIXME: there is a member 'ax'; it's just not a class.
+::A::ax::undef ex3; // expected-error {{no member named 'ax'}}
+A::undef1::undef2 ex4; // expected-error {{no member named 'undef1'}}
 
 int A::C::Ag1() { return 0; }
 

Modified: cfe/trunk/test/SemaTemplate/explicit-specialization-member.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/explicit-specialization-member.cpp?rev=100722&r1=100721&r2=100722&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/explicit-specialization-member.cpp (original)
+++ cfe/trunk/test/SemaTemplate/explicit-specialization-member.cpp Wed Apr  7 18:29:58 2010
@@ -16,7 +16,7 @@
               // expected-error{{expected class name}} \
   // expected-note{{attempt to specialize declaration here}}
   {
-    static locale::id id; // expected-error{{use of undeclared identifier}} FIXME: expected-error {{unknown type name}}
+    static locale::id id; // expected-error{{use of undeclared identifier}}
   };
   numpunct<char>::~numpunct(); // expected-error{{template specialization requires 'template<>'}} \
   // expected-error{{specialization of member 'PR6161::numpunct<char>::~numpunct' does not specialize an instantiated member}}





More information about the cfe-commits mailing list