[llvm] r358927 - Try to work around compile errors with older versions of GCC.
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 15:40:37 PDT 2019
Author: adrian
Date: Mon Apr 22 15:40:37 2019
New Revision: 358927
URL: http://llvm.org/viewvc/llvm-project?rev=358927&view=rev
Log:
Try to work around compile errors with older versions of GCC.
Modified:
llvm/trunk/tools/dsymutil/dsymutil.cpp
Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=358927&r1=358926&r2=358927&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Mon Apr 22 15:40:37 2019
@@ -280,6 +280,10 @@ static bool verify(llvm::StringRef Outpu
namespace {
struct OutputLocation {
+ OutputLocation(std::string DWARFFile, Optional<std::string> ResourceDir = {})
+ : DWARFFile(DWARFFile), ResourceDir(ResourceDir) {}
+ /// This method is a workaround for older compilers.
+ Optional<std::string> getResourceDir() const { return ResourceDir; }
std::string DWARFFile;
Optional<std::string> ResourceDir;
};
@@ -287,21 +291,21 @@ struct OutputLocation {
static Expected<OutputLocation> getOutputFileName(llvm::StringRef InputFile) {
if (OutputFileOpt == "-")
- return OutputLocation{OutputFileOpt, {}};
+ return OutputLocation(OutputFileOpt);
// When updating, do in place replacement.
if (OutputFileOpt.empty() && (Update || !SymbolMap.empty()))
- return OutputLocation{InputFile, {}};
+ return OutputLocation(InputFile);
// If a flat dSYM has been requested, things are pretty simple.
if (FlatOut) {
if (OutputFileOpt.empty()) {
if (InputFile == "-")
return OutputLocation{"a.out.dwarf", {}};
- return OutputLocation{(InputFile + ".dwarf").str(), {}};
+ return OutputLocation((InputFile + ".dwarf").str());
}
- return OutputLocation{OutputFileOpt, {}};
+ return OutputLocation(OutputFileOpt);
}
// We need to create/update a dSYM bundle.
@@ -325,7 +329,7 @@ static Expected<OutputLocation> getOutpu
llvm::sys::path::append(Path, "Contents", "Resources");
StringRef ResourceDir = Path;
llvm::sys::path::append(Path, "DWARF", llvm::sys::path::filename(DwarfFile));
- return OutputLocation{Path.str(), ResourceDir.str()};
+ return OutputLocation(Path.str(), ResourceDir.str());
}
/// Parses the command line options into the LinkOptions struct and performs
@@ -558,7 +562,7 @@ int main(int argc, char **argv) {
WithColor::error() << toString(OutputLocationOrErr.takeError());
return 1;
}
- OptionsOrErr->ResourceDir = OutputLocationOrErr->ResourceDir;
+ OptionsOrErr->ResourceDir = OutputLocationOrErr->getResourceDir();
std::string OutputFile = OutputLocationOrErr->DWARFFile;
if (NeedsTempFiles) {
More information about the llvm-commits
mailing list