diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-02-02 00:16:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-02-02 00:16:13 +0000 |
commit | 34a2c42ba8cc58a404238a3c1cbc4a7442e57832 (patch) | |
tree | c9ed684ccda1741fcd6a3b7b594612e074cc5d4d /lib | |
parent | f83a615ad0004fc4cca3e3c1ea2234a685487304 (diff) |
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index 76955604b0..9f2309e801 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -1007,10 +1007,18 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok, // collapse multiple consequtive white space between tokens, but this isn't // specified by the standard. std::string Message = CurLexer->ReadToEndOfLine(); + + // Find the first non-whitespace character, so that we can make the + // diagnostic more succinct. + StringRef Msg(Message); + size_t i = Msg.find_first_not_of(' '); + if (i < Msg.size()) + Msg = Msg.substr(i); + if (isWarning) - Diag(Tok, diag::pp_hash_warning) << Message; + Diag(Tok, diag::pp_hash_warning) << Msg; else - Diag(Tok, diag::err_pp_hash_error) << Message; + Diag(Tok, diag::err_pp_hash_error) << Msg; } /// HandleIdentSCCSDirective - Handle a #ident/#sccs directive. |