From 01acb91affa1544a8c64e5ca5546e33d42b565cc Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 28 Nov 2007 06:27:12 +0000 Subject: [PATCH] Adding code gen tests for writable and shared string literals. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44397 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/shared-string-literals.c | 9 +++++++++ test/CodeGen/writable-strings.c | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 test/CodeGen/shared-string-literals.c create mode 100644 test/CodeGen/writable-strings.c diff --git a/test/CodeGen/shared-string-literals.c b/test/CodeGen/shared-string-literals.c new file mode 100644 index 0000000000..45b2f95a61 --- /dev/null +++ b/test/CodeGen/shared-string-literals.c @@ -0,0 +1,9 @@ +// RUN: clang -emit-llvm %s + +char *globalString = "abc"; +char *globalStringArray[5] = { "123", "abc" }; +char *anotherGlobalString = "123"; + +int main() { + printf("123"); +} diff --git a/test/CodeGen/writable-strings.c b/test/CodeGen/writable-strings.c new file mode 100644 index 0000000000..64b2492936 --- /dev/null +++ b/test/CodeGen/writable-strings.c @@ -0,0 +1,8 @@ +// RUN: clang -emit-llvm -fwritable-string %s + +int main() { + char *str = "abc"; + str[0] = '1'; + printf("%s", str); +} + -- 2.50.1