@@ -40,6 +40,18 @@ using namespace llvm;
40
40
41
41
#define DEBUG_TYPE " clone-function"
42
42
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
+
43
55
// / See comments in Cloning.h.
44
56
BasicBlock *llvm::CloneBasicBlock (const BasicBlock *BB, ValueToValueMapTy &VMap,
45
57
const Twine &NameSuffix, Function *F,
@@ -146,12 +158,7 @@ DISubprogram *llvm::CollectDebugInfoForCloning(const Function &F,
146
158
if (SPClonedWithinModule)
147
159
DIFinder.processSubprogram (SPClonedWithinModule);
148
160
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);
155
162
156
163
return SPClonedWithinModule;
157
164
}
0 commit comments