[cfe-commits] r59512 - in /cfe/trunk: include/clang/Lex/Preprocessor.h lib/Lex/PPDirectives.cpp lib/Lex/PPExpressions.cpp lib/Lex/Pragma.cpp

Chris Lattner sabre at nondot.org
Tue Nov 18 00:02:48 PST 2008


Author: lattner
Date: Tue Nov 18 02:02:48 2008
New Revision: 59512

URL: http://llvm.org/viewvc/llvm-project?rev=59512&view=rev
Log:
remove one more Preprocessor::Diag method.

Modified:
    cfe/trunk/include/clang/Lex/Preprocessor.h
    cfe/trunk/lib/Lex/PPDirectives.cpp
    cfe/trunk/lib/Lex/PPExpressions.cpp
    cfe/trunk/lib/Lex/Pragma.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=59512&r1=59511&r2=59512&view=diff

==============================================================================
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Nov 18 02:02:48 2008
@@ -405,9 +405,6 @@
   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

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=59512&r1=59511&r2=59512&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Nov 18 02:02:48 2008
@@ -59,7 +59,7 @@
     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 @@
     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 @@
   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 @@
   // 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 @@
       // #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;
       }
         

Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=59512&r1=59511&r2=59512&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Tue Nov 18 02:02:48 2008
@@ -91,7 +91,7 @@
     // 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());

Modified: cfe/trunk/lib/Lex/Pragma.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Pragma.cpp?rev=59512&r1=59511&r2=59512&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Pragma.cpp (original)
+++ cfe/trunk/lib/Lex/Pragma.cpp Tue Nov 18 02:02:48 2008
@@ -287,9 +287,11 @@
   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 @@
     }
     
     Message.erase(Message.end()-1);
-    Diag(FilenameTok, diag::pp_out_of_date_dependency, Message);
+    Diag(FilenameTok, diag::pp_out_of_date_dependency) << Message;
   }
 }
 





More information about the cfe-commits mailing list