Make -Wfor-loop-analysis work with C++17
For now, disable the "variable in loop condition not modified" warning to not
be emitted when there is a structured binding variable in the loop condition.
https://bugs.llvm.org/show_bug.cgi?id=39285
llvm-svn: 344828
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index f0d1947..16ed9ed 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1409,7 +1409,11 @@
void VisitDeclRefExpr(DeclRefExpr *E) {
VarDecl *VD = dyn_cast<VarDecl>(E->getDecl());
- if (!VD) return;
+ if (!VD) {
+ // Don't allow unhandled Decl types.
+ Simple = false;
+ return;
+ }
Ranges.push_back(E->getSourceRange());