diff options
author | Tom Care <tcare@apple.com> | 2010-06-17 22:55:40 +0000 |
---|---|---|
committer | Tom Care <tcare@apple.com> | 2010-06-17 22:55:40 +0000 |
commit | 9eee328dacf877ca6d970b1600deb7b5e3f52967 (patch) | |
tree | fd89b0f21d5edd0878ad44e14e5e8db46b69c049 /clang | |
parent | 0125b6410afbd92f828edd030f7691a2cfee4adc (diff) | |
download | bcm5719-llvm-9eee328dacf877ca6d970b1600deb7b5e3f52967.tar.gz bcm5719-llvm-9eee328dacf877ca6d970b1600deb7b5e3f52967.zip |
Bug 7394 - Fixed toString representation of Precisions in format strings.
M include/clang/Analysis/Analyses/PrintfFormatString.h
M lib/Analysis/PrintfFormatString.cpp
llvm-svn: 106245
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Analysis/Analyses/PrintfFormatString.h | 9 | ||||
-rw-r--r-- | clang/lib/Analysis/PrintfFormatString.cpp | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/include/clang/Analysis/Analyses/PrintfFormatString.h b/clang/include/clang/Analysis/Analyses/PrintfFormatString.h index 280c5baa6f6..79500bb1169 100644 --- a/clang/include/clang/Analysis/Analyses/PrintfFormatString.h +++ b/clang/include/clang/Analysis/Analyses/PrintfFormatString.h @@ -192,11 +192,11 @@ public: unsigned amountLength, bool usesPositionalArg) : start(amountStart), length(amountLength), hs(howSpecified), amt(amount), - UsesPositionalArg(usesPositionalArg) {} + UsesPositionalArg(usesPositionalArg), UsesDotPrefix(0) {} OptionalAmount(bool valid = true) : start(0),length(0), hs(valid ? NotSpecified : Invalid), amt(0), - UsesPositionalArg(0) {} + UsesPositionalArg(0), UsesDotPrefix(0) {} bool isInvalid() const { return hs == Invalid; @@ -236,12 +236,16 @@ public: return amt + 1; } + bool usesDotPrefix() const { return UsesDotPrefix; } + void setUsesDotPrefix() { UsesDotPrefix = true; } + private: const char *start; unsigned length; HowSpecified hs; unsigned amt; bool UsesPositionalArg : 1; + bool UsesDotPrefix; }; // Class representing optional flags with location and representation @@ -362,6 +366,7 @@ public: void setPrecision(const OptionalAmount &Amt) { Precision = Amt; + Precision.setUsesDotPrefix(); } const OptionalAmount &getPrecision() const { diff --git a/clang/lib/Analysis/PrintfFormatString.cpp b/clang/lib/Analysis/PrintfFormatString.cpp index ba32e749a85..951be17e2f1 100644 --- a/clang/lib/Analysis/PrintfFormatString.cpp +++ b/clang/lib/Analysis/PrintfFormatString.cpp @@ -611,6 +611,9 @@ const char *LengthModifier::toString() const { //===----------------------------------------------------------------------===// void OptionalAmount::toString(llvm::raw_ostream &os) const { + if (UsesDotPrefix) + os << "."; + switch (hs) { case Invalid: case NotSpecified: |