llvm.org GIT mirror llvm / d5e155b
Make YAML quote forward slashes. If you have the string /usr/bin, prior to this patch it would not be quoted by our YAML serializer. But a string like C:\src would be, due to the presence of a backslash. This makes the quoting rules of basically every single file path different depending on the path syntax (posix vs. Windows). While technically not required by the YAML specification to quote forward slashes, when the behavior of paths is inconsistent it makes it difficult to portably write FileCheck lines that will work with either kind of path. Differential Revision: https://reviews.llvm.org/D53169 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344359 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 10 months ago
11 changed file(s) with 32 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
577577 // Safe scalar characters.
578578 case '_':
579579 case '-':
580 case '/':
581580 case '^':
582581 case '.':
583582 case ',':
594593 // DEL (0x7F) are excluded from the allowed character range.
595594 case 0x7F:
596595 return QuotingType::Double;
596 // Forward slash is allowed to be unquoted, but we quote it anyway. We have
597 // many tests that use FileCheck against YAML output, and this output often
598 // contains paths. If we quote backslashes but not forward slashes then
599 // paths will come out either quoted or unquoted depending on which platform
600 // the test is run on, making FileCheck comparisons difficult.
601 case '/':
597602 default: {
598603 // C0 control block (0x0 - 0x1F) is excluded from the allowed character
599604 // range.
3737 ; YAML: --- !Missed
3838 ; YAML: Pass: regalloc
3939 ; YAML: Name: LoopSpillReload
40 ; YAML: DebugLoc: { File: /tmp/kk.c, Line: 3, Column: 20 }
40 ; YAML: DebugLoc: { File: '/tmp/kk.c', Line: 3, Column: 20 }
4141 ; YAML: Function: fpr128
4242 ; YAML: Hotness: 300
4343 ; YAML: Args:
5050 ; YAML: --- !Missed
5151 ; YAML: Pass: regalloc
5252 ; YAML: Name: LoopSpillReload
53 ; YAML: DebugLoc: { File: /tmp/kk.c, Line: 2, Column: 20 }
53 ; YAML: DebugLoc: { File: '/tmp/kk.c', Line: 2, Column: 20 }
5454 ; YAML: Function: fpr128
5555 ; YAML: Hotness: 30000
5656 ; YAML: Args:
6363 ; YAML: --- !Missed
6464 ; YAML: Pass: regalloc
6565 ; YAML: Name: LoopSpillReload
66 ; YAML: DebugLoc: { File: /tmp/kk.c, Line: 1, Column: 20 }
66 ; YAML: DebugLoc: { File: '/tmp/kk.c', Line: 1, Column: 20 }
6767 ; YAML: Function: fpr128
6868 ; YAML: Hotness: 300
6969 ; YAML: Args:
7878 ; THRESHOLD_YAML: --- !Missed
7979 ; THRESHOLD_YAML: Pass: regalloc
8080 ; THRESHOLD_YAML: Name: LoopSpillReload
81 ; THRESHOLD_YAML: DebugLoc: { File: /tmp/kk.c, Line: 2, Column: 20 }
81 ; THRESHOLD_YAML: DebugLoc: { File: '/tmp/kk.c', Line: 2, Column: 20 }
8282 ; THRESHOLD_YAML: Function: fpr128
8383 ; THRESHOLD_YAML: Hotness: 30000
8484 ; THRESHOLD_YAML: Args:
375375 #CHECK: DWARF:
376376 #CHECK: debug_str:
377377 #CHECK: - 'clang version 4.0.0 (trunk 290181) (llvm/trunk 290209)'
378 #CHECK: - ../compiler-rt/lib/builtins/absvdi2.c
379 #CHECK: - /Users/cbieneman/dev/open-source/llvm-build-rel
378 #CHECK: - '../compiler-rt/lib/builtins/absvdi2.c'
379 #CHECK: - '/Users/cbieneman/dev/open-source/llvm-build-rel'
380380 #CHECK: - int
381381 #CHECK: - di_int
382382 #CHECK: - long long int
364364 #CHECK: DWARF:
365365 #CHECK: debug_str:
366366 #CHECK: - 'clang version 4.0.0 (trunk 290181) (llvm/trunk 290209)'
367 #CHECK: - ../compiler-rt/lib/builtins/absvdi2.c
368 #CHECK: - /Users/cbieneman/dev/open-source/llvm-build-rel
367 #CHECK: - '../compiler-rt/lib/builtins/absvdi2.c'
368 #CHECK: - '/Users/cbieneman/dev/open-source/llvm-build-rel'
369369 #CHECK: - int
370370 #CHECK: - di_int
371371 #CHECK: - long long int
256256 #CHECK: - ''
257257 #CHECK: - 'clang version 4.0.0 (trunk 288677) (llvm/trunk 288676)'
258258 #CHECK: - hello_world.c
259 #CHECK: - /Users/cbieneman/dev/open-source/llvm-build-rel
259 #CHECK: - '/Users/cbieneman/dev/open-source/llvm-build-rel'
260260 #CHECK: - main
261261 #CHECK: - argc
262262 #CHECK: - argv
3939 #CHECK: - cmd: LC_LOAD_DYLINKER
4040 #CHECK: cmdsize: 32
4141 #CHECK: name: 12
42 #CHECK: PayloadString: /usr/lib/dyld
42 #CHECK: PayloadString: '/usr/lib/dyld'
4343 #CHECK: ZeroPadBytes: 7
4444 #CHECK: - cmd: LC_LOAD_DYLIB
4545 #CHECK: cmdsize: 48
5757 #CHECK: timestamp: 2
5858 #CHECK: current_version: 80349697
5959 #CHECK: compatibility_version: 65536
60 #CHECK: PayloadString: /usr/lib/libSystem.B.dylib
60 #CHECK: PayloadString: '/usr/lib/libSystem.B.dylib'
6161 #CHECK: ZeroPadBytes: 6
3131 ; CGSCC-NEXT: Name: IRSizeChange
3232 ; CGSCC-NEXT: Function:
3333 ; CGSCC-NEXT: Args:
34 ; CGSCC-NEXT: - Pass: Function Integration/Inlining
34 ; CGSCC-NEXT: - Pass: 'Function Integration/Inlining'
3535 ; CGSCC-NEXT: - String: ': IR instruction count changed from '
3636 ; CGSCC-NEXT: - IRInstrsBefore: '[[ORIG]]'
3737 ; CGSCC-NEXT: - String: ' to '
4343 ; CGSCC-NEXT: Name: FunctionIRSizeChange
4444 ; CGSCC-NEXT: Function:
4545 ; CGSCC-NEXT: Args:
46 ; CGSCC-NEXT: - Pass: Function Integration/Inlining
46 ; CGSCC-NEXT: - Pass: 'Function Integration/Inlining'
4747 ; CGSCC-NEXT: - String: ': Function: '
4848 ; CGSCC-NEXT: - Function: bar
4949 ; CGSCC-NEXT: - String: ': IR instruction count changed from '
4848 ; YAML-NEXT: --- !Missed
4949 ; YAML-NEXT: Pass: gvn
5050 ; YAML-NEXT: Name: LoadClobbered
51 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 3 }
51 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 3, Column: 3 }
5252 ; YAML-NEXT: Function: may_alias
5353 ; YAML-NEXT: Args:
5454 ; YAML-NEXT: - String: 'load of type '
5656 ; YAML-NEXT: - String: ' not eliminated'
5757 ; YAML-NEXT: - String: ' in favor of '
5858 ; YAML-NEXT: - OtherAccess: load
59 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 13 }
59 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 1, Column: 13 }
6060 ; YAML-NEXT: - String: ' because it is clobbered by '
6161 ; YAML-NEXT: - ClobberedBy: store
62 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 2, Column: 10 }
62 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 2, Column: 10 }
6363 ; YAML-NEXT: ...
6464
6565 define i32 @arg(i32* %p, i32 %i) {
2121 ; YAML: --- !Passed
2222 ; YAML-NEXT: Pass: inline
2323 ; YAML-NEXT: Name: Inlined
24 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 10 }
24 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 4, Column: 10 }
2525 ; YAML-NEXT: Function: bar
2626 ; YAML-NEXT: Hotness: 30
2727 ; YAML-NEXT: Args:
2828 ; YAML-NEXT: - Callee: foo
29 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 1, Column: 0 }
29 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 1, Column: 0 }
3030 ; YAML-NEXT: - String: ' inlined into '
3131 ; YAML-NEXT: - Caller: bar
32 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 3, Column: 0 }
32 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 3, Column: 0 }
3333 ; YAML-NEXT: - String: ' with '
3434 ; YAML-NEXT: - String: '(cost='
3535 ; YAML-NEXT: - Cost: '{{[0-9\-]+}}'
5151 ; YAML: --- !Missed
5252 ; YAML-NEXT: Pass: inline
5353 ; YAML-NEXT: Name: NoDefinition
54 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 10 }
54 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 5, Column: 10 }
5555 ; YAML-NEXT: Function: baz
5656 ; YAML-NEXT: Hotness: 30
5757 ; YAML-NEXT: Args:
5858 ; YAML-NEXT: - Callee: foo
5959 ; YAML-NEXT: - String: ' will not be inlined into '
6060 ; YAML-NEXT: - Caller: baz
61 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 }
61 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 4, Column: 0 }
6262 ; YAML-NEXT: - String: ' because its definition is unavailable'
6363 ; YAML-NEXT: ...
6464 ; YAML-NEXT: --- !Missed
6565 ; YAML-NEXT: Pass: inline
6666 ; YAML-NEXT: Name: NoDefinition
67 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 5, Column: 18 }
67 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 5, Column: 18 }
6868 ; YAML-NEXT: Function: baz
6969 ; YAML-NEXT: Hotness: 30
7070 ; YAML-NEXT: Args:
7171 ; YAML-NEXT: - Callee: bar
7272 ; YAML-NEXT: - String: ' will not be inlined into '
7373 ; YAML-NEXT: - Caller: baz
74 ; YAML-NEXT: DebugLoc: { File: /tmp/s.c, Line: 4, Column: 0 }
74 ; YAML-NEXT: DebugLoc: { File: '/tmp/s.c', Line: 4, Column: 0 }
7575 ; YAML-NEXT: - String: ' because its definition is unavailable'
7676 ; YAML-NEXT: ...
7777
25422542 // Single quote
25432543 TestEscaped("@abc@", "'@abc@'");
25442544 // No quote
2545 TestEscaped("abc/", "abc/");
2545 TestEscaped("abc", "abc");
2546 // Forward slash quoted
2547 TestEscaped("abc/", "'abc/'");
25462548 // Double quote non-printable
25472549 TestEscaped("\01@abc@", "\"\\x01@abc@\"");
25482550 // Double quote inside single quote