diff options
author | Nico Weber <nicolasweber@gmx.de> | 2012-07-20 03:39:05 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2012-07-20 03:39:05 +0000 |
commit | 381767fcfe2fdf53727099d95b23b0c9e6a9aa6c (patch) | |
tree | b3f008d6d05f480d9b1ac8c317c47b48b05ce8b7 /lib/AST/ExprConstant.cpp | |
parent | 4a410dd179a960318dc0fef0a4eb1c1de63d9870 (diff) |
Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.
Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index f88206cee7..cbcd5e8f74 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -2340,6 +2340,12 @@ public: return Visit(E->getSubExpr()); } bool VisitUnaryOperator(const UnaryOperator *E) { return Visit(E->getSubExpr()); } + bool VisitGNUNullExpr(const GNUNullExpr *E) { return false; } + bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) { return false; } + bool VisitCXXThisExpr(const CXXThisExpr *E) { return false; } + bool VisitCXXNullPtrLiteralExpr(const CXXNullPtrLiteralExpr *E) { + return false; + } // Has side effects if any element does. bool VisitInitListExpr(const InitListExpr *E) { |