summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-alias-cycle.c
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Sema/attr-alias-cycle.c')
-rw-r--r--clang/test/Sema/attr-alias-cycle.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-alias-cycle.c b/clang/test/Sema/attr-alias-cycle.c
new file mode 100644
index 00000000000..ce024c3bd89
--- /dev/null
+++ b/clang/test/Sema/attr-alias-cycle.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux -fsyntax-only -verify -emit-llvm-only %s
+
+// FIXME: The attributes use mangled names. Since we only keep a mapping from
+// mangled name to llvm GlobalValue, we don't see the clang level decl for
+// an alias target when constructing the alias. Given that and that alias cycles
+// are not representable in LLVM, we only note the issues when the cycle is
+// first formed.
+
+// FIXME: This error is detected early in CodeGen. Once the first error is
+// found, Diags.hasErrorOccurred() returs true and we stop the codegen of the
+// file. The consequence is that we don't find any subsequent error.
+
+void f1() __attribute__((alias("g1")));
+void g1() __attribute__((alias("f1"))); // expected-error {{alias definition is part of a cycle}}
+
+void h1() __attribute__((alias("g1")));
OpenPOWER on IntegriCloud