sbc100 updated this revision to Diff 152335.
sbc100 added a comment.

wrong test


Repository:
  rC Clang

https://reviews.llvm.org/D48443

Files:
  lib/CodeGen/CGCall.cpp
  test/CodeGen/no-prototype.c


Index: test/CodeGen/no-prototype.c
===================================================================
--- /dev/null
+++ test/CodeGen/no-prototype.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck 
%s
+
+extern void foo();
+
+void bar(int a) {
+  foo(1);
+}
+
+// CHECK: declare void @foo(...) [[NOPROTO:#[0-9]+]]
+// CHECK: attributes [[NOPROTO]] = {  {{.*}}"no-prototype"{{.*}} }
Index: lib/CodeGen/CGCall.cpp
===================================================================
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1845,6 +1845,8 @@
       FuncAttrs.addAttribute(llvm::Attribute::Convergent);
 
     if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
+      if (!AttrOnCallSite && !Fn->hasPrototype())
+        FuncAttrs.addAttribute("no-prototype");
       AddAttributesFromFunctionProtoType(
           getContext(), FuncAttrs, Fn->getType()->getAs<FunctionProtoType>());
       // Don't use [[noreturn]] or _Noreturn for a call to a virtual function.


Index: test/CodeGen/no-prototype.c
===================================================================
--- /dev/null
+++ test/CodeGen/no-prototype.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s
+
+extern void foo();
+
+void bar(int a) {
+  foo(1);
+}
+
+// CHECK: declare void @foo(...) [[NOPROTO:#[0-9]+]]
+// CHECK: attributes [[NOPROTO]] = {  {{.*}}"no-prototype"{{.*}} }
Index: lib/CodeGen/CGCall.cpp
===================================================================
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1845,6 +1845,8 @@
       FuncAttrs.addAttribute(llvm::Attribute::Convergent);
 
     if (const FunctionDecl *Fn = dyn_cast<FunctionDecl>(TargetDecl)) {
+      if (!AttrOnCallSite && !Fn->hasPrototype())
+        FuncAttrs.addAttribute("no-prototype");
       AddAttributesFromFunctionProtoType(
           getContext(), FuncAttrs, Fn->getType()->getAs<FunctionProtoType>());
       // Don't use [[noreturn]] or _Noreturn for a call to a virtual function.
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to