diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-10-28 11:10:07 -0700 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2019-10-28 12:50:46 -0700 |
commit | 209d5a12c55fe674686b5dbff8ba59cad665a56a (patch) | |
tree | df84e93967d8462a58b08c9bd04217d6c7e60d9f /llvm/lib/CodeGen | |
parent | a51fc8ddf8800ed2f28d1e18b995e6c42f0bd3af (diff) | |
download | bcm5719-llvm-209d5a12c55fe674686b5dbff8ba59cad665a56a.tar.gz bcm5719-llvm-209d5a12c55fe674686b5dbff8ba59cad665a56a.zip |
[Remarks] Emit the remarks section by default for certain formats
Emit a remarks section by default for the following formats:
* bitstream
* yaml-strtab
while still providing -remarks-section=<bool> to override the defaults.
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 3692a03c268..b784d2980cb 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -146,11 +146,6 @@ static const char *const CodeViewLineTablesGroupDescription = STATISTIC(EmittedInsts, "Number of machine instrs printed"); -static cl::opt<bool> EnableRemarksSection( - "remarks-section", - cl::desc("Emit a section containing remark diagnostics metadata"), - cl::init(false)); - char AsmPrinter::ID = 0; using gcp_map_type = DenseMap<GCStrategy *, std::unique_ptr<GCMetadataPrinter>>; @@ -1365,14 +1360,14 @@ void AsmPrinter::emitGlobalIndirectSymbol(Module &M, } } -void AsmPrinter::emitRemarksSection(Module &M) { - RemarkStreamer *RS = M.getContext().getRemarkStreamer(); - if (!RS) +void AsmPrinter::emitRemarksSection(RemarkStreamer &RS) { + if (!RS.needsSection()) return; - remarks::RemarkSerializer &RemarkSerializer = RS->getSerializer(); + + remarks::RemarkSerializer &RemarkSerializer = RS.getSerializer(); Optional<SmallString<128>> Filename; - if (Optional<StringRef> FilenameRef = RS->getFilename()) { + if (Optional<StringRef> FilenameRef = RS.getFilename()) { Filename = *FilenameRef; sys::fs::make_absolute(*Filename); assert(!Filename->empty() && "The filename can't be empty."); @@ -1427,8 +1422,8 @@ bool AsmPrinter::doFinalization(Module &M) { // Emit the remarks section contents. // FIXME: Figure out when is the safest time to emit this section. It should // not come after debug info. - if (EnableRemarksSection) - emitRemarksSection(M); + if (RemarkStreamer *RS = M.getContext().getRemarkStreamer()) + emitRemarksSection(*RS); const TargetLoweringObjectFile &TLOF = getObjFileLowering(); |