summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/overloadable.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-13 00:10:09 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-13 00:10:09 +0000
commit5fec5b0495a5dee334b6d1eb19a0af8a90f2ac3b (patch)
treec31b38cb04db782e24a338ffac0f5f6885672d0e /clang/test/CodeGen/overloadable.c
parent35f423e09efb936861b99a2dbafa853ce3d766ce (diff)
downloadbcm5719-llvm-5fec5b0495a5dee334b6d1eb19a0af8a90f2ac3b.tar.gz
bcm5719-llvm-5fec5b0495a5dee334b6d1eb19a0af8a90f2ac3b.zip
Add basic support for C++ name mangling according to the Itanium C++
ABI to the CodeGen library. Since C++ code-generation is so incomplete, we can't exercise much of this mangling code. However, a few smoke tests show that it's doing the same thing as GCC. When C++ codegen matures, we'll extend the ABI tester to verify name-mangling as well, and complete the implementation here. At this point, the major client of name mangling is in the uses of the new "overloadable" attribute in C, which allows overloading. Any "overloadable" function in C (or in an extern "C" block in C++) will be mangled the same way that the corresponding C++ function would be mangled. llvm-svn: 64413
Diffstat (limited to 'clang/test/CodeGen/overloadable.c')
-rw-r--r--clang/test/CodeGen/overloadable.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeGen/overloadable.c b/clang/test/CodeGen/overloadable.c
new file mode 100644
index 00000000000..6b1cb351e63
--- /dev/null
+++ b/clang/test/CodeGen/overloadable.c
@@ -0,0 +1,24 @@
+// RUN: clang -emit-llvm %s -o - | grep _Z1fPA10_1X
+int __attribute__((overloadable)) f(int x) { return x; }
+float __attribute__((overloadable)) f(float x) { return x; }
+double __attribute__((overloadable)) f(double x) { return x; }
+double _Complex __attribute__((overloadable)) f(double _Complex x) { return x; }
+typedef short v4hi __attribute__ ((__vector_size__ (8)));
+v4hi __attribute__((overloadable)) f(v4hi x) { return x; }
+
+struct X { };
+void __attribute__((overloadable)) f(struct X (*ptr)[10]) { }
+
+int main() {
+ int iv = 17;
+ float fv = 3.0f;
+ double dv = 4.0;
+ double _Complex cdv;
+ v4hi vv;
+
+ iv = f(iv);
+ fv = f(fv);
+ dv = f(dv);
+ cdv = f(cdv);
+ vv = f(vv);
+}
OpenPOWER on IntegriCloud