summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-06-14 13:38:20 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-06-14 13:38:20 +0000
commitcc7344aae353493758a02a43d8c125ebfe500176 (patch)
tree217d1c604bcecd92149ba7cd93faa8d2e847ad4b /llvm/lib/MC/MCParser/AsmParser.cpp
parent767e1521656a834da28a723134dd5f344e9dbd70 (diff)
downloadbcm5719-llvm-cc7344aae353493758a02a43d8c125ebfe500176.tar.gz
bcm5719-llvm-cc7344aae353493758a02a43d8c125ebfe500176.zip
[DWARFv5] Tolerate files not all having an MD5 checksum.
In some cases, for example when compiling a preprocessed file, the front-end is not able to provide an MD5 checksum for all files. When that happens, omit the MD5 checksums from the final DWARF, because DWARF doesn't have a way to indicate that some but not all files have a checksum. When assembling a .s file, and some but not all .file directives provide an MD5 checksum, issue a warning and don't emit MD5 into the DWARF. Fixes PR37623. Differential Revision: https://reviews.llvm.org/D48135 llvm-svn: 334710
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 5c8946b286b..39922611e0e 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -177,6 +177,9 @@ private:
/// Are we parsing ms-style inline assembly?
bool ParsingInlineAsm = false;
+ /// Did we already inform the user about inconsistent MD5 usage?
+ bool ReportedInconsistentMD5 = false;
+
public:
AsmParser(SourceMgr &SM, MCContext &Ctx, MCStreamer &Out,
const MCAsmInfo &MAI, unsigned CB);
@@ -3337,7 +3340,11 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
// In case there is a -g option as well as debug info from directive .file,
// we turn off the -g option, directly use the existing debug info instead.
- getContext().setGenDwarfForAssembly(false);
+ // Also reset any implicit ".file 0" for the assembler source.
+ if (Ctx.getGenDwarfForAssembly()) {
+ Ctx.getMCDwarfLineTable(0).resetRootFile();
+ Ctx.setGenDwarfForAssembly(false);
+ }
if (FileNumber == -1)
getStreamer().EmitFileDirective(Filename);
@@ -3364,6 +3371,12 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
return Error(DirectiveLoc, toString(FileNumOrErr.takeError()));
FileNumber = FileNumOrErr.get();
}
+ // Alert the user if there are some .file directives with MD5 and some not.
+ // But only do that once.
+ if (!ReportedInconsistentMD5 && !Ctx.isDwarfMD5UsageConsistent(0)) {
+ ReportedInconsistentMD5 = true;
+ return Warning(DirectiveLoc, "inconsistent use of MD5 checksums");
+ }
}
return false;
OpenPOWER on IntegriCloud