aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Lex/Lexer.h
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-07-27 21:43:43 +0000
committerAnna Zaks <ganna@apple.com>2011-07-27 21:43:43 +0000
commitaca25bccefe56121b686706afc84c8cb5d46e65b (patch)
treee04a4033b4f15c88917c5060cbdc5e369394fff4 /include/clang/Lex/Lexer.h
parenta862320972e63349524dc9aa744dec1b95f54ba1 (diff)
Add a utility function to the Lexer, which makes it easier to find a token after the given location. (It is a generalized version of trans::findLocationAfterSemi from ArcMigrate, which will be changed to use the Lexer utility).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Lexer.h')
-rw-r--r--include/clang/Lex/Lexer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h
index 2c25597433..e24fe9c9ab 100644
--- a/include/clang/Lex/Lexer.h
+++ b/include/clang/Lex/Lexer.h
@@ -456,6 +456,18 @@ public:
/// them), skip over them and return the first non-escaped-newline found,
/// otherwise return P.
static const char *SkipEscapedNewLines(const char *P);
+
+ /// \brief Checks that the given token is the first token that occurs after
+ /// the given location (this excludes comments and whitespace). Returns the
+ /// location immediately after the specified token. If the token is not found
+ /// or the location is inside a macro, the returned source location will be
+ /// invalid.
+ static SourceLocation findLocationAfterToken(SourceLocation loc,
+ tok::TokenKind TKind,
+ const SourceManager &SM,
+ const LangOptions &LangOpts,
+ bool SkipTrailingWhitespaceAndNewLine);
+
private:
/// getCharAndSizeSlowNoWarn - Same as getCharAndSizeSlow, but never emits a