]> granicus.if.org Git - clang/commitdiff
Adding code gen tests for writable and shared string literals.
authorOliver Hunt <oliver@apple.com>
Wed, 28 Nov 2007 06:27:12 +0000 (06:27 +0000)
committerOliver Hunt <oliver@apple.com>
Wed, 28 Nov 2007 06:27:12 +0000 (06:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44397 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/shared-string-literals.c [new file with mode: 0644]
test/CodeGen/writable-strings.c [new file with mode: 0644]

diff --git a/test/CodeGen/shared-string-literals.c b/test/CodeGen/shared-string-literals.c
new file mode 100644 (file)
index 0000000..45b2f95
--- /dev/null
@@ -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 (file)
index 0000000..64b2492
--- /dev/null
@@ -0,0 +1,8 @@
+// RUN: clang -emit-llvm -fwritable-string %s
+
+int main() {
+    char *str = "abc";
+    str[0] = '1';
+    printf("%s", str);
+}
+