summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/shared-string-literals.c9
-rw-r--r--clang/test/CodeGen/writable-strings.c8
2 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/CodeGen/shared-string-literals.c b/clang/test/CodeGen/shared-string-literals.c
new file mode 100644
index 00000000000..45b2f95a61e
--- /dev/null
+++ b/clang/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/clang/test/CodeGen/writable-strings.c b/clang/test/CodeGen/writable-strings.c
new file mode 100644
index 00000000000..64b2492936e
--- /dev/null
+++ b/clang/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);
+}
+
OpenPOWER on IntegriCloud