diff --git a/clang/test/CodeGen/split-debug-inlining-template.c b/clang/test/CodeGen/split-debug-inlining-template.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/split-debug-inlining-template.c @@ -0,0 +1,16 @@ +// Check that we handle template types for split-dwarf-inlining without ICE. +// RUN: %clang_cc1 -emit-obj -fdebug-info-for-profiling -fsplit-dwarf-inlining -debug-info-kind=constructor -dwarf-version=5 -split-dwarf-file %t.dwo -O2 -o %t.o -x c++ %s + +struct container { + int size(); +}; + +template +int Range(T &x) { + return x.size(); +} + +int main() { + container v; + return Range(v); +} diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp --- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp @@ -204,6 +204,7 @@ const DIE *p = this; while (p) { if (p->getTag() == dwarf::DW_TAG_compile_unit || + p->getTag() == dwarf::DW_TAG_skeleton_unit || p->getTag() == dwarf::DW_TAG_type_unit) return p; p = p->getParent();