summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2018-11-09 00:41:36 +0000
committerBill Wendling <isanbard@gmail.com>2018-11-09 00:41:36 +0000
commit8003edc9aa0160c777252b6ed8e96fc35f039bd4 (patch)
treed6a07c2e0b407f57baf6be744b81ef140079eb7d /clang/lib/AST/ExprConstant.cpp
parent009cc9b7cadc81b50127f14ccdb8ff10fccc1f00 (diff)
downloadbcm5719-llvm-8003edc9aa0160c777252b6ed8e96fc35f039bd4.tar.gz
bcm5719-llvm-8003edc9aa0160c777252b6ed8e96fc35f039bd4.zip
Compound literals, enums, et al require const expr
Summary: Compound literals, enums, file-scoped arrays, etc. require their initializers and size specifiers to be constant. Wrap the initializer expressions in a ConstantExpr so that we can easily check for this later on. Reviewers: rsmith, shafik Reviewed By: rsmith Subscribers: cfe-commits, jyknight, nickdesaulniers Differential Revision: https://reviews.llvm.org/D53921 llvm-svn: 346455
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 78c747196c0..30800568a22 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -4719,6 +4719,8 @@ public:
return Error(E);
}
+ bool VisitConstantExpr(const ConstantExpr *E)
+ { return StmtVisitorTy::Visit(E->getSubExpr()); }
bool VisitParenExpr(const ParenExpr *E)
{ return StmtVisitorTy::Visit(E->getSubExpr()); }
bool VisitUnaryExtension(const UnaryOperator *E)
OpenPOWER on IntegriCloud