Skip to content

Commit e6b6a57

Browse files
author
Hal Finkel
committed
remember to commit the example test
1 parent f5bafec commit e6b6a57

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// RUN: %clang -std=c++11 -fplugin=%llvmshlibdir/PrintTokensSyntax%pluginext -emit-llvm -S %s -o - | FileCheck %s
2+
// REQUIRES: plugins, examples
3+
4+
[[clang::syntax(tokens)]] void fn1() {
5+
This is a test with a "string".
6+
}
7+
8+
// CHECK: [[STR_VAR:@.+]] = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
9+
// CHECK-NEXT: [[STR_VAR1:@.+]] = private unnamed_addr constant [5 x i8] c"This\00", align 1
10+
// CHECK-NEXT: [[STR_VAR2:@.+]] = private unnamed_addr constant [3 x i8] c"is\00", align 1
11+
// CHECK-NEXT: [[STR_VAR3:@.+]] = private unnamed_addr constant [2 x i8] c"a\00", align 1
12+
// CHECK-NEXT: [[STR_VAR4:@.+]] = private unnamed_addr constant [5 x i8] c"test\00", align 1
13+
// CHECK-NEXT: [[STR_VAR5:@.+]] = private unnamed_addr constant [5 x i8] c"with\00", align 1
14+
// CHECK-NEXT: [[STR_VAR6:@.+]] = private unnamed_addr constant [9 x i8] c"\22string\22\00", align 1
15+
// CHECK-NEXT: [[STR_VAR7:@.+]] = private unnamed_addr constant [2 x i8] c".\00", align 1
16+
17+
// CHECK: define dso_local void @_Z3fn1v() #0 {
18+
// CHECK-NEXT: entry:
19+
// CHECK-NEXT: %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[STR_VAR1]], {{.*}}))
20+
// CHECK-NEXT: %call1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[STR_VAR2]], {{.*}}))
21+
// CHECK-NEXT: %call2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([2 x i8], [2 x i8]* [[STR_VAR3]], {{.*}}))
22+
// CHECK-NEXT: %call3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[STR_VAR4]], {{.*}}))
23+
// CHECK-NEXT: %call4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([5 x i8], [5 x i8]* [[STR_VAR5]], {{.*}}))
24+
// CHECK-NEXT: %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([2 x i8], [2 x i8]* [[STR_VAR3]], {{.*}}))
25+
// CHECK-NEXT: %call6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([9 x i8], [9 x i8]* [[STR_VAR6]], {{.*}}))
26+
// CHECK-NEXT: %call7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR_VAR]], {{.*}}), i8* getelementptr inbounds ([2 x i8], [2 x i8]* [[STR_VAR7]], {{.*}}))
27+
// CHECK-NEXT: ret void
28+
// CHECK-NEXT: }
29+
30+

0 commit comments

Comments
 (0)