[cfe-commits] r165886 - in /cfe/trunk: lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtin-ms-noop.cpp

Nico Weber nicolasweber at gmx.de
Sat Oct 13 15:30:41 PDT 2012


Author: nico
Date: Sat Oct 13 17:30:41 2012
New Revision: 165886

URL: http://llvm.org/viewvc/llvm-project?rev=165886&view=rev
Log:
"Implement" codegen support for __noop().

Eli discovered that __noop's sema behavior also needs some love. I filed
PR14081 for that and intend to improve it.


Added:
    cfe/trunk/test/CodeGen/builtin-ms-noop.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=165886&r1=165885&r2=165886&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sat Oct 13 17:30:41 2012
@@ -1321,6 +1321,8 @@
     llvm::StringRef Str = cast<StringLiteral>(AnnotationStrExpr)->getString();
     return RValue::get(EmitAnnotationCall(F, AnnVal, Str, E->getExprLoc()));
   }
+  case Builtin::BI__noop:
+    return RValue::get(0);
   }
 
   // If this is an alias for a lib function (e.g. __builtin_sin), emit

Added: cfe/trunk/test/CodeGen/builtin-ms-noop.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-ms-noop.cpp?rev=165886&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/builtin-ms-noop.cpp (added)
+++ cfe/trunk/test/CodeGen/builtin-ms-noop.cpp Sat Oct 13 17:30:41 2012
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple i686-pc-win32 -emit-llvm %s -o - | FileCheck %s
+
+class A {
+ public:
+  ~A() {}
+};
+
+void f() {
+// CHECK: @_Z1fv
+// CHECK-NOT: call void @_ZN1AD1Ev
+// CHECK: ret void
+  __noop(A());
+};
+





More information about the cfe-commits mailing list