From: Ted Kremenek Date: Tue, 6 May 2008 21:33:07 +0000 (+0000) Subject: Added "DisplayHint" to PathDiagnosticPiece to provide a hint for the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=466265cd04df98428967adfade577bed7636d910;p=clang 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 --- 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 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 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;