[cfe-commits] r50773 - /cfe/trunk/include/clang/Analysis/PathDiagnostic.h

Ted Kremenek kremenek at apple.com
Tue May 6 14:33:08 PDT 2008


Author: kremenek
Date: Tue May  6 16:33:07 2008
New Revision: 50773

URL: http://llvm.org/viewvc/llvm-project?rev=50773&view=rev
Log:
Added "DisplayHint" to PathDiagnosticPiece to provide a hint for the
PathDiagnosticClient of where to display a string (beyond just the SourceLocation).

Modified:
    cfe/trunk/include/clang/Analysis/PathDiagnostic.h

Modified: cfe/trunk/include/clang/Analysis/PathDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathDiagnostic.h?rev=50773&r1=50772&r2=50773&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathDiagnostic.h (original)
+++ cfe/trunk/include/clang/Analysis/PathDiagnostic.h Tue May  6 16:33:07 2008
@@ -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) {}
+public:
   
-  PathDiagnosticPiece(FullSourceLoc pos, const char* 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,
+                      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 @@
   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 @@
   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;





More information about the cfe-commits mailing list