[cfe-commits] r95188 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Tue Feb 2 18:08:48 PST 2010


Author: cornedbee
Date: Tue Feb  2 20:08:48 2010
New Revision: 95188

URL: http://llvm.org/viewvc/llvm-project?rev=95188&view=rev
Log:
Don't do an expensive definition check where a cheap 'is this C?' check suffices.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Feb  2 20:08:48 2010
@@ -1300,7 +1300,8 @@
 
   // C++ doesn't have tentative definitions, so go right ahead and check here.
   const VarDecl *Def;
-  if (New->isThisDeclarationADefinition() == VarDecl::Definition &&
+  if (getLangOptions().CPlusPlus &&
+      New->isThisDeclarationADefinition() == VarDecl::Definition &&
       (Def = Old->getDefinition())) {
     Diag(New->getLocation(), diag::err_redefinition)
       << New->getDeclName();





More information about the cfe-commits mailing list