summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-02-02 00:16:13 +0000
committerTed Kremenek <kremenek@apple.com>2012-02-02 00:16:13 +0000
commit7f4bd16b53ab3904f270f610be421a74078bd6da (patch)
tree44b34aaba39656f25da69bfa3202260a0bfb9f25 /clang/lib/Lex/PPDirectives.cpp
parentccded6e44731dec951bbceda655dcae88380191b (diff)
downloadbcm5719-llvm-7f4bd16b53ab3904f270f610be421a74078bd6da.tar.gz
bcm5719-llvm-7f4bd16b53ab3904f270f610be421a74078bd6da.zip
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 76955604b08..9f2309e801d 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud