summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorMandeep Singh Grang <mgrang@codeaurora.org>2016-12-06 02:49:17 +0000
committerMandeep Singh Grang <mgrang@codeaurora.org>2016-12-06 02:49:17 +0000
commit9a561aa34c8f2553cb2ce1df5c3922594842148d (patch)
tree9c9f5b156b04b3dfda9fa21da59e39d2251db450 /llvm/tools
parent6d1d36c4b7c3b2292f77008685eee23ea48f7903 (diff)
downloadbcm5719-llvm-9a561aa34c8f2553cb2ce1df5c3922594842148d.tar.gz
bcm5719-llvm-9a561aa34c8f2553cb2ce1df5c3922594842148d.zip
[llvm] Fix D26214: Move error handling out of MC and to the callers.
Summary: Related clang patch; https://reviews.llvm.org/D27360 Reviewers: t.p.northover, grosbach, compnerd, echristo Subscribers: compnerd, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D27359 llvm-svn: 288763
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-mc/llvm-mc.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 8a904a8ad7c..497fb198776 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -394,9 +394,22 @@ static int AsLexInput(SourceMgr &SrcMgr, MCAsmInfo &MAI,
}
static int fillCommandLineSymbols(MCAsmParser &Parser) {
- for (auto &I: DefineSymbol)
- if (Parser.getContext().setSymbolValue(Parser.getStreamer(), I))
+ for (auto &I: DefineSymbol) {
+ auto Pair = StringRef(I).split('=');
+ auto Sym = Pair.first;
+ auto Val = Pair.second;
+
+ if (Sym.empty() || Val.empty()) {
+ errs() << "error: defsym must be of the form: sym=value: " << I << "\n";
+ return 1;
+ }
+ int64_t Value;
+ if (Val.getAsInteger(0, Value)) {
+ errs() << "error: Value is not an integer: " << Val << "\n";
return 1;
+ }
+ Parser.getContext().setSymbolValue(Parser.getStreamer(), Sym, Value);
+ }
return 0;
}
OpenPOWER on IntegriCloud