summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-05-06 21:33:07 +0000
committerTed Kremenek <kremenek@apple.com>2008-05-06 21:33:07 +0000
commitaa63ca92727582e635c7b6a484e828c714fc08fb (patch)
treee459d0a4cdadfe63eff9719ac9020ab2a9be9944
parent767d0742c71d871fe184e08c36a3c68879e1e9c4 (diff)
downloadbcm5719-llvm-aa63ca92727582e635c7b6a484e828c714fc08fb.tar.gz
bcm5719-llvm-aa63ca92727582e635c7b6a484e828c714fc08fb.zip
Added "DisplayHint" to PathDiagnosticPiece to provide a hint for the
PathDiagnosticClient of where to display a string (beyond just the SourceLocation). llvm-svn: 50773
-rw-r--r--clang/include/clang/Analysis/PathDiagnostic.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/include/clang/Analysis/PathDiagnostic.h b/clang/include/clang/Analysis/PathDiagnostic.h
index 77234e7c4ac..89ca18c61ea 100644
--- a/clang/include/clang/Analysis/PathDiagnostic.h
+++ b/clang/include/clang/Analysis/PathDiagnostic.h
@@ -25,19 +25,29 @@
namespace clang {
class PathDiagnosticPiece {
+public:
+ enum DisplayHint { Above, Below };
+
+private:
FullSourceLoc Pos;
std::string str;
+ DisplayHint Hint;
std::vector<SourceRange> ranges;
+
public:
- PathDiagnosticPiece(FullSourceLoc pos, const std::string& s)
- : Pos(pos), str(s) {}
+ PathDiagnosticPiece(FullSourceLoc pos, const std::string& s,
+ DisplayHint hint = Above)
+ : Pos(pos), str(s), Hint(hint) {}
- PathDiagnosticPiece(FullSourceLoc pos, const char* s)
- : Pos(pos), str(s) {}
+ PathDiagnosticPiece(FullSourceLoc pos, const char* s,
+ DisplayHint hint = Above)
+ : Pos(pos), str(s), Hint(hint) {}
const std::string& getString() const { return str; }
-
+
+ DisplayHint getDisplayHint() const { return Hint; }
+
void addRange(SourceRange R) {
ranges.push_back(R);
}
@@ -66,10 +76,12 @@ class PathDiagnostic {
unsigned Size;
std::string Desc;
std::vector<std::string> OtherDesc;
-public:
-
+
+public:
PathDiagnostic() : Size(0) {}
+
PathDiagnostic(const char* desc) : Size(0), Desc(desc) {}
+
PathDiagnostic(const std::string& desc) : Size(0), Desc(desc) {}
~PathDiagnostic();
@@ -82,7 +94,6 @@ public:
void addMeta(const std::string& s) { OtherDesc.push_back(s); }
void addMeta(const char* s) { OtherDesc.push_back(s); }
-
void push_front(PathDiagnosticPiece* piece) {
path.push_front(piece);
++Size;
OpenPOWER on IntegriCloud