diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-06-20 23:13:39 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-06-20 23:13:39 +0000 |
| commit | c9cea053bab019c3e67979afbc8e10d96f22d36b (patch) | |
| tree | ea83b789358669fa77c1634157078e608fb57bf8 /clang/lib | |
| parent | 4c32155a0f99bec9de3d39e7d2468ad8e93248d1 (diff) | |
| download | bcm5719-llvm-c9cea053bab019c3e67979afbc8e10d96f22d36b.tar.gz bcm5719-llvm-c9cea053bab019c3e67979afbc8e10d96f22d36b.zip | |
When using the dead-stores checker with the BugReporter class, properly capture the diagnostic associated with a specific warning and emit it.
llvm-svn: 52565
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Analysis/DeadStores.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Analysis/DeadStores.cpp b/clang/lib/Analysis/DeadStores.cpp index 7d912b046eb..208e66f3e96 100644 --- a/clang/lib/Analysis/DeadStores.cpp +++ b/clang/lib/Analysis/DeadStores.cpp @@ -164,13 +164,18 @@ namespace { class VISIBILITY_HIDDEN DiagBugReport : public RangedBugReport { std::list<std::string> Strs; FullSourceLoc L; + const char* description; public: - DiagBugReport(BugType& D, FullSourceLoc l) : - RangedBugReport(D, NULL), L(l) {} + DiagBugReport(const char* desc, BugType& D, FullSourceLoc l) : + RangedBugReport(D, NULL), L(l), description(desc) {} virtual ~DiagBugReport() {} virtual FullSourceLoc getLocation(SourceManager&) { return L; } + virtual const char* getDescription() const { + return description; + } + void addString(const std::string& s) { Strs.push_back(s); } typedef std::list<std::string>::const_iterator str_iterator; @@ -198,7 +203,7 @@ public: // FIXME: Use a map from diag::kind to BugType, instead of having just // one BugType. - Reports.push_back(DiagBugReport(D, Pos)); + Reports.push_back(DiagBugReport(Diags.getDescription(ID), D, Pos)); DiagBugReport& R = Reports.back(); for ( ; NumRanges ; --NumRanges, ++Ranges) |

