aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Basic/SourceManagerTest.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2022-10-04 12:34:31 -0700
committerEllis Hoag <ellis.sparky.hoag@gmail.com>2022-10-05 09:19:12 -0700
commit549773f9e98f9c5895f4cc461a7fb1dbdb216af8 (patch)
tree6c89c2e7ed87f2f3f07d4eea03552625b10aabba /clang/unittests/Basic/SourceManagerTest.cpp
parent083617afc297f9d62a926fe8decbd9f616bd1b60 (diff)
downloadllvm-549773f9e98f9c5895f4cc461a7fb1dbdb216af8.zip
llvm-549773f9e98f9c5895f4cc461a7fb1dbdb216af8.tar.gz
llvm-549773f9e98f9c5895f4cc461a7fb1dbdb216af8.tar.bz2
[Dwarf] Reference the correct CU when inlining
Sometimes when a function is inlined into a different CU, `llvm-dwarfdump --verify` would find an inlined subroutine with an invalid abstract origin. This is because `DwarfUnit::addDIEEntry()` will incorrectly assume the inlined subroutine and the abstract origin are from the same CU if it can't find the CU for the inlined subroutine. In the added test, the inlined subroutine for `bar()` is created before the CU for `B.swift` is created, so it tries to point to `goo()` in the wrong CU. Interestingly, if we swap the order of the two functions then we don't see a crash since the module for `goo()` is created first. The fix is to give a parent DIE to `ScopeDIE` before calling `addDIEEntry()` so that its CU can be found. Luckily, `constructInlinedScopeDIE()` is only called once so we can pass it the DIE of the scope's parent and give it a child just after it's created. `constructInlinedScopeDIE()` should always return a DIE, so assert that it is not null. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D135114
Diffstat (limited to 'clang/unittests/Basic/SourceManagerTest.cpp')
0 files changed, 0 insertions, 0 deletions