This is an archive of the discontinued LLVM Phabricator instance.

Record command lines in objects built by clang, LLVM part
ClosedPublic

Authored by zhizhouy on Mar 23 2017, 5:42 PM.

Details

Summary

This patch is the LLVM part of the differential:
Link

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.

Diff Detail

Event Timeline

zhizhouy created this revision.Mar 23 2017, 5:42 PM

Thanks for working on this!

Please add one or more tests for this new behavior.

lib/CodeGen/AsmPrinter/DwarfDebug.cpp
429

Looks like we're creating a StringRef to a temporary string here, which will give us undefined behavior when we use it on line 431. Please see http://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringref-h .

aprantl edited edge metadata.Mar 24 2017, 9:27 AM

This needs a testcase.

zhizhouy updated this revision to Diff 93002.Mar 24 2017, 1:55 PM
zhizhouy marked an inline comment as done.

Fixed StringRef related problem.

Added a testcase for it.

zhizhouy updated this revision to Diff 93402.Mar 29 2017, 1:06 PM
zhizhouy edited the summary of this revision. (Show Details)

Moved test into test/DebugInfo/X86.

echristo accepted this revision.Mar 29 2017, 4:37 PM

LGTM.

This revision is now accepted and ready to land.Mar 29 2017, 4:37 PM

Committed thusly:

echristo@athyra ~/s/llvm> git svn dcommit
Committing to https://llvm.org/svn/llvm-project/llvm/trunk ...
A test/DebugInfo/X86/debug-info-producer-with-flags.ll
M lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Committed r299038

(Committed as noted by echristo; just trying to clean my queue a bit. :) )