[PATCH] D31315: Record command lines in objects built by clang, LLVM part
Zhizhou Yang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 17:42:29 PDT 2017
zhizhouy created this revision.
Herald added a subscriber: mehdi_amini.
This patch is the LLVM part of the differential:
name <https://reviews.llvm.org/D30760>
If -grecord-gcc-switches is set, DW_AT_producer will be combination of DICompileUnit::Producer and Flags.
Also considering if it is good to create a new dwarf variable like DW_AT_flags to store the command line options.
Since on Darwin, it will create a DW_AT_APPLE_flags to store options.
https://reviews.llvm.org/D31315
Files:
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -423,7 +423,13 @@
Asm->OutStreamer->getContext().setMCLineTableCompilationDir(
NewCU.getUniqueID(), CompilationDir);
- NewCU.addString(Die, dwarf::DW_AT_producer, DIUnit->getProducer());
+ StringRef Producer = DIUnit->getProducer();
+ StringRef Flags = DIUnit->getFlags();
+ if (!Flags.empty())
+ Producer = StringRef(Producer.str() + " " + Flags.str());
+
+ NewCU.addString(Die, dwarf::DW_AT_producer, Producer);
+
NewCU.addUInt(Die, dwarf::DW_AT_language, dwarf::DW_FORM_data2,
DIUnit->getSourceLanguage());
NewCU.addString(Die, dwarf::DW_AT_name, FN);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31315.92887.patch
Type: text/x-patch
Size: 802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170324/49e58cdb/attachment.bin>
More information about the llvm-commits
mailing list