diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-07-19 22:01:06 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-07-19 22:01:06 +0000 |
commit | baa400654bd6f8396f9a07188445ae7955b060a3 (patch) | |
tree | 03ee1509fbb2d3ceb336f9c4c37b01e401ce3ccb /include/clang/Analysis/Analyses/FormatString.h | |
parent | abc563f554951259bbe0315055cad92ee14d87e4 (diff) |
Don't warn when a '%%' or '%*d' (scanf) is used in a format string with positional arguments, since
these don't actually consume an argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/Analyses/FormatString.h')
-rw-r--r-- | include/clang/Analysis/Analyses/FormatString.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h index f79300df9f..d76e4f7ad0 100644 --- a/include/clang/Analysis/Analyses/FormatString.h +++ b/include/clang/Analysis/Analyses/FormatString.h @@ -220,17 +220,14 @@ public: void setUsesPositionalArg() { UsesPositionalArg = true; } void setArgIndex(unsigned i) { - // assert(CS.consumesDataArgument()); argIndex = i; } unsigned getArgIndex() const { - //assert(CS.consumesDataArgument()); return argIndex; } unsigned getPositionalArgIndex() const { - //assert(CS.consumesDataArgument()); return argIndex + 1; } @@ -402,12 +399,16 @@ public: const OptionalAmount &getPrecision() const { return Precision; } + + bool consumesDataArgument() const { + return CS.consumesDataArgument(); + } - /// \brief Returns the builtin type that a data argument - /// paired with this format specifier should have. This method - /// will return null if the format specifier does not have - /// a matching data argument or the matching argument matches - /// more than one type. + /// \brief Returns the builtin type that a data argument + /// paired with this format specifier should have. This method + /// will return null if the format specifier does not have + /// a matching data argument or the matching argument matches + /// more than one type. ArgTypeResult getArgType(ASTContext &Ctx) const; const OptionalFlag &isLeftJustified() const { return IsLeftJustified; } |