================
@@ -240,14 +241,59 @@ void Preprocessor::FinalizeForModelFile() {
}
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
- llvm::errs() << tok::getTokenName(Tok.getKind());
+ std::string TokenStr;
+ llvm::raw_string_ostream OS(TokenStr);
+
+ // The alignment of 16 is chosen to comfortably fit most identifiers.
+ OS << llvm::formatv("{0,-16} ", tok::getTokenName(Tok.getKind()));
+
+ // Annotation tokens are just markers that don't have a spelling -- they
----------------
yronglin wrote:
Hmm, `tok::annot_module_name` have a spelling, it's represents a C++ or ObjC
module name(eg. `A.B`). Can you add `tok::annot_module_name` support in this
function?
```cpp
ModuleNameLoc *NameLoc =
static_cast<ModuleNameLoc *>(Tok.getAnnotationValue());
std::string FlatName =
ModuleLoader::getFlatNameFromPath(NameLoc->getModuleIdPath());
```
https://github.com/llvm/llvm-project/pull/164894
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits