Debug Info: Create artificial functions in a virtual file <compiler-generated>.

For the majority of artificial helper functions the filename is
actively misleading since it usually represents the file of the caller
that triggered the helper to be generated. Instead, this patch creates
a virtual filname `<compiler-generated>` to make it very obvious that
the function has not correspondence to any source code.

<rdar://problem/33809560>
This commit is contained in:
Adrian Prantl
2018-01-12 10:29:58 -08:00
parent c74ae5f375
commit b4781f63ef
5 changed files with 42 additions and 29 deletions

View File

@@ -70,7 +70,7 @@ func foo(_ a: Int64, _ b: Int64) -> Int64 {
// CHECK-DAG: ![[FILE_CWD:[0-9]+]] = !DIFile(filename: "{{.*}}DebugInfo/basic.swift", directory: "{{.*}}")
// CHECK-DAG: ![[MAINFILE:[0-9]+]] = !DIFile(filename: "basic.swift", directory: "{{.*}}DebugInfo")
// CHECK-DAG: !DICompileUnit(language: DW_LANG_Swift, file: ![[FILE_CWD]],{{.*}} producer: "{{.*}}Swift version{{.*}},{{.*}} flags: "{{[^"]*}}-emit-ir
// CHECK-DAG: !DISubprogram(name: "main"
// CHECK-DAG: !DISubprogram(name: "main", {{.*}}file: ![[MAINFILE]],
// Function type for foo.
// CHECK-DAG: ![[FOOTYPE]] = !DISubroutineType(types: ![[PARAMTYPES:[0-9]+]])