diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-11-03 18:11:22 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-11-03 18:11:22 +0000 |
commit | 92684aa6d4f1860a13ae9ea702b711afaaa94168 (patch) | |
tree | 6213b48cf64cb85aefb332aa1a348066a19115bb /include | |
parent | c7e8e8e2edf48ee98341a80e713e2947a4861a55 (diff) | |
download | clang-92684aa6d4f1860a13ae9ea702b711afaaa94168.tar.gz |
[refactor][extract] insert semicolons into extracted/inserted code
when needed
This commit implements the semicolon insertion logic into the extract
refactoring. The following rules are used:
- extracting expression: add terminating ';' to the extracted function.
- extracting statements that don't require terminating ';' (e.g. switch): add
terminating ';' to the callee.
- extracting statements with ';': move (if possible) the original ';' from the
callee and add terminating ';'.
- otherwise, add ';' to both places.
Differential Revision: https://reviews.llvm.org/D39441
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317343 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Lex/Lexer.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index 603ce10f64..9ad3e21476 100644 --- a/include/clang/Lex/Lexer.h +++ b/include/clang/Lex/Lexer.h @@ -466,6 +466,13 @@ public: const LangOptions &LangOpts, unsigned MaxLines = 0); + /// Finds the token that comes right after the given location. + /// + /// Returns the next token, or none if the location is inside a macro. + static Optional<Token> findNextToken(SourceLocation Loc, + const SourceManager &SM, + const LangOptions &LangOpts); + /// \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 |