]> granicus.if.org Git - clang/commitdiff
Fix PR8720 by printing an error message with a substring that the gcc testsuite searc...
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 7 Dec 2010 15:23:23 +0000 (15:23 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 7 Dec 2010 15:23:23 +0000 (15:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121137 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclAttr.cpp
test/CodeGen/2008-07-29-override-alias-decl.c
test/CodeGen/pragma-weak.c
test/CodeGenCXX/attr.cpp
test/Sema/attr-alias.c [new file with mode: 0644]
test/SemaCXX/attr-weakref.cpp

index d3c1a50a668e05607f0cb288ea0dc3fc938e796a..34354ce4fd07012c56d34ce66094424565f78cde 100644 (file)
@@ -1001,6 +1001,8 @@ def err_attribute_weakref_not_global_context : Error<
   "weakref declaration of '%0' must be in a global context">;
 def err_attribute_weakref_without_alias : Error<
   "weakref declaration of '%0' must also have an alias attribute">;
+def err_alias_not_supported_on_darwin : Error <
+  "only weak aliases are supported on darwin">;
 def warn_attribute_wrong_decl_type : Warning<
   "%0 attribute only applies to %select{function|union|"
   "variable and function|function or method|parameter|"
index 3c4bd8ffc45a9ce42a73fe5e9b3f17b135ace88b..e5f27fcfbb88e2458dacbc152c0c6ecc243fd84f 100644 (file)
@@ -675,6 +675,11 @@ static void HandleAliasAttr(Decl *d, const AttributeList &Attr, Sema &S) {
     return;
   }
 
+  if (S.Context.Target.getTriple().getOS() == llvm::Triple::Darwin) {
+    S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin);
+    return;
+  }
+
   // FIXME: check if target symbol exists in current file
 
   d->addAttr(::new (S.Context) AliasAttr(Attr.getLoc(), S.Context,
index dbe10b395f4fa0225a823ce944f2bde57e6e95c5..0c2d0c6ca57617a0a74998be08162dd29905fa15 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 int x() { return 1; }
 
index 5c2866e3d35f437d66806b126647b7c570f053ad..1de60e106a95950a29ca7d4201f8098221838776 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -verify | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm %s -o - -verify | FileCheck %s
 
 // CHECK: @weakvar = weak global
 // CHECK: @__weakvar_alias = common global
index d689a4fdf493e32d15081ad84b56eebaad6b8062..9e8740e54700bfaf4e2d185f559001907305d53f 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s
 
 // CHECK: @test2 = alias i32 ()* @_Z5test1v
 
diff --git a/test/Sema/attr-alias.c b/test/Sema/attr-alias.c
new file mode 100644 (file)
index 0000000..151052f
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin  -fsyntax-only -verify %s
+
+void g() {}
+
+// It is important that the following string be in the error message. The gcc
+// testsuite looks for it to decide if a target supports aliases.
+
+void f() __attribute__((alias("g"))); //expected-error {{only weak aliases are supported}}
index 5773acc1ab3fa8d784d402f07022ec7afce12e5a..11368d9399e9edd9e85f5e9ee96c19db245f6e64 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fsyntax-only -verify %s
 
 // GCC will accept anything as the argument of weakref. Should we
 // check for an existing decl?