From 9a561aa34c8f2553cb2ce1df5c3922594842148d Mon Sep 17 00:00:00 2001 From: Mandeep Singh Grang Date: Tue, 6 Dec 2016 02:49:17 +0000 Subject: [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 --- llvm/lib/MC/MCContext.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'llvm/lib/MC/MCContext.cpp') diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index afe8ee84918..8298aff928c 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -260,20 +260,11 @@ MCSymbol *MCContext::lookupSymbol(const Twine &Name) const { return Symbols.lookup(NameRef); } -int MCContext::setSymbolValue(MCStreamer &Streamer, std::string &I) { - auto Pair = StringRef(I).split('='); - if (Pair.second.empty()) { - errs() << "error: defsym must be of the form: sym=value: " << I << "\n"; - return 1; - } - int64_t Value; - if (Pair.second.getAsInteger(0, Value)) { - errs() << "error: Value is not an integer: " << Pair.second << "\n"; - return 1; - } - auto Symbol = getOrCreateSymbol(Pair.first); - Streamer.EmitAssignment(Symbol, MCConstantExpr::create(Value, *this)); - return 0; +void MCContext::setSymbolValue(MCStreamer &Streamer, + StringRef Sym, + uint64_t Val) { + auto Symbol = getOrCreateSymbol(Sym); + Streamer.EmitAssignment(Symbol, MCConstantExpr::create(Val, *this)); } //===----------------------------------------------------------------------===// -- cgit v1.2.3