]> granicus.if.org Git - clang/commitdiff
Added "DisplayHint" to PathDiagnosticPiece to provide a hint for the
authorTed Kremenek <kremenek@apple.com>
Tue, 6 May 2008 21:33:07 +0000 (21:33 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 6 May 2008 21:33:07 +0000 (21:33 +0000)
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

include/clang/Analysis/PathDiagnostic.h

index 77234e7c4ac67f641fdb937e5f990e68c6087f30..89ca18c61eadedb66d9f137687b91386884bdaa8 100644 (file)
 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;