diff options
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index ed4a0346752..99a1f77390f 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -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 |