[cfe-commits] r101861 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/CXX/expr/expr.unary/expr.new/p19.cpp test/CXX/expr/expr.unary/expr.new/p20-0x.cpp test/CXX/expr/expr.unary/expr.new/p20.cpp test/CodeGenCXX/delete.cpp test/SemaCXX/no-exceptions.cpp
John McCall
rjmccall at apple.com
Mon Apr 19 19:18:25 PDT 2010
Author: rjmccall
Date: Mon Apr 19 21:18:25 2010
New Revision: 101861
URL: http://llvm.org/viewvc/llvm-project?rev=101861&view=rev
Log:
Restore r101841 without modification. Also mark 'operator delete' as used for
actual delete expressions, not just new expressions.
Added:
cfe/trunk/test/SemaCXX/no-exceptions.cpp
- copied unchanged from r101858, cfe/trunk/test/SemaCXX/no-exceptions.cpp
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/CXX/expr/expr.unary/expr.new/p19.cpp
cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20.cpp
cfe/trunk/test/CodeGenCXX/delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=101861&r1=101860&r2=101861&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Apr 19 21:18:25 2010
@@ -886,6 +886,13 @@
return true;
}
+ // We don't need an operator delete if we're running under
+ // -fno-exceptions.
+ if (!getLangOptions().Exceptions) {
+ OperatorDelete = 0;
+ return false;
+ }
+
// FindAllocationOverload can change the passed in arguments, so we need to
// copy them back.
if (NumPlaceArgs > 0)
@@ -1392,6 +1399,8 @@
return ExprError();
}
+ MarkDeclarationReferenced(StartLoc, OperatorDelete);
+
// FIXME: Check access and ambiguity of operator delete and destructor.
}
Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.new/p19.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.new/p19.cpp?rev=101861&r1=101860&r2=101861&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.new/p19.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.new/p19.cpp Mon Apr 19 21:18:25 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
typedef __SIZE_TYPE__ size_t;
// Operator delete template for placement new with global lookup
Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp?rev=101861&r1=101860&r2=101861&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp Mon Apr 19 21:18:25 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -fexceptions %s
typedef __SIZE_TYPE__ size_t;
struct S {
Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20.cpp?rev=101861&r1=101860&r2=101861&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.new/p20.cpp Mon Apr 19 21:18:25 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions %s
typedef __SIZE_TYPE__ size_t;
// Overloaded operator delete with two arguments
Modified: cfe/trunk/test/CodeGenCXX/delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/delete.cpp?rev=101861&r1=101860&r2=101861&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/delete.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/delete.cpp Mon Apr 19 21:18:25 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -emit-llvm -o %t
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
void t1(int *a) {
delete a;
@@ -19,8 +19,11 @@
int a;
};
+// CHECK: define void @_Z2t4P1T
void t4(T *t) {
- // RUN: grep "call void @_ZN1TD1Ev" %t | count 1
+ // CHECK: call void @_ZN1TD1Ev
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @_ZdlPv
delete t;
}
@@ -35,3 +38,22 @@
delete a;
}
+
+namespace test0 {
+ struct A {
+ void *operator new(__SIZE_TYPE__ sz);
+ void operator delete(void *p) { ::operator delete(p); }
+ ~A() {}
+ };
+
+ // CHECK: define void @_ZN5test04testEPNS_1AE(
+ void test(A *a) {
+ // CHECK: call void @_ZN5test01AD1Ev
+ // CHECK-NEXT: bitcast
+ // CHECK-NEXT: call void @_ZN5test01AdlEPv
+ delete a;
+ }
+
+ // CHECK: define linkonce_odr void @_ZN5test01AD1Ev
+ // CHECK: define linkonce_odr void @_ZN5test01AdlEPv
+}
More information about the cfe-commits
mailing list