summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
index a9d11990c44..9077a027549 100644
--- a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
@@ -176,8 +176,6 @@ BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,
if (S->getLocStart().isMacroID())
return SourceLocation();
- static const char *const ErrorMessage =
- "cannot find location of closing parenthesis ')'";
SourceLocation CondEndLoc = S->getCond()->getLocEnd();
if (const DeclStmt *CondVar = S->getConditionVariableDeclStmt())
CondEndLoc = CondVar->getLocEnd();
@@ -185,21 +183,15 @@ BracesAroundStatementsCheck::findRParenLoc(const IfOrWhileStmt *S,
assert(CondEndLoc.isValid());
SourceLocation PastCondEndLoc =
Lexer::getLocForEndOfToken(CondEndLoc, 0, SM, Context->getLangOpts());
- if (PastCondEndLoc.isInvalid()) {
- diag(CondEndLoc, ErrorMessage);
+ if (PastCondEndLoc.isInvalid())
return SourceLocation();
- }
SourceLocation RParenLoc =
forwardSkipWhitespaceAndComments(PastCondEndLoc, SM, Context);
- if (RParenLoc.isInvalid()) {
- diag(PastCondEndLoc, ErrorMessage);
+ if (RParenLoc.isInvalid())
return SourceLocation();
- }
tok::TokenKind TokKind = getTokenKind(RParenLoc, SM, Context);
- if (TokKind != tok::r_paren) {
- diag(RParenLoc, ErrorMessage);
+ if (TokKind != tok::r_paren)
return SourceLocation();
- }
return RParenLoc;
}
OpenPOWER on IntegriCloud