summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorKristina Brooks <kristina@nym.hush.com>2018-10-19 12:14:30 +0000
committerKristina Brooks <kristina@nym.hush.com>2018-10-19 12:14:30 +0000
commit1a41a116ece742058c799299d1bf73f1d9626905 (patch)
tree0bc753092319a86b8f5907fc8a6b68a7eaf6e8fa /llvm/lib/MC/MCParser/AsmParser.cpp
parent22bad0497e46492c09994c0042d47a976b5eda82 (diff)
downloadbcm5719-llvm-1a41a116ece742058c799299d1bf73f1d9626905.tar.gz
bcm5719-llvm-1a41a116ece742058c799299d1bf73f1d9626905.zip
[MC][DWARF][AsmParser] Ensure nested CFI frames are diagnosed.
This avoids a crash (with asserts) or bad codegen (without asserts) in Dwarf streamer later on. This patch fixes this condition in MCStreamer and propogates SMLoc down when it's available with an added bonus of source locations for those specific types of errors. Further patches could use similar improvements as currently most non-Windows CFI directives lack an SMLoc parameter. Modified an existing test to verify source location propogation and added an object-file version of it to verify that it does not crash in addition to a standalone test to only ensure it does not crash. Differential Revision: https://reviews.llvm.org/D51695 llvm-svn: 344781
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 6eb7fd0d0b6..529f16525fe 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3919,8 +3919,13 @@ bool AsmParser::parseDirectiveCFIStartProc() {
parseToken(AsmToken::EndOfStatement))
return addErrorSuffix(" in '.cfi_startproc' directive");
}
-
- getStreamer().EmitCFIStartProc(!Simple.empty());
+
+ // TODO(kristina): Deal with a corner case of incorrect diagnostic context
+ // being produced if this directive is emitted as part of preprocessor macro
+ // expansion which can *ONLY* happen if Clang's cc1as is the API consumer.
+ // Tools like llvm-mc on the other hand are not affected by it, and report
+ // correct context information.
+ getStreamer().EmitCFIStartProc(!Simple.empty(), Lexer.getLoc());
return false;
}
OpenPOWER on IntegriCloud