]> granicus.if.org Git - clang/commitdiff
"Implement" codegen support for __noop().
authorNico Weber <nicolasweber@gmx.de>
Sat, 13 Oct 2012 22:30:41 +0000 (22:30 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 13 Oct 2012 22:30:41 +0000 (22:30 +0000)
Eli discovered that __noop's sema behavior also needs some love. I filed
PR14081 for that and intend to improve it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165886 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
test/CodeGen/builtin-ms-noop.cpp [new file with mode: 0644]

index cf124caec1996800ea5b744d4e4954c1ee4c08cd..ad36b1c78e985cdf804bbf7466c39c7171d20b97 100644 (file)
@@ -1321,6 +1321,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
     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
diff --git a/test/CodeGen/builtin-ms-noop.cpp b/test/CodeGen/builtin-ms-noop.cpp
new file mode 100644 (file)
index 0000000..42c2501
--- /dev/null
@@ -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());
+};
+