[clang] 0eb5891 - [clang][preprocessor] Allow calling DumpToken() on annotation tokens

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 22:06:17 PDT 2022


Author: Timm Bäder
Date: 2022-04-13T07:06:00+02:00
New Revision: 0eb5891adcb84ccf665e88a62f573a1e22696782

URL: https://github.com/llvm/llvm-project/commit/0eb5891adcb84ccf665e88a62f573a1e22696782
DIFF: https://github.com/llvm/llvm-project/commit/0eb5891adcb84ccf665e88a62f573a1e22696782.diff

LOG: [clang][preprocessor] Allow calling DumpToken() on annotation tokens

Differential Revision: https://reviews.llvm.org/D122659

Added: 
    

Modified: 
    clang/lib/Lex/Preprocessor.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 43b9930db1d6d..abbd33331e9d3 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -232,8 +232,10 @@ void Preprocessor::FinalizeForModelFile() {
 }
 
 void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
-  llvm::errs() << tok::getTokenName(Tok.getKind()) << " '"
-               << getSpelling(Tok) << "'";
+  llvm::errs() << tok::getTokenName(Tok.getKind());
+
+  if (!Tok.isAnnotation())
+    llvm::errs() << " '" << getSpelling(Tok) << "'";
 
   if (!DumpFlags) return;
 


        


More information about the cfe-commits mailing list