summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-02-22 21:03:33 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-02-22 21:03:33 +0000
commit70def12a967508c93ed466af80b77031e522d796 (patch)
tree3ce9b4efb62aa8cb833ce5b6521d9a70d9e7d048 /llvm/lib/MC/MCParser/AsmParser.cpp
parentfd6fcbc0063876e14cbb52bac2902d570b4e28b2 (diff)
downloadbcm5719-llvm-70def12a967508c93ed466af80b77031e522d796.tar.gz
bcm5719-llvm-70def12a967508c93ed466af80b77031e522d796.zip
[DWARFv5] Turn an assert into a diagnostic. Hand-coded assembler files
should not trigger assertions. Differential Revision: https://reviews.llvm.org/D43152 llvm-svn: 325831
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index e86e0d657dc..8ede318e0e1 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3254,7 +3254,6 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
// FIXME: I'm not sure what this is.
int64_t FileNumber = -1;
- SMLoc FileNumberLoc = getLexer().getLoc();
if (getLexer().is(AsmToken::Integer)) {
FileNumber = getTok().getIntVal();
Lex();
@@ -3321,9 +3320,13 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
// we turn off -g option, directly use the existing debug info instead.
if (getContext().getGenDwarfForAssembly())
getContext().setGenDwarfForAssembly(false);
- else if (getStreamer().EmitDwarfFileDirective(FileNumber, Directory,
- Filename, CKMem) == 0)
- return Error(FileNumberLoc, "file number already allocated");
+ else {
+ Expected<unsigned> FileNumOrErr = getStreamer().tryEmitDwarfFileDirective(
+ FileNumber, Directory, Filename, CKMem);
+ if (!FileNumOrErr)
+ return Error(DirectiveLoc, toString(FileNumOrErr.takeError()));
+ FileNumber = FileNumOrErr.get();
+ }
}
return false;
OpenPOWER on IntegriCloud