[PATCH] D42254: Add optional DICompileUnit to DIBuilder and make outlined debug info use that CU

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 11:44:21 PST 2018


aprantl added inline comments.


================
Comment at: lib/CodeGen/MachineOutliner.cpp:1288-1295
+      DISubprogram *SP = DB->createFunction(
+          Unit /* Context */, F->getName(),
+          StringRef() /* Empty linkage name. */, Unit /* File */,
+          0 /* Line numbers don't matter*/,
+          DB->createSubroutineType(DB->getOrCreateTypeArray(None)), /* void */
+          false, true, 0, /* Line in scope doesn't matter*/
+          DINode::DIFlags::FlagArtificial /* Compiler-generated code. */,
----------------
dblaikie wrote:
> Any chance of cloning the DISubprogram from the original function, then modifying it? Or does it seem better to create a separate one like this? I guess this is fine (Adrian?)
Since it will be a distinct MDNode modifying the clone is technically legal, but I don't consider it good practice. I think this approach is cleaner and easier to understand.


https://reviews.llvm.org/D42254





More information about the llvm-commits mailing list