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

Manuel Klimek klimek at google.com
Wed Dec 12 05:26:54 PST 2012


Author: klimek
Date: Wed Dec 12 07:26:54 2012
New Revision: 169976

URL: http://llvm.org/viewvc/llvm-project?rev=169976&view=rev
Log:
Speeds up parsing of global declarations in cases where the warning
is switched of by about 0.8% (tested with int i<N>).

Additionally, this puts computing the diagnostic class into the hot
path more when parsing, in preparation for upcoming optimizations
in this area.

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=169976&r1=169975&r2=169976&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Dec 12 07:26:54 2012
@@ -7233,7 +7233,10 @@
   }
 
   if (var->isThisDeclarationADefinition() &&
-      var->getLinkage() == ExternalLinkage) {
+      var->getLinkage() == ExternalLinkage &&
+      getDiagnostics().getDiagnosticLevel(
+                       diag::warn_missing_variable_declarations,
+                       var->getLocation())) {
     // Find a previous declaration that's not a definition.
     VarDecl *prev = var->getPreviousDecl();
     while (prev && prev->isThisDeclarationADefinition())





More information about the cfe-commits mailing list