diff options
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 3 | ||||
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 16 | ||||
-rw-r--r-- | lib/Lex/PPExpressions.cpp | 2 | ||||
-rw-r--r-- | lib/Lex/Pragma.cpp | 10 |
4 files changed, 16 insertions, 15 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 76073fe99a..e23713d878 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -405,9 +405,6 @@ public: void Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R); void Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R1, const SourceRange &R2); - void Diag(const Token &Tok, unsigned DiagID, const std::string &Msg) { - Diag(Tok.getLocation(), DiagID, Msg); - } /// getSpelling() - Return the 'spelling' of the Tok token. The spelling of a /// token is the characters used to represent the token in the source file diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index f67b1b2012..a8dcc53589 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -59,7 +59,7 @@ void Preprocessor::ReadMacroName(Token &MacroNameTok, char isDefineUndef) { if (isCXXNamedOperator(Spelling)) // C++ 2.5p2: Alternative tokens behave the same as its primary token // except for their spellings. - Diag(MacroNameTok, diag::err_pp_operator_used_as_macro_name, Spelling); + Diag(MacroNameTok, diag::err_pp_operator_used_as_macro_name) << Spelling; else Diag(MacroNameTok, diag::err_pp_macro_not_identifier); // Fall through on error. @@ -98,7 +98,7 @@ void Preprocessor::CheckEndOfDirective(const char *DirType) { LexUnexpandedToken(Tmp); if (Tmp.isNot(tok::eom)) { - Diag(Tmp, diag::ext_pp_extra_tokens_at_eol, DirType); + Diag(Tmp, diag::ext_pp_extra_tokens_at_eol) << DirType; DiscardUntilEndOfDirective(); } } @@ -476,7 +476,7 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok, std::string Message = CurLexer->ReadToEndOfLine(); unsigned DiagID = isWarning ? diag::pp_hash_warning : diag::err_pp_hash_error; - return Diag(Tok, DiagID, Message); + Diag(Tok, DiagID) << Message; } /// HandleIdentSCCSDirective - Handle a #ident/#sccs directive. @@ -692,9 +692,11 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok, // Look up the file, create a File ID for it. unsigned FileID = SourceMgr.createFileID(File, FilenameTok.getLocation(), FileCharacter); - if (FileID == 0) - return Diag(FilenameTok, diag::err_pp_file_not_found, - std::string(FilenameStart, FilenameEnd)); + if (FileID == 0) { + Diag(FilenameTok, diag::err_pp_file_not_found) + << std::string(FilenameStart, FilenameEnd); + return; + } // Finally, if all is good, enter the new file! EnterSourceFile(FileID, CurDir); @@ -786,7 +788,7 @@ bool Preprocessor::ReadMacroDefinitionArgList(MacroInfo *MI) { // #define X(A,A. if (std::find(Arguments.begin(), Arguments.end(), II) != Arguments.end()) { // C99 6.10.3p6 - Diag(Tok, diag::err_pp_duplicate_name_in_arg_list, II->getName()); + Diag(Tok, diag::err_pp_duplicate_name_in_arg_list) << II->getName(); return true; } diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp index 4042604391..b3ae9d9860 100644 --- a/lib/Lex/PPExpressions.cpp +++ b/lib/Lex/PPExpressions.cpp @@ -91,7 +91,7 @@ static bool EvaluateValue(PPValue &Result, Token &PeekTok, DefinedTracker &DT, // into a simple 0, unless it is the C++ keyword "true", in which case it // turns into "1". if (II->getPPKeywordID() != tok::pp_defined) { - PP.Diag(PeekTok, diag::warn_pp_undef_identifier, II->getName()); + PP.Diag(PeekTok, diag::warn_pp_undef_identifier) << II->getName(); Result.Val = II->getTokenID() == tok::kw_true; Result.Val.setIsUnsigned(false); // "0" is signed intmax_t 0. Result.setRange(PeekTok.getLocation()); diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index dd5f144e34..d4c5c6b835 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -287,9 +287,11 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) { const DirectoryLookup *CurDir; const FileEntry *File = LookupFile(FilenameStart, FilenameEnd, isAngled, 0, CurDir); - if (File == 0) - return Diag(FilenameTok, diag::err_pp_file_not_found, - std::string(FilenameStart, FilenameEnd)); + if (File == 0) { + Diag(FilenameTok, diag::err_pp_file_not_found) + << std::string(FilenameStart, FilenameEnd); + return; + } SourceLocation FileLoc = getCurrentFileLexer()->getFileLoc(); const FileEntry *CurFile = SourceMgr.getFileEntryForLoc(FileLoc); @@ -305,7 +307,7 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) { } Message.erase(Message.end()-1); - Diag(FilenameTok, diag::pp_out_of_date_dependency, Message); + Diag(FilenameTok, diag::pp_out_of_date_dependency) << Message; } } |