diff options
Diffstat (limited to 'clang/include/clang/Frontend/CommandLineSourceLoc.h')
-rw-r--r-- | clang/include/clang/Frontend/CommandLineSourceLoc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/include/clang/Frontend/CommandLineSourceLoc.h b/clang/include/clang/Frontend/CommandLineSourceLoc.h index 0827433462e1..dfc4454b4baf 100644 --- a/clang/include/clang/Frontend/CommandLineSourceLoc.h +++ b/clang/include/clang/Frontend/CommandLineSourceLoc.h @@ -48,6 +48,13 @@ public: return PSL; } + + /// Serialize ParsedSourceLocation back to a string. + std::string ToString() const { + return (llvm::Twine(FileName == "<stdin>" ? "-" : FileName) + ":" + + Twine(Line) + ":" + Twine(Column)) + .str(); + } }; /// A source range that has been parsed on the command line. |