[PATCH] D33354: [clang-tidy] readability-braces-around-statements false positive with char literals
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 22 06:58:37 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303551: [clang-tidy] readability-braces-around-statements false positive with char… (authored by alexfh).
Changed prior to commit:
https://reviews.llvm.org/D33354?vs=99576&id=99756#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33354
Files:
clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
Index: clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -54,14 +54,15 @@
SourceLocation findEndLocation(SourceLocation LastTokenLoc,
const SourceManager &SM,
const ASTContext *Context) {
- SourceLocation Loc = LastTokenLoc;
+ SourceLocation Loc =
+ Lexer::GetBeginningOfToken(LastTokenLoc, SM, Context->getLangOpts());
// Loc points to the beginning of the last (non-comment non-ws) token
// before end or ';'.
assert(Loc.isValid());
bool SkipEndWhitespaceAndComments = true;
tok::TokenKind TokKind = getTokenKind(Loc, SM, Context);
if (TokKind == tok::NUM_TOKENS || TokKind == tok::semi ||
- TokKind == tok::r_brace || isStringLiteral(TokKind)) {
+ TokKind == tok::r_brace) {
// If we are at ";" or "}", we found the last token. We could use as well
// `if (isa<NullStmt>(S))`, but it wouldn't work for nested statements.
SkipEndWhitespaceAndComments = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33354.99756.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170522/d15755c6/attachment.bin>
More information about the cfe-commits
mailing list