Ignore ConstantExpr in IgnoreParens
Summary:
This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more
helpers ignore it. For most clients, this ensures that these helpers
behave the same with and without C++17 enabled, which is what appears to
introduce these new expression nodes.
Fixes PR39881
Reviewers: void, rsmith
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D55853
llvm-svn: 350068
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 11191c4..6aa1199 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2596,6 +2596,10 @@
continue;
}
}
+ if (ConstantExpr *CE = dyn_cast<ConstantExpr>(E)) {
+ E = CE->getSubExpr();
+ continue;
+ }
return E;
}
}
@@ -2718,10 +2722,6 @@
E = NTTP->getReplacement();
continue;
}
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(E)) {
- E = CE->getSubExpr();
- continue;
- }
return E;
}
}