Put back a microoptimization with a comment to make it more obvious.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188063 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index ed4a034..99a1f77 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -716,13 +716,16 @@
// 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