|
48 | 48 | #include "clang/Basic/SourceManager.h" |
49 | 49 | #include "clang/Basic/TargetInfo.h" |
50 | 50 | #include "clang/Frontend/CompilerInstance.h" |
| 51 | +#include "clang/Lex/HeaderSearchOptions.h" |
| 52 | +#include "clang/Lex/Preprocessor.h" |
51 | 53 | #include "clang/Serialization/ASTReader.h" |
52 | 54 | #include "llvm/ADT/StringSet.h" |
53 | 55 | #include "llvm/Config/config.h" |
@@ -404,7 +406,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { |
404 | 406 | auto *CS = DS->InlinedCallSite; |
405 | 407 | if (!CS) |
406 | 408 | return nullptr; |
407 | | - |
| 409 | + |
408 | 410 | auto CachedInlinedAt = InlinedAtCache.find(CS); |
409 | 411 | if (CachedInlinedAt != InlinedAtCache.end()) |
410 | 412 | return cast<llvm::MDNode>(CachedInlinedAt->second); |
@@ -769,6 +771,15 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { |
769 | 771 | uint64_t Signature = |
770 | 772 | Desc.getSignature() ? Desc.getSignature().truncatedValue() : ~1ULL; |
771 | 773 |
|
| 774 | + // Clang modules using fmodule-file-home-is-cwd should have their |
| 775 | + // include path set to the working directory. |
| 776 | + auto &HSI = |
| 777 | + CI.getClangPreprocessor().getHeaderSearchInfo().getHeaderSearchOpts(); |
| 778 | + if (HSI.ModuleFileHomeIsCwd) { |
| 779 | + Desc = ASTSourceDescriptor(Desc.getModuleName(), Opts.DebugCompilationDir, |
| 780 | + Desc.getASTFile(), Desc.getSignature()); |
| 781 | + } |
| 782 | + |
772 | 783 | // Handle Clang modules. |
773 | 784 | if (ClangModule) { |
774 | 785 | llvm::DIModule *Parent = nullptr; |
@@ -1308,7 +1319,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { |
1308 | 1319 | } |
1309 | 1320 | // FIXME: assert that SizeInBits == OffsetInBits. |
1310 | 1321 | SizeInBits = OffsetInBits; |
1311 | | - |
| 1322 | + |
1312 | 1323 | auto FwdDecl = llvm::TempDINode(DBuilder.createReplaceableCompositeType( |
1313 | 1324 | llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, MainFile, 0, |
1314 | 1325 | llvm::dwarf::DW_LANG_Swift, SizeInBits, AlignInBits, Flags, |
@@ -1561,7 +1572,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { |
1561 | 1572 | return createPointerSizedStruct(Scope, |
1562 | 1573 | MangledName, |
1563 | 1574 | MainFile, 0, Flags, MangledName); |
1564 | | - |
| 1575 | + |
1565 | 1576 | case TypeKind::BuiltinTuple: |
1566 | 1577 | llvm_unreachable("BuiltinTupleType should not show up here"); |
1567 | 1578 |
|
@@ -1818,7 +1829,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo { |
1818 | 1829 | return true; |
1819 | 1830 | } |
1820 | 1831 | #endif |
1821 | | - |
| 1832 | + |
1822 | 1833 | llvm::DIType *getOrCreateType(DebugTypeInfo DbgTy) { |
1823 | 1834 | // Is this an empty type? |
1824 | 1835 | if (DbgTy.isNull()) |
|
0 commit comments