]> granicus.if.org Git - clang/commitdiff
revert part of my last patch, and mark only the c++ global new operator as noalias...
authorNuno Lopes <nunoplopes@sapo.pt>
Thu, 17 Dec 2009 10:15:49 +0000 (10:15 +0000)
committerNuno Lopes <nunoplopes@sapo.pt>
Thu, 17 Dec 2009 10:15:49 +0000 (10:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91600 91177308-0d34-0410-b5e6-96231b3b80d8

docs/UsersManual.html
lib/Sema/SemaDecl.cpp
test/CodeGenCXX/operator-new.cpp

index 7d6af988e17f63d823b07e56a5ade7c0071175f7..13e0209414725f177effe3965ea942fdbcb5545d 100644 (file)
@@ -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>
 
 <!-- ======================================================================= -->
index ca42cac72c8aab8c03db7ddd7f4fe52e1a506124..ee4bd2267686810eb3e3d4f5a7f7cd23c7569c5e 100644 (file)
@@ -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
index 6becaae72cb865919c05551afb4d70147639557a..da64fc1b2d4e03d67d0bf927e52770710250054c 100644 (file)
@@ -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(