- SMDiagnostic() : LineNo(0), ColumnNo(0) {}
- SMDiagnostic(const std::string &FN, int Line, int Col,
- const std::string &Msg, const std::string &LineStr)
- : Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg),
- LineContents(LineStr) {}
+ // Null diagnostic.
+ SMDiagnostic() : SM(0), LineNo(0), ColumnNo(0), ShowLine(0) {}
+ // Diagnostic with no location (e.g. file not found, command line arg error).
+ SMDiagnostic(const std::string &filename, const std::string &Msg,
+ bool showline = true)
+ : SM(0), Loc(), Filename(filename), LineNo(-1), ColumnNo(-1),
+ Message(Msg), LineContents(""), ShowLine(showline) {}
+
+ // Diagnostic with a location.
+ SMDiagnostic(const SourceMgr &sm, SMLoc L, const std::string &FN,
+ int Line, int Col,
+ const std::string &Msg, const std::string &LineStr,
+ bool showline = true)
+ : SM(&sm), Loc(L), Filename(FN), LineNo(Line), ColumnNo(Col), Message(Msg),
+ LineContents(LineStr), ShowLine(showline) {}