@@ -40,6 +40,18 @@ using namespace llvm;
4040
4141#define DEBUG_TYPE " clone-function"
4242
43+ namespace {
44+ void collectDebugInfoFromInstructions (const Function &F,
45+ DebugInfoFinder &DIFinder) {
46+ const Module *M = F.getParent ();
47+ if (M) {
48+ // Inspect instructions to process e.g. DILexicalBlocks of inlined functions
49+ for (const auto &I : instructions (F))
50+ DIFinder.processInstruction (*M, I);
51+ }
52+ }
53+ } // namespace
54+
4355// / See comments in Cloning.h.
4456BasicBlock *llvm::CloneBasicBlock (const BasicBlock *BB, ValueToValueMapTy &VMap,
4557 const Twine &NameSuffix, Function *F,
@@ -146,12 +158,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
146158 if (SPClonedWithinModule)
147159 DIFinder.processSubprogram (SPClonedWithinModule);
148160
149- const Module *M = F.getParent ();
150- if (M) {
151- // Inspect instructions to process e.g. DILexicalBlocks of inlined functions
152- for (const auto &I : instructions (F))
153- DIFinder.processInstruction (*M, I);
154- }
161+ collectDebugInfoFromInstructions (F, DIFinder);
155162
156163 return SPClonedWithinModule;
157164}
0 commit comments