[cfe-commits] r93192 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp

Douglas Gregor dgregor at apple.com
Mon Jan 11 14:04:55 PST 2010


Author: dgregor
Date: Mon Jan 11 16:04:54 2010
New Revision: 93192

URL: http://llvm.org/viewvc/llvm-project?rev=93192&view=rev
Log:
Use isa<ElaboratedType> rather than getAs<ElaboratedType>, since the
latter may (eventually) perform multiple levels of desugaring (thus
breaking the newly-added tests) and the former is faster. Thanks, John!

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=93192&r1=93191&r2=93192&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Jan 11 16:04:54 2010
@@ -832,7 +832,7 @@
     //   };
     //
     // since that was the intent of DR56.
-    if (New->getUnderlyingType()->getAs<ElaboratedType>())
+    if (isa<ElaboratedType>(New->getUnderlyingType()))
       return;
 
     Diag(New->getLocation(), diag::err_redefinition)

Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp?rev=93192&r1=93191&r2=93192&view=diff

==============================================================================
--- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp (original)
+++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp Mon Jan 11 16:04:54 2010
@@ -2,7 +2,11 @@
 
 struct S {
   typedef struct A {} A; // expected-note {{previous definition is here}}
-  typedef struct B B;
+  typedef struct B {} B;
   typedef A A; // expected-error {{redefinition of 'A'}}
+
+  struct C { }; // expected-note{{previous definition is here}}
+  typedef struct C OtherC;
+  typedef OtherC C; // expected-error{{redefinition of 'C'}}
 };
 





More information about the cfe-commits mailing list