aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/Preprocessor.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-03-08 04:06:57 +0000
committerJohn McCall <rjmccall@apple.com>2011-03-08 04:06:57 +0000
commit30900dafbe972f4802c2663262b4393edab0d1cd (patch)
tree6459592b24d4cf2c25a643e194c1051ec03933a8 /include/clang/Lex/Preprocessor.h
parentdb93fdee6c5a24e86ee5ed8c1d3b597e17d5893b (diff)
Add an API call to retrieve the spelling data of a token from its SourceLocation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r--include/clang/Lex/Preprocessor.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h
index ec04838af2..0b01710abf 100644
--- a/include/clang/Lex/Preprocessor.h
+++ b/include/clang/Lex/Preprocessor.h
@@ -644,13 +644,18 @@ public:
return Diags->Report(Tok.getLocation(), DiagID);
}
+ /// getSpelling() - Return the 'spelling' of the token at the given location.
+ ///
+ /// \param invalid If non-null, will be set \c true if an error occurs.
+ llvm::StringRef getSpelling(SourceLocation loc, bool *invalid = 0) const;
+
/// 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
/// after trigraph expansion and escaped-newline folding. In particular, this
/// wants to get the true, uncanonicalized, spelling of things like digraphs
/// UCNs, etc.
///
- /// \param Invalid If non-NULL, will be set \c true if an error occurs.
+ /// \param Invalid If non-null, will be set \c true if an error occurs.
std::string getSpelling(const Token &Tok, bool *Invalid = 0) const {
return Lexer::getSpelling(Tok, SourceMgr, Features, Invalid);
}