]> granicus.if.org Git - clang/commitdiff
Fix some redundant errors by changing CXXScopeSpec::isSet calls into
authorJeffrey Yasskin <jyasskin@google.com>
Wed, 7 Apr 2010 23:29:58 +0000 (23:29 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Wed, 7 Apr 2010 23:29:58 +0000 (23:29 +0000)
isNotEmpty calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100722 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c85b6ee9746cd24b96870a6ced244902171a89ae..73a5704878e07e570588175af668dce7f1e5ea77 100644 (file)
@@ -2427,7 +2427,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D,
     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;
index 489586c36f549689685f94d883a76f274f910350..5c31c1d9a3de9ebb79bad04935a8e88a3ed5504a 100644 (file)
@@ -1046,7 +1046,7 @@ bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) {
   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
index 3556057173d5ca1484a047145008f06353d6a876..590a014c92a0ac7f41fb3171fe3726add721210b 100644 (file)
@@ -70,7 +70,7 @@ Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
     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) {
index cbd12d43809bbb864d6e8df50a5a14b76de960ae..435864002970a45527827ac116dcce6a73ace327 100644 (file)
@@ -1253,8 +1253,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S,
       }
       // 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();
index 9a611c38ad6dad764643a5c5c8074bba51dc7773..c6b11cfefe5459d7981ee5d8cbe3a1c7a10fe18d 100644 (file)
@@ -13,9 +13,9 @@ namespace A {
 }
 
 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; }
 
index cb0a39a9d0cf7ef16b2ec3fe79f59c9dd39dbe39..417cdc1f1987b6a7ab3ad171e6092281bc61dcdb 100644 (file)
@@ -16,7 +16,7 @@ namespace PR6161 {
               // 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}}