diff options
| author | Haojian Wu <hokein@google.com> | 2016-02-16 10:31:33 +0000 |
|---|---|---|
| committer | Haojian Wu <hokein@google.com> | 2016-02-16 10:31:33 +0000 |
| commit | 67f880641c7ae3aa19bb9e7cce415f4bd727ee27 (patch) | |
| tree | efb585922c59c9f6b47b999bce02530d29cbf95a /clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp | |
| parent | 91b1e19152f51330a9267f859374134d22206af3 (diff) | |
| download | bcm5719-llvm-67f880641c7ae3aa19bb9e7cce415f4bd727ee27.tar.gz bcm5719-llvm-67f880641c7ae3aa19bb9e7cce415f4bd727ee27.zip | |
[clang-tidy] Fix an assert failure of ForStmt in `readability-braces-around-statements` check.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D17134
llvm-svn: 260952
Diffstat (limited to 'clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp index 629388100c1..d65f60ba5bd 100644 --- a/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp @@ -215,6 +215,8 @@ bool BracesAroundStatementsCheck::checkStmt( return false; } + if (!InitialLoc.isValid()) + return false; const SourceManager &SM = *Result.SourceManager; const ASTContext *Context = Result.Context; @@ -225,8 +227,6 @@ bool BracesAroundStatementsCheck::checkStmt( if (FileRange.isInvalid()) return false; - // InitialLoc points at the last token before opening brace to be inserted. - assert(InitialLoc.isValid()); // Convert InitialLoc to file location, if it's on the same macro expansion // level as the start of the statement. We also need file locations for // Lexer::getLocForEndOfToken working properly. |

