summaryrefslogtreecommitdiff
path: root/include/llvm/Support/SourceMgr.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-22 22:08:00 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-22 22:08:00 +0000
commit4153982375811da8ffe8d8cc45e09d44c6f40642 (patch)
tree4fe034988f827785406b757612d159ac1ae23e99 /include/llvm/Support/SourceMgr.h
parent964ac012017451ff24c33e6b749ec3223e1d291a (diff)
downloadllvm-4153982375811da8ffe8d8cc45e09d44c6f40642.tar.gz
llvm-4153982375811da8ffe8d8cc45e09d44c6f40642.tar.bz2
llvm-4153982375811da8ffe8d8cc45e09d44c6f40642.tar.xz
SourceMgr: Add ShowLine argument to PrintMessage, to allow suppressing the source line output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/SourceMgr.h')
-rw-r--r--include/llvm/Support/SourceMgr.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h
index 5b6f56b436..b695ff10fd 100644
--- a/include/llvm/Support/SourceMgr.h
+++ b/include/llvm/Support/SourceMgr.h
@@ -120,7 +120,9 @@ public:
///
/// @param Type - If non-null, the kind of message (e.g., "error") which is
/// prefixed to the message.
- void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type) const;
+ /// @param ShowLine - Should the diagnostic show the source line.
+ void PrintMessage(SMLoc Loc, const std::string &Msg, const char *Type,
+ bool ShowLine = true) const;
/// GetMessage - Return an SMDiagnostic at the specified location with the
@@ -128,8 +130,10 @@ public:
///
/// @param Type - If non-null, the kind of message (e.g., "error") which is
/// prefixed to the message.
+ /// @param ShowLine - Should the diagnostic show the source line.
SMDiagnostic GetMessage(SMLoc Loc,
- const std::string &Msg, const char *Type) const;
+ const std::string &Msg, const char *Type,
+ bool ShowLine = true) const;
private:
@@ -143,12 +147,15 @@ class SMDiagnostic {
std::string Filename;
int LineNo, ColumnNo;
std::string Message, LineContents;
+ unsigned ShowLine : 1;
+
public:
SMDiagnostic() : LineNo(0), ColumnNo(0) {}
SMDiagnostic(const std::string &FN, int Line, int Col,
- const std::string &Msg, const std::string &LineStr)
+ const std::string &Msg, const std::string &LineStr,
+ bool showline = true)
: Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg),
- LineContents(LineStr) {}
+ LineContents(LineStr), ShowLine(showline) {}
void Print(const char *ProgName, raw_ostream &S);
};