[clang-tidy] Don't use diag() for debug output

llvm-svn: 255765
This commit is contained in:
Alexander Kornienko 2015-12-16 13:19:08 +00:00
parent 2de8c16913
commit d819364e81
1 changed files with 3 additions and 11 deletions

View File

@ -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;
}