aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2009-12-17 10:15:49 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2009-12-17 10:15:49 +0000
commitb23f20d72021548c812ddc81b91bf7ad78fe708c (patch)
treed2cd9b03300e47ee26cb6e2cd64e307a82161016
parentaa526240196353d62d324cc06d2f267f15645b3f (diff)
revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91600 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/UsersManual.html4
-rw-r--r--lib/Sema/SemaDecl.cpp5
-rw-r--r--test/CodeGenCXX/operator-new.cpp9
3 files changed, 4 insertions, 14 deletions
diff --git a/docs/UsersManual.html b/docs/UsersManual.html
index 7d6af988e1..13e0209414 100644
--- a/docs/UsersManual.html
+++ b/docs/UsersManual.html
@@ -592,8 +592,8 @@ The checks are:
<dt id="opt_fno-assume-sane-operator-new"><b>-fno-assume-sane-operator-new</b>:
Don't assume that the C++'s new operator is sane.</dt>
-<dd>This option tells the compiler to do not assume that C++'s global - and any
-possibly overloaded - new operator will always return a pointer that do not
+<dd>This option tells the compiler to do not assume that C++'s global new
+operator will always return a pointer that do not
alias any other pointer when the function returns.</dd>
<!-- ======================================================================= -->
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index ca42cac72c..ee4bd22676 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2799,11 +2799,6 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
D.getIdentifierLoc(), Name, R, TInfo,
isStatic, isInline);
- if ((Name.getCXXOverloadedOperator() == OO_New ||
- Name.getCXXOverloadedOperator() == OO_Array_New) &&
- getLangOptions().AssumeSaneOperatorNew)
- NewFD->addAttr(::new (Context) MallocAttr());
-
isVirtualOkay = !isStatic;
} else {
// Determine whether the function was written with a
diff --git a/test/CodeGenCXX/operator-new.cpp b/test/CodeGenCXX/operator-new.cpp
index 6becaae72c..da64fc1b2d 100644
--- a/test/CodeGenCXX/operator-new.cpp
+++ b/test/CodeGenCXX/operator-new.cpp
@@ -7,15 +7,10 @@
class teste {
int A;
teste() : A(2) {}
- void* operator new(unsigned) {return ::new teste();}
};
void f1() {
+ // CHECK-SANE: declare noalias i8* @_Znwj(
+ // CHECK-SANENOT: declare i8* @_Znwj(
new teste();
}
-
-// CHECK-SANE: define linkonce_odr noalias i8* @_ZN5testenwEj(
-// CHECK-SANE: declare noalias i8* @_Znwj(
-
-// CHECK-SANENOT: define linkonce_odr i8* @_ZN5testenwEj(
-// CHECK-SANENOT: declare i8* @_Znwj(