[cfe-commits] r91600 - in /cfe/trunk: docs/UsersManual.html lib/Sema/SemaDecl.cpp test/CodeGenCXX/operator-new.cpp

Nuno Lopes nunoplopes at sapo.pt
Thu Dec 17 02:15:49 PST 2009


Author: nlopes
Date: Thu Dec 17 04:15:49 2009
New Revision: 91600

URL: http://llvm.org/viewvc/llvm-project?rev=91600&view=rev
Log:
revert part of my last patch, and mark only the c++ global new operator as noalias. the rest will be infered by llvm optz

Modified:
    cfe/trunk/docs/UsersManual.html
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/CodeGenCXX/operator-new.cpp

Modified: cfe/trunk/docs/UsersManual.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.html?rev=91600&r1=91599&r2=91600&view=diff

==============================================================================
--- cfe/trunk/docs/UsersManual.html (original)
+++ cfe/trunk/docs/UsersManual.html Thu Dec 17 04:15:49 2009
@@ -592,8 +592,8 @@
 
 <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>
 
 <!-- ======================================================================= -->

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=91600&r1=91599&r2=91600&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Dec 17 04:15:49 2009
@@ -2799,11 +2799,6 @@
                                   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

Modified: cfe/trunk/test/CodeGenCXX/operator-new.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/operator-new.cpp?rev=91600&r1=91599&r2=91600&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/operator-new.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/operator-new.cpp Thu Dec 17 04:15:49 2009
@@ -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(





More information about the cfe-commits mailing list