summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Stannard <oliver.stannard@arm.com>2016-07-26 14:24:43 +0000
committerOliver Stannard <oliver.stannard@arm.com>2016-07-26 14:24:43 +0000
commit1c6e5914576acfcf6234359a1a2a239841e75f2f (patch)
treec445ed1500554cd0e1149c6d5cec845de520067d
parent2171828a49c7abaf959ae71d7fe65929c75970fb (diff)
downloadbcm5719-llvm-1c6e5914576acfcf6234359a1a2a239841e75f2f.tar.gz
bcm5719-llvm-1c6e5914576acfcf6234359a1a2a239841e75f2f.zip
[ARM] Improve error messages for .arch_extension directive
- More informative message when extension name is not an identifier token. - Stop parsing directive if extension is unknown (avoid duplicate error messages). - Report unsupported extensions with a source location, rather than report_fatal_error. Differential Revision: https://reviews.llvm.org/D22806 llvm-svn: 276748
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp12
-rw-r--r--llvm/test/MC/ARM/directive-arch_extension-unsupported.s25
2 files changed, 33 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 41379f0f190..9f7fb0612fe 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -10505,7 +10505,7 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L) {
MCAsmParser &Parser = getParser();
if (getLexer().isNot(AsmToken::Identifier)) {
- Error(getLexer().getLoc(), "unexpected token");
+ Error(getLexer().getLoc(), "expected architecture extension name");
Parser.eatToEndOfStatement();
return false;
}
@@ -10520,15 +10520,19 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L) {
Name = Name.substr(2);
}
unsigned FeatureKind = ARM::parseArchExt(Name);
- if (FeatureKind == ARM::AEK_INVALID)
+ if (FeatureKind == ARM::AEK_INVALID) {
Error(ExtLoc, "unknown architectural extension: " + Name);
+ return false;
+ }
for (const auto &Extension : Extensions) {
if (Extension.Kind != FeatureKind)
continue;
- if (Extension.Features.none())
- report_fatal_error("unsupported architectural extension: " + Name);
+ if (Extension.Features.none()) {
+ Error(ExtLoc, "unsupported architectural extension: " + Name);
+ return false;
+ }
if ((getAvailableFeatures() & Extension.ArchCheck) != Extension.ArchCheck) {
Error(ExtLoc, "architectural extension '" + Name + "' is not "
diff --git a/llvm/test/MC/ARM/directive-arch_extension-unsupported.s b/llvm/test/MC/ARM/directive-arch_extension-unsupported.s
new file mode 100644
index 00000000000..0e959b51d4d
--- /dev/null
+++ b/llvm/test/MC/ARM/directive-arch_extension-unsupported.s
@@ -0,0 +1,25 @@
+@ RUN: not llvm-mc -triple armv7--none-eabi -filetype asm -o /dev/null 2>&1 %s | FileCheck %s
+
+ .arch_extension os
+CHECK: error: unsupported architectural extension: os
+
+ .arch_extension iwmmxt
+CHECK: error: unsupported architectural extension: iwmmxt
+
+ .arch_extension iwmmxt2
+CHECK: error: unsupported architectural extension: iwmmxt2
+
+ .arch_extension maverick
+CHECK: error: unsupported architectural extension: maverick
+
+ .arch_extension xscale
+CHECK: error: unsupported architectural extension: xscale
+
+ .arch_extension invalid_extension_name
+CHECK: error: unknown architectural extension: invalid_extension_name
+
+ .arch_extension 42
+CHECK: error: expected architecture extension name
+
+ .arch_extension
+CHECK: error: expected architecture extension name
OpenPOWER on IntegriCloud