diff options
author | Hans Wennborg <hans@hanshq.net> | 2012-02-15 09:59:46 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2012-02-15 09:59:46 +0000 |
commit | be6126a2a784e1446460b8d15c2b26f880c871fc (patch) | |
tree | dcd82b29009df602ff45a73ab58053e9e883d25a /include/clang/Analysis/Analyses/FormatString.h | |
parent | 37ce0104b182c9410cf2a76fe5a63a81dac876ac (diff) |
Make -Wformat fix-its preserve original conversion specifiers.
This commit makes PrintfSpecifier::fixType() and ScanfSpecifier::fixType()
only fix a conversion specification enough that Clang wouldn't warn about it,
as opposed to always changing it to use the "canonical" conversion specifier.
(PR11975)
This preserves the user's choice of conversion specifier in cases like:
printf("%a", (long double)1);
where we previously suggested "%Lf", we now suggest "%La"
printf("%x", (long)1);
where we previously suggested "%ld", we now suggest "%lx".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/Analyses/FormatString.h')
-rw-r--r-- | include/clang/Analysis/Analyses/FormatString.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/clang/Analysis/Analyses/FormatString.h b/include/clang/Analysis/Analyses/FormatString.h index 49221bbc9b..f3fe32474c 100644 --- a/include/clang/Analysis/Analyses/FormatString.h +++ b/include/clang/Analysis/Analyses/FormatString.h @@ -467,10 +467,11 @@ public: const OptionalFlag &hasSpacePrefix() const { return HasSpacePrefix; } bool usesPositionalArg() const { return UsesPositionalArg; } - /// Changes the specifier and length according to a QualType, retaining any - /// flags or options. Returns true on success, or false when a conversion - /// was not successful. - bool fixType(QualType QT, const LangOptions &LangOpt); + /// Changes the specifier and length according to a QualType, retaining any + /// flags or options. Returns true on success, or false when a conversion + /// was not successful. + bool fixType(QualType QT, const LangOptions &LangOpt, ASTContext &Ctx, + bool IsObjCLiteral); void toString(raw_ostream &os) const; @@ -567,7 +568,7 @@ public: ScanfArgTypeResult getArgType(ASTContext &Ctx) const; - bool fixType(QualType QT, const LangOptions &LangOpt); + bool fixType(QualType QT, const LangOptions &LangOpt, ASTContext &Ctx); void toString(raw_ostream &os) const; |