revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz

llvm-svn: 91600
This commit is contained in:
Nuno Lopes 2009-12-17 10:15:49 +00:00
parent ff22e5e8cb
commit 641fdce235
3 changed files with 4 additions and 14 deletions

View File

@ -592,8 +592,8 @@ The checks are:
<dt id="opt_fno-assume-sane-operator-new"><b>-fno-assume-sane-operator-new</b>: <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> 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 <dd>This option tells the compiler to do not assume that C++'s global new
possibly overloaded - new operator will always return a pointer that do not operator will always return a pointer that do not
alias any other pointer when the function returns.</dd> alias any other pointer when the function returns.</dd>
<!-- ======================================================================= --> <!-- ======================================================================= -->

View File

@ -2799,11 +2799,6 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
D.getIdentifierLoc(), Name, R, TInfo, D.getIdentifierLoc(), Name, R, TInfo,
isStatic, isInline); isStatic, isInline);
if ((Name.getCXXOverloadedOperator() == OO_New ||
Name.getCXXOverloadedOperator() == OO_Array_New) &&
getLangOptions().AssumeSaneOperatorNew)
NewFD->addAttr(::new (Context) MallocAttr());
isVirtualOkay = !isStatic; isVirtualOkay = !isStatic;
} else { } else {
// Determine whether the function was written with a // Determine whether the function was written with a

View File

@ -7,15 +7,10 @@
class teste { class teste {
int A; int A;
teste() : A(2) {} teste() : A(2) {}
void* operator new(unsigned) {return ::new teste();}
}; };
void f1() { void f1() {
// CHECK-SANE: declare noalias i8* @_Znwj(
// CHECK-SANENOT: declare i8* @_Znwj(
new teste(); 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(