r188063 - Put back a microoptimization with a comment to make it more obvious.

Benjamin Kramer benny.kra at googlemail.com
Fri Aug 9 02:39:17 PDT 2013


Author: d0k
Date: Fri Aug  9 04:39:17 2013
New Revision: 188063

URL: http://llvm.org/viewvc/llvm-project?rev=188063&view=rev
Log:
Put back a microoptimization with a comment to make it more obvious.

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

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=188063&r1=188062&r2=188063&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Aug  9 04:39:17 2013
@@ -716,13 +716,16 @@ void Sema::checkCall(NamedDecl *FDecl,
   // Printf and scanf checking.
   llvm::SmallBitVector CheckedVarArgs;
   if (FDecl) {
-    CheckedVarArgs.resize(Args.size());
     for (specific_attr_iterator<FormatAttr>
              I = FDecl->specific_attr_begin<FormatAttr>(),
              E = FDecl->specific_attr_end<FormatAttr>();
-         I != E; ++I)
+         I != E; ++I) {
+      // Only create vector if there are format attributes.
+      CheckedVarArgs.resize(Args.size());
+
       CheckFormatArguments(*I, Args, IsMemberFunction, CallType, Loc, Range,
                            CheckedVarArgs);
+    }
   }
 
   // Refuse POD arguments that weren't caught by the format string





More information about the cfe-commits mailing list