aboutsummaryrefslogtreecommitdiff
path: root/include/clang
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
commit466265cd04df98428967adfade577bed7636d910 (patch)
tree83e14d87f2eb4e57a2350f7550241ed7cf917485 /include/clang
parentc839560d1b3eda7e4674dd7f139217ce0b600dc4 (diff)
Added "DisplayHint" to PathDiagnosticPiece to provide a hint for the
PathDiagnosticClient of where to display a string (beyond just the SourceLocation). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Analysis/PathDiagnostic.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/include/clang/Analysis/PathDiagnostic.h b/include/clang/Analysis/PathDiagnostic.h
index 77234e7c4a..89ca18c61e 100644
--- a/include/clang/Analysis/PathDiagnostic.h
+++ b/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;