ModuleDebugInfo.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Test that (the same) debug info is emitted for an Objective-C++
  2. // module and a C++ precompiled header.
  3. // REQUIRES: asserts, shell
  4. // Modules:
  5. // RUN: rm -rf %t
  6. // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll
  7. // RUN: cat %t-mod.ll | FileCheck %s
  8. // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s
  9. // PCH:
  10. // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll
  11. // RUN: cat %t-pch.ll | FileCheck %s
  12. // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s
  13. #ifdef MODULES
  14. @import DebugCXX;
  15. #endif
  16. // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
  17. // CHECK-SAME: isOptimized: false,
  18. // CHECK-NOT: splitDebugFilename:
  19. // CHECK-SAME: dwoId:
  20. // CHECK-SAME: )
  21. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum"
  22. // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE")
  23. // CHECK: !DINamespace(name: "DebugCXX"
  24. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
  25. // CHECK-NOT: name:
  26. // CHECK-SAME: )
  27. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
  28. // CHECK-NOT: name:
  29. // CHECK-SAME: )
  30. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
  31. // CHECK-NOT: name:
  32. // CHECK-SAME: identifier: "_ZTS11TypedefEnum")
  33. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
  34. // CHECK-NOT: name:
  35. // CHECK-SAME: )
  36. // CHECK: !DIEnumerator(name: "e5", value: 5)
  37. // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct"
  38. // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE")
  39. // CHECK: !DICompositeType(tag: DW_TAG_class_type,
  40. // CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >"
  41. // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE")
  42. // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>"
  43. // CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE")
  44. // CHECK: !DICompositeType(tag: DW_TAG_class_type,
  45. // CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >"
  46. // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE")
  47. // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdVirtual"
  48. // CHECK-SAME: elements:
  49. // CHECK-SAME: identifier: "_ZTS10FwdVirtual")
  50. // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$FwdVirtual"
  51. // CHECK: !DICompositeType(tag: DW_TAG_union_type,
  52. // CHECK-NOT: name:
  53. // CHECK-SAME: identifier: "_ZTS12TypedefUnion")
  54. // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
  55. // CHECK-NOT: name:
  56. // CHECK-SAME: identifier: "_ZTS13TypedefStruct")
  57. // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstatiation"
  58. // no mangled name here yet.
  59. // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B",
  60. // no mangled name here yet.
  61. // CHECK: !DICompositeType(tag: DW_TAG_union_type,
  62. // CHECK-NOT: name:
  63. // CHECK-SAME: )
  64. // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
  65. // CHECK-NOT: name:
  66. // CHECK-SAME: )
  67. // CHECK: !DICompositeType(tag: DW_TAG_structure_type,
  68. // CHECK-SAME: name: "InAnonymousNamespace",
  69. // CHECK-SAME: elements: !{{[0-9]+}})
  70. // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl"