From b2ecd46ae43decd73a7f9fc949fa4eda73b302b6 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 7 Mar 2018 03:00:25 +0000 Subject: [PATCH] Revert 326766 too, after r326862 the test fails and I don't know how to fix. llvm-svn: 326869 --- clang/lib/AST/ExprConstant.cpp | 6 +----- clang/test/CodeGenCXX/alloc-size.cpp | 12 ------------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index c3e4165..45df133 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -133,11 +133,7 @@ namespace { E = E->IgnoreParens(); // If we're doing a variable assignment from e.g. malloc(N), there will - // probably be a cast of some kind. In exotic cases, we might also see a - // top-level ExprWithCleanups. Ignore them either way. - if (const auto *EC = dyn_cast(E)) - E = EC->getSubExpr()->IgnoreParens(); - + // probably be a cast of some kind. Ignore it. if (const auto *Cast = dyn_cast(E)) E = Cast->getSubExpr()->IgnoreParens(); diff --git a/clang/test/CodeGenCXX/alloc-size.cpp b/clang/test/CodeGenCXX/alloc-size.cpp index 5b8e1c5..ac53ea8 100644 --- a/clang/test/CodeGenCXX/alloc-size.cpp +++ b/clang/test/CodeGenCXX/alloc-size.cpp @@ -70,15 +70,3 @@ int testIt() { __builtin_object_size(dependent_calloc2(), 0); } } // namespace templated_alloc_size - -struct D { - ~D(); - void *my_malloc(int N) __attribute__((alloc_size(2))); -}; - -// CHECK-LABEL: define i32 @_Z20callExprWithCleanupsv -int callExprWithCleanups() { - int *const p = (int *)D().my_malloc(3); - // CHECK: ret i32 3 - return __builtin_object_size(p, 0); -} -- 2.7.4