diff options
Diffstat (limited to 'llvm/lib/MC/MCParser/DarwinAsmParser.cpp')
-rw-r--r-- | llvm/lib/MC/MCParser/DarwinAsmParser.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp index 926483451259..3bc13012c019 100644 --- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp @@ -23,6 +23,7 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/SectionKind.h" +#include "llvm/Support/Error.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SMLoc.h" @@ -689,15 +690,12 @@ bool DarwinAsmParser::parseDirectiveSection(StringRef, SMLoc) { unsigned StubSize; unsigned TAA; bool TAAParsed; - std::string ErrorStr = - MCSectionMachO::ParseSectionSpecifier(SectionSpec, Segment, Section, - TAA, TAAParsed, StubSize); - - if (!ErrorStr.empty()) - return Error(Loc, ErrorStr); + if (class Error E = MCSectionMachO::ParseSectionSpecifier( + SectionSpec, Segment, Section, TAA, TAAParsed, StubSize)) + return Error(Loc, toString(std::move(E))); // Issue a warning if the target is not powerpc and Section is a *coal* section. - Triple TT = getParser().getContext().getObjectFileInfo()->getTargetTriple(); + Triple TT = getParser().getContext().getTargetTriple(); Triple::ArchType ArchTy = TT.getArch(); if (ArchTy != Triple::ppc && ArchTy != Triple::ppc64) { @@ -778,8 +776,9 @@ bool DarwinAsmParser::parseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) { raw_fd_ostream *OS = getContext().getSecureLog(); if (!OS) { std::error_code EC; - auto NewOS = std::make_unique<raw_fd_ostream>( - StringRef(SecureLogFile), EC, sys::fs::OF_Append | sys::fs::OF_Text); + auto NewOS = std::make_unique<raw_fd_ostream>(StringRef(SecureLogFile), EC, + sys::fs::OF_Append | + sys::fs::OF_TextWithCRLF); if (EC) return Error(IDLoc, Twine("can't open secure log file: ") + SecureLogFile + " (" + EC.message() + ")"); @@ -1092,7 +1091,7 @@ bool DarwinAsmParser::parseSDKVersion(VersionTuple &SDKVersion) { void DarwinAsmParser::checkVersion(StringRef Directive, StringRef Arg, SMLoc Loc, Triple::OSType ExpectedOS) { - const Triple &Target = getContext().getObjectFileInfo()->getTargetTriple(); + const Triple &Target = getContext().getTargetTriple(); if (Target.getOS() != ExpectedOS) Warning(Loc, Twine(Directive) + (Arg.empty() ? Twine() : Twine(' ') + Arg) + |