diff options
Diffstat (limited to 'llvm/tools')
41 files changed, 131 insertions, 88 deletions
diff --git a/llvm/tools/bugpoint/ListReducer.h b/llvm/tools/bugpoint/ListReducer.h index 06f8ddb2..ceee853 100644 --- a/llvm/tools/bugpoint/ListReducer.h +++ b/llvm/tools/bugpoint/ListReducer.h @@ -32,7 +32,7 @@ template <typename ElTy> struct ListReducer { KeepPrefix // The prefix alone satisfies the predicate }; - virtual ~ListReducer() {} + virtual ~ListReducer() = default; /// This virtual function should be overriden by subclasses to implement the /// test desired. The testcase is only required to test to see if the Kept diff --git a/llvm/tools/bugpoint/ToolRunner.h b/llvm/tools/bugpoint/ToolRunner.h index c9da9af..9ff0663 100644 --- a/llvm/tools/bugpoint/ToolRunner.h +++ b/llvm/tools/bugpoint/ToolRunner.h @@ -105,7 +105,7 @@ public: createCustomExecutor(const char *Argv0, std::string &Message, const std::string &ExecCommandLine); - virtual ~AbstractInterpreter() {} + virtual ~AbstractInterpreter() = default; /// compileProgram - Compile the specified program from bitcode to executable /// code. This does not produce any output, it is only used when debugging diff --git a/llvm/tools/dsymutil/BinaryHolder.h b/llvm/tools/dsymutil/BinaryHolder.h index cb5bd95..27d7151 100644 --- a/llvm/tools/dsymutil/BinaryHolder.h +++ b/llvm/tools/dsymutil/BinaryHolder.h @@ -110,7 +110,7 @@ public: std::string Filename; TimestampTy Timestamp; - KeyTy() {} + KeyTy() = default; KeyTy(StringRef Filename, TimestampTy Timestamp) : Filename(Filename.str()), Timestamp(Timestamp) {} }; diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 7fee06b..017e210 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -305,7 +305,7 @@ public: this->CacheDir[this->CacheDir.size() - 1] != '/') this->CacheDir += '/'; } - ~LLIObjectCache() override {} + ~LLIObjectCache() override = default; void notifyObjectCompiled(const Module *M, MemoryBufferRef Obj) override { const std::string &ModuleID = M->getModuleIdentifier(); diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index 020b1b5..5300c5c 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -24,6 +24,7 @@ #include "llvm/Config/config.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Program.h" #include "llvm/Support/WithColor.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TargetParser/Triple.h" @@ -232,6 +233,7 @@ Options:\n\ --link-static Link the component libraries statically.\n\ --obj-root Print the object root used to build LLVM.\n\ --prefix Print the installation prefix.\n\ + --quote-paths Quote and escape paths when needed.\n\ --shared-mode Print how the provided components can be collectively linked (`shared` or `static`).\n\ --system-libs System Libraries needed to link against LLVM components.\n\ --targets-built List of all targets currently built.\n\ @@ -324,7 +326,7 @@ int main(int argc, char **argv) { // information. std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, ActiveCMakeDir; - std::string ActiveIncludeOption; + std::vector<std::string> ActiveIncludeOptions; if (IsInDevelopmentTree) { ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; ActivePrefix = CurrentExecPrefix; @@ -350,8 +352,8 @@ int main(int argc, char **argv) { } // We need to include files from both the source and object trees. - ActiveIncludeOption = - ("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include"); + ActiveIncludeOptions.push_back(ActiveIncludeDir); + ActiveIncludeOptions.push_back(ActiveObjRoot + "/include"); } else { ActivePrefix = CurrentExecPrefix; { @@ -370,7 +372,7 @@ int main(int argc, char **argv) { sys::path::make_absolute(ActivePrefix, Path); ActiveCMakeDir = std::string(Path); } - ActiveIncludeOption = "-I" + ActiveIncludeDir; + ActiveIncludeOptions.push_back(ActiveIncludeDir); } /// We only use `shared library` mode in cases where the static library form @@ -399,7 +401,9 @@ int main(int argc, char **argv) { llvm::replace(ActiveBinDir, '/', '\\'); llvm::replace(ActiveLibDir, '/', '\\'); llvm::replace(ActiveCMakeDir, '/', '\\'); - llvm::replace(ActiveIncludeOption, '/', '\\'); + llvm::replace(ActiveIncludeDir, '/', '\\'); + for (auto &Include : ActiveIncludeOptions) + llvm::replace(Include, '/', '\\'); } SharedDir = ActiveBinDir; StaticDir = ActiveLibDir; @@ -501,6 +505,32 @@ int main(int argc, char **argv) { }; raw_ostream &OS = outs(); + + // Check if we want quoting and escaping. + bool QuotePaths = std::any_of(&argv[0], &argv[argc], [](const char *Arg) { + return StringRef(Arg) == "--quote-paths"; + }); + + auto MaybePrintQuoted = [&](StringRef Str) { + if (QuotePaths) + sys::printArg(OS, Str, /*Quote=*/false); // only add quotes if necessary + else + OS << Str; + }; + + // Render include paths and associated flags + auto RenderFlags = [&](StringRef Flags) { + bool First = true; + for (auto &Include : ActiveIncludeOptions) { + if (!First) + OS << ' '; + std::string FlagsStr = "-I" + Include; + MaybePrintQuoted(FlagsStr); + First = false; + } + OS << ' ' << Flags << '\n'; + }; + for (int i = 1; i != argc; ++i) { StringRef Arg = argv[i]; @@ -509,24 +539,32 @@ int main(int argc, char **argv) { if (Arg == "--version") { OS << PACKAGE_VERSION << '\n'; } else if (Arg == "--prefix") { - OS << ActivePrefix << '\n'; + MaybePrintQuoted(ActivePrefix); + OS << '\n'; } else if (Arg == "--bindir") { - OS << ActiveBinDir << '\n'; + MaybePrintQuoted(ActiveBinDir); + OS << '\n'; } else if (Arg == "--includedir") { - OS << ActiveIncludeDir << '\n'; + MaybePrintQuoted(ActiveIncludeDir); + OS << '\n'; } else if (Arg == "--libdir") { - OS << ActiveLibDir << '\n'; + MaybePrintQuoted(ActiveLibDir); + OS << '\n'; } else if (Arg == "--cmakedir") { - OS << ActiveCMakeDir << '\n'; + MaybePrintQuoted(ActiveCMakeDir); + OS << '\n'; } else if (Arg == "--cppflags") { - OS << ActiveIncludeOption << ' ' << LLVM_CPPFLAGS << '\n'; + RenderFlags(LLVM_CPPFLAGS); } else if (Arg == "--cflags") { - OS << ActiveIncludeOption << ' ' << LLVM_CFLAGS << '\n'; + RenderFlags(LLVM_CFLAGS); } else if (Arg == "--cxxflags") { - OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; + RenderFlags(LLVM_CXXFLAGS); } else if (Arg == "--ldflags") { - OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L") - << ActiveLibDir << ' ' << LLVM_LDFLAGS << '\n'; + std::string LDFlags = + HostTriple.isWindowsMSVCEnvironment() ? "-LIBPATH:" : "-L"; + LDFlags += ActiveLibDir; + MaybePrintQuoted(LDFlags); + OS << ' ' << LLVM_LDFLAGS << '\n'; } else if (Arg == "--system-libs") { PrintSystemLibs = true; } else if (Arg == "--libs") { @@ -580,7 +618,8 @@ int main(int argc, char **argv) { } else if (Arg == "--shared-mode") { PrintSharedMode = true; } else if (Arg == "--obj-root") { - OS << ActivePrefix << '\n'; + MaybePrintQuoted(ActivePrefix); + OS << '\n'; } else if (Arg == "--ignore-libllvm") { LinkDyLib = false; LinkMode = BuiltSharedLibs ? LinkModeShared : LinkModeAuto; @@ -590,6 +629,8 @@ int main(int argc, char **argv) { LinkMode = LinkModeStatic; } else if (Arg == "--help") { usage(false); + } else if (Arg == "--quote-paths") { + // Was already handled above this loop. } else { usage(); } @@ -682,26 +723,30 @@ int main(int argc, char **argv) { auto PrintForLib = [&](const StringRef &Lib) { const bool Shared = LinkMode == LinkModeShared; + std::string LibFileName; if (PrintLibNames) { - OS << GetComponentLibraryFileName(Lib, Shared); + LibFileName = GetComponentLibraryFileName(Lib, Shared); } else if (PrintLibFiles) { - OS << GetComponentLibraryPath(Lib, Shared); + LibFileName = GetComponentLibraryPath(Lib, Shared); } else if (PrintLibs) { // On Windows, output full path to library without parameters. // Elsewhere, if this is a typical library name, include it using -l. if (HostTriple.isWindowsMSVCEnvironment()) { - OS << GetComponentLibraryPath(Lib, Shared); + LibFileName = GetComponentLibraryPath(Lib, Shared); } else { + LibFileName = "-l"; StringRef LibName; if (GetComponentLibraryNameSlice(Lib, LibName)) { // Extract library name (remove prefix and suffix). - OS << "-l" << LibName; + LibFileName += LibName; } else { // Lib is already a library name without prefix and suffix. - OS << "-l" << Lib; + LibFileName += Lib; } } } + if (!LibFileName.empty()) + MaybePrintQuoted(LibFileName); }; if (LinkMode == LinkModeShared && LinkDyLib) diff --git a/llvm/tools/llvm-cov/CoverageExporter.h b/llvm/tools/llvm-cov/CoverageExporter.h index 751e55d..ba946a1 100644 --- a/llvm/tools/llvm-cov/CoverageExporter.h +++ b/llvm/tools/llvm-cov/CoverageExporter.h @@ -37,7 +37,7 @@ protected: : Coverage(CoverageMapping), Options(Options), OS(OS) {} public: - virtual ~CoverageExporter(){}; + virtual ~CoverageExporter() = default; /// Render the CoverageMapping object. virtual void renderRoot(const CoverageFilters &IgnoreFilters) = 0; diff --git a/llvm/tools/llvm-cov/CoverageFilters.h b/llvm/tools/llvm-cov/CoverageFilters.h index 5345b0c..3cee23a 100644 --- a/llvm/tools/llvm-cov/CoverageFilters.h +++ b/llvm/tools/llvm-cov/CoverageFilters.h @@ -28,7 +28,7 @@ struct FunctionRecord; /// Matches specific functions that pass the requirement of this filter. class CoverageFilter { public: - virtual ~CoverageFilter() {} + virtual ~CoverageFilter() = default; /// Return true if the function passes the requirements of this filter. virtual bool matches(const coverage::CoverageMapping &CM, diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index 43fb890a..bde187e 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -122,7 +122,7 @@ public: static std::unique_ptr<CoveragePrinter> create(const CoverageViewOptions &Opts); - virtual ~CoveragePrinter() {} + virtual ~CoveragePrinter() = default; /// @name File Creation Interface /// @{ @@ -288,7 +288,7 @@ public: create(StringRef SourceName, const MemoryBuffer &File, const CoverageViewOptions &Options, CoverageData &&CoverageInfo); - virtual ~SourceCoverageView() {} + virtual ~SourceCoverageView() = default; /// Return the source name formatted for the host OS. std::string getSourceName() const; diff --git a/llvm/tools/llvm-diff/lib/DiffConsumer.h b/llvm/tools/llvm-diff/lib/DiffConsumer.h index 08c3afc..d4f339b 100644 --- a/llvm/tools/llvm-diff/lib/DiffConsumer.h +++ b/llvm/tools/llvm-diff/lib/DiffConsumer.h @@ -49,7 +49,7 @@ class StringRef; virtual void logd(const DiffLogBuilder &Log) = 0; protected: - virtual ~Consumer() {} + virtual ~Consumer() = default; }; class DiffConsumer : public Consumer { diff --git a/llvm/tools/llvm-diff/lib/DifferenceEngine.h b/llvm/tools/llvm-diff/lib/DifferenceEngine.h index 436a355..b829b2c 100644 --- a/llvm/tools/llvm-diff/lib/DifferenceEngine.h +++ b/llvm/tools/llvm-diff/lib/DifferenceEngine.h @@ -54,7 +54,7 @@ namespace llvm { virtual bool operator()(const Value *L, const Value *R) = 0; protected: - virtual ~Oracle() {} + virtual ~Oracle() = default; }; DifferenceEngine(Consumer &consumer) diff --git a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp index 2c13dd5..0e73ada 100644 --- a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp @@ -112,7 +112,7 @@ namespace { // Use X19 as the loop counter register since it's a callee-saved register // that's available for temporary use. -constexpr const MCPhysReg kDefaultLoopCounterReg = AArch64::X19; +constexpr MCPhysReg kDefaultLoopCounterReg = AArch64::X19; class ExegesisAArch64Target : public ExegesisTarget { public: diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index fb84328..f3bf9690 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -446,7 +446,7 @@ void Analysis::printClusterRawHtml(const BenchmarkClustering::ClusterId &Id, } // namespace exegesis -static constexpr const char kHtmlHead[] = R"( +static constexpr char kHtmlHead[] = R"( <head> <title>llvm-exegesis Analysis Results</title> <style> diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp index fd7924d..163f141 100644 --- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp +++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp @@ -44,8 +44,8 @@ namespace llvm { namespace exegesis { -static constexpr const char ModuleID[] = "ExegesisInfoTest"; -static constexpr const char FunctionID[] = "foo"; +static constexpr char ModuleID[] = "ExegesisInfoTest"; +static constexpr char FunctionID[] = "foo"; static const Align kFunctionAlignment(4096); // Fills the given basic block with register setup code, and returns true if diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 1823a53..c6164b6 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -21,9 +21,9 @@ #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" -static constexpr const char kIntegerPrefix[] = "i_0x"; -static constexpr const char kDoublePrefix[] = "f_"; -static constexpr const char kInvalidOperand[] = "INVALID"; +static constexpr char kIntegerPrefix[] = "i_0x"; +static constexpr char kDoublePrefix[] = "f_"; +static constexpr char kInvalidOperand[] = "INVALID"; namespace llvm { @@ -202,7 +202,7 @@ struct CustomMappingTraits<std::map<exegesis::ValidationEvent, int64_t>> { Io.setError("Key is not a valid validation event"); return; } - Io.mapRequired(KeyStr.str().c_str(), VI[*Key]); + Io.mapRequired(KeyStr, VI[*Key]); } static void output(IO &Io, std::map<exegesis::ValidationEvent, int64_t> &VI) { @@ -245,8 +245,8 @@ template <> struct SequenceElementTraits<exegesis::RegisterValue> { }; template <> struct ScalarTraits<exegesis::RegisterValue> { - static constexpr const unsigned kRadix = 16; - static constexpr const bool kSigned = false; + static constexpr unsigned kRadix = 16; + static constexpr bool kSigned = false; static void output(const exegesis::RegisterValue &RV, void *Ctx, raw_ostream &Out) { diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 1fd0a15..12fad7d 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -155,7 +155,7 @@ private: #ifdef LLVM_ON_UNIX // See "Exit Status for Commands": // https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html - constexpr const int kSigOffset = 128; + constexpr int kSigOffset = 128; return make_error<SnippetSignal>(CRC.RetCode - kSigOffset); #else // The exit code of the process on windows is not meaningful as a @@ -877,7 +877,7 @@ Error BenchmarkRunner::getValidationCountersToRun( return Error::success(); } -BenchmarkRunner::FunctionExecutor::~FunctionExecutor() {} +BenchmarkRunner::FunctionExecutor::~FunctionExecutor() = default; } // namespace exegesis } // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h index e688b81..16d3c9c 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -73,8 +73,8 @@ public: // Scratch space to run instructions that touch memory. struct ScratchSpace { - static constexpr const size_t kAlignment = 1024; - static constexpr const size_t kSize = 1 << 20; // 1MB. + static constexpr size_t kAlignment = 1024; + static constexpr size_t kSize = 1 << 20; // 1MB. ScratchSpace() : UnalignedPtr(std::make_unique<char[]>(kSize + kAlignment)), AlignedPtr( diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.h b/llvm/tools/llvm-exegesis/lib/Clustering.h index 9d6c110..2b0f5b4 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.h +++ b/llvm/tools/llvm-exegesis/lib/Clustering.h @@ -67,11 +67,11 @@ public: ClusterId(size_t Id, bool IsUnstable = false) : Id_(Id), IsUnstable_(IsUnstable) {} - static constexpr const size_t kMaxValid = + static constexpr size_t kMaxValid = (std::numeric_limits<size_t>::max() >> 1) - 4; - static constexpr const size_t kNoise = kMaxValid + 1; - static constexpr const size_t kError = kMaxValid + 2; - static constexpr const size_t kUndef = kMaxValid + 3; + static constexpr size_t kNoise = kMaxValid + 1; + static constexpr size_t kError = kMaxValid + 2; + static constexpr size_t kUndef = kMaxValid + 3; size_t Id_ : (std::numeric_limits<size_t>::digits - 1); size_t IsUnstable_ : 1; diff --git a/llvm/tools/llvm-exegesis/lib/Error.h b/llvm/tools/llvm-exegesis/lib/Error.h index 9b71fe8..c899023 100644 --- a/llvm/tools/llvm-exegesis/lib/Error.h +++ b/llvm/tools/llvm-exegesis/lib/Error.h @@ -81,7 +81,7 @@ private: struct PerfCounterNotFullyEnabled : public ErrorInfo<PerfCounterNotFullyEnabled> { static char ID; - PerfCounterNotFullyEnabled() {} + PerfCounterNotFullyEnabled() = default; void log(raw_ostream &OS) const override; diff --git a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp index 79a585e..aa40913 100644 --- a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp +++ b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.cpp @@ -350,7 +350,5 @@ ParallelSnippetGenerator::generateCodeTemplates( return Result; } -constexpr const size_t ParallelSnippetGenerator::kMinNumDifferentAddresses; - } // namespace exegesis } // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.h b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.h index 8a6b856..d3c85c0 100644 --- a/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.h +++ b/llvm/tools/llvm-exegesis/lib/ParallelSnippetGenerator.h @@ -28,7 +28,7 @@ public: generateCodeTemplates(InstructionTemplate Variant, const BitVector &ForbiddenRegisters) const override; - static constexpr const size_t kMinNumDifferentAddresses = 6; + static constexpr size_t kMinNumDifferentAddresses = 6; private: // Instantiates memory operands within a snippet. diff --git a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp index 80f5ce4..37dcc7c 100644 --- a/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp +++ b/llvm/tools/llvm-exegesis/lib/SnippetRepetitor.cpp @@ -131,7 +131,7 @@ private: } // namespace -SnippetRepetitor::~SnippetRepetitor() {} +SnippetRepetitor::~SnippetRepetitor() = default; std::unique_ptr<const SnippetRepetitor> SnippetRepetitor::Create(Benchmark::RepetitionModeE Mode, diff --git a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.h b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.h index 572d108..52ee980 100644 --- a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.h +++ b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.h @@ -32,8 +32,8 @@ namespace exegesis { class SubprocessMemory { public: - static constexpr const size_t AuxiliaryMemoryOffset = 1; - static constexpr const size_t AuxiliaryMemorySize = 4096; + static constexpr size_t AuxiliaryMemoryOffset = 1; + static constexpr size_t AuxiliaryMemorySize = 4096; // Gets the thread ID for the calling thread. static long getCurrentTID(); diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp index fc5f82f..2ad6c5a 100644 --- a/llvm/tools/llvm-exegesis/lib/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/Target.cpp @@ -23,7 +23,7 @@ cl::OptionCategory Options("llvm-exegesis options"); cl::OptionCategory BenchmarkOptions("llvm-exegesis benchmark options"); cl::OptionCategory AnalysisOptions("llvm-exegesis analysis options"); -ExegesisTarget::~ExegesisTarget() {} // anchor. +ExegesisTarget::~ExegesisTarget() = default; // anchor. static ExegesisTarget *FirstTarget = nullptr; @@ -215,7 +215,7 @@ const PfmCountersInfo &ExegesisTarget::getDummyPfmCounters() const { return PfmCountersInfo::Dummy; } -ExegesisTarget::SavedState::~SavedState() {} // anchor. +ExegesisTarget::SavedState::~SavedState() = default; // anchor. namespace { diff --git a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h index ef47b7f..74a18da 100644 --- a/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/UopsBenchmarkRunner.h @@ -30,7 +30,7 @@ public: ExecutionMode, ValCounters) {} ~UopsBenchmarkRunner() override; - static constexpr const size_t kMinNumDifferentAddresses = 6; + static constexpr size_t kMinNumDifferentAddresses = 6; private: Expected<std::vector<BenchmarkMeasure>> diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp index b4437f7..6dc64765 100644 --- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp @@ -278,9 +278,9 @@ static Expected<std::vector<CodeTemplate>> generateLEATemplatesCommon( assert(X86II::getMemoryOperandNo(Instr.Description.TSFlags) == 1 && "invalid LEA"); - constexpr const int kDestOp = 0; - constexpr const int kBaseOp = 1; - constexpr const int kIndexOp = 3; + constexpr int kDestOp = 0; + constexpr int kBaseOp = 1; + constexpr int kIndexOp = 3; auto PossibleDestRegs = Instr.Operands[kDestOp].getRegisterAliasing().sourceBits(); remove(PossibleDestRegs, ForbiddenRegisters); @@ -548,7 +548,7 @@ private: void initStack(unsigned Bytes); - static constexpr const unsigned kF80Bytes = 10; // 80 bits. + static constexpr unsigned kF80Bytes = 10; // 80 bits. APInt Constant_; std::vector<MCInst> Instructions; @@ -864,7 +864,7 @@ const MCPhysReg ExegesisX86Target::kUnavailableRegistersSSE[12] = { // We're using one of R8-R15 because these registers are never hardcoded in // instructions (e.g. MOVS writes to EDI, ESI, EDX), so they have less // conflicts. -constexpr const MCPhysReg kDefaultLoopCounterReg = X86::R8; +constexpr MCPhysReg kDefaultLoopCounterReg = X86::R8; } // namespace @@ -1110,9 +1110,9 @@ std::vector<MCInst> ExegesisX86Target::setRegTo(const MCSubtargetInfo &STI, #ifdef __linux__ #ifdef __arm__ -static constexpr const uintptr_t VAddressSpaceCeiling = 0xC0000000; +static constexpr uintptr_t VAddressSpaceCeiling = 0xC0000000; #else -static constexpr const uintptr_t VAddressSpaceCeiling = 0x0000800000000000; +static constexpr uintptr_t VAddressSpaceCeiling = 0x0000800000000000; #endif void generateRoundToNearestPage(unsigned int Register, diff --git a/llvm/tools/llvm-libtool-darwin/DependencyInfo.h b/llvm/tools/llvm-libtool-darwin/DependencyInfo.h index 784ec3f..80bad8f 100644 --- a/llvm/tools/llvm-libtool-darwin/DependencyInfo.h +++ b/llvm/tools/llvm-libtool-darwin/DependencyInfo.h @@ -18,7 +18,7 @@ public: explicit DependencyInfo(std::string DependencyInfoPath) : DependencyInfoPath(DependencyInfoPath) {} - virtual ~DependencyInfo(){}; + virtual ~DependencyInfo() = default; virtual void addMissingInput(llvm::StringRef Path) { NotFounds.insert(Path.str()); diff --git a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp index f7f929e..1469071 100644 --- a/llvm/tools/llvm-mca/CodeRegionGenerator.cpp +++ b/llvm/tools/llvm-mca/CodeRegionGenerator.cpp @@ -26,7 +26,7 @@ namespace llvm { namespace mca { // This virtual dtor serves as the anchor for the CodeRegionGenerator class. -CodeRegionGenerator::~CodeRegionGenerator() {} +CodeRegionGenerator::~CodeRegionGenerator() = default; Expected<const CodeRegions &> AsmCodeRegionGenerator::parseCodeRegions( const std::unique_ptr<MCInstPrinter> &IP, bool SkipFailures) { diff --git a/llvm/tools/llvm-mca/CodeRegionGenerator.h b/llvm/tools/llvm-mca/CodeRegionGenerator.h index a48c67a..c30f67a 100644 --- a/llvm/tools/llvm-mca/CodeRegionGenerator.h +++ b/llvm/tools/llvm-mca/CodeRegionGenerator.h @@ -151,7 +151,7 @@ protected: bool SkipFailures) = 0; public: - CodeRegionGenerator() {} + CodeRegionGenerator() = default; virtual ~CodeRegionGenerator(); }; diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp index 3d7f33c..8aa843b 100644 --- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp +++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp @@ -811,12 +811,12 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> ArgsArr, .Case("boot_application", COFF::IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION) .Case("console", COFF::IMAGE_SUBSYSTEM_WINDOWS_CUI) - .Cases("efi_application", "efi-app", + .Cases({"efi_application", "efi-app"}, COFF::IMAGE_SUBSYSTEM_EFI_APPLICATION) - .Cases("efi_boot_service_driver", "efi-bsd", + .Cases({"efi_boot_service_driver", "efi-bsd"}, COFF::IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) .Case("efi_rom", COFF::IMAGE_SUBSYSTEM_EFI_ROM) - .Cases("efi_runtime_driver", "efi-rtd", + .Cases({"efi_runtime_driver", "efi-rtd"}, COFF::IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) .Case("native", COFF::IMAGE_SUBSYSTEM_NATIVE) .Case("posix", COFF::IMAGE_SUBSYSTEM_POSIX_CUI) diff --git a/llvm/tools/llvm-objdump/SourcePrinter.h b/llvm/tools/llvm-objdump/SourcePrinter.h index 5c131a0..19acc87 100644 --- a/llvm/tools/llvm-objdump/SourcePrinter.h +++ b/llvm/tools/llvm-objdump/SourcePrinter.h @@ -34,7 +34,7 @@ public: LiveElement(const char *Name, DWARFUnit *Unit, const DWARFDie FuncDie) : Name(Name), Unit(Unit), FuncDie(FuncDie) {} - virtual ~LiveElement() {}; + virtual ~LiveElement() = default; const char *getName() const { return Name; } virtual bool liveAtAddress(object::SectionedAddress Addr) const = 0; diff --git a/llvm/tools/llvm-objdump/llvm-objdump.h b/llvm/tools/llvm-objdump/llvm-objdump.h index 3525be9..bac8589 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.h +++ b/llvm/tools/llvm-objdump/llvm-objdump.h @@ -84,7 +84,7 @@ protected: public: Dumper(const object::ObjectFile &O); - virtual ~Dumper() {} + virtual ~Dumper() = default; void reportUniqueWarning(Error Err); void reportUniqueWarning(const Twine &Msg); diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp index b2362ec..d836d98 100644 --- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -68,7 +68,7 @@ DumpOutputStyle::DumpOutputStyle(InputFile &File) RefTracker.reset(new TypeReferenceTracker(File)); } -DumpOutputStyle::~DumpOutputStyle() {} +DumpOutputStyle::~DumpOutputStyle() = default; PDBFile &DumpOutputStyle::getPdb() { return File.pdb(); } object::COFFObjectFile &DumpOutputStyle::getObj() { return File.obj(); } diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.h b/llvm/tools/llvm-pdbutil/DumpOutputStyle.h index 6714a6a..ea4a47f 100644 --- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.h +++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.h @@ -29,7 +29,7 @@ class TypeReferenceTracker; struct StatCollection { struct Stat { - Stat() {} + Stat() = default; Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {} uint32_t Count = 0; uint32_t Size = 0; diff --git a/llvm/tools/llvm-pdbutil/OutputStyle.h b/llvm/tools/llvm-pdbutil/OutputStyle.h index 8cc9016..a09fb82 100644 --- a/llvm/tools/llvm-pdbutil/OutputStyle.h +++ b/llvm/tools/llvm-pdbutil/OutputStyle.h @@ -17,7 +17,7 @@ namespace pdb { class OutputStyle { public: - virtual ~OutputStyle() {} + virtual ~OutputStyle() = default; virtual Error dump() = 0; }; diff --git a/llvm/tools/llvm-pdbutil/StreamUtil.h b/llvm/tools/llvm-pdbutil/StreamUtil.h index 9d6030c..6b8c13f 100644 --- a/llvm/tools/llvm-pdbutil/StreamUtil.h +++ b/llvm/tools/llvm-pdbutil/StreamUtil.h @@ -35,7 +35,7 @@ enum class StreamPurpose { struct StreamInfo { public: - StreamInfo() {} + StreamInfo() = default; uint32_t getModuleIndex() const { return *ModuleIndex; } StreamPurpose getPurpose() const { return Purpose; } diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp index 94728ce..96db6a7 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp +++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp @@ -187,7 +187,7 @@ ProfiledBinary::ProfiledBinary(const StringRef ExeBinPath, load(); } -ProfiledBinary::~ProfiledBinary() {} +ProfiledBinary::~ProfiledBinary() = default; void ProfiledBinary::warnNoFuncEntry() { uint64_t NoFuncEntryNum = 0; diff --git a/llvm/tools/llvm-rc/ResourceScriptStmt.h b/llvm/tools/llvm-rc/ResourceScriptStmt.h index a81e384f..84da9be 100644 --- a/llvm/tools/llvm-rc/ResourceScriptStmt.h +++ b/llvm/tools/llvm-rc/ResourceScriptStmt.h @@ -242,9 +242,9 @@ public: virtual raw_ostream &log(raw_ostream &OS) const { return OS << "Base statement\n"; }; - RCResource() {} + RCResource() = default; RCResource(uint16_t Flags) : MemoryFlags(Flags) {} - virtual ~RCResource() {} + virtual ~RCResource() = default; virtual Error visit(Visitor *) const { llvm_unreachable("This is unable to call methods from Visitor base"); @@ -290,7 +290,7 @@ class OptionalStmtList : public OptionalStmt { std::vector<std::unique_ptr<OptionalStmt>> Statements; public: - OptionalStmtList() {} + OptionalStmtList() = default; raw_ostream &log(raw_ostream &OS) const override; void addStmt(std::unique_ptr<OptionalStmt> Stmt) { @@ -510,7 +510,7 @@ public: virtual raw_ostream &log(raw_ostream &OS) const { return OS << "Base menu definition\n"; } - virtual ~MenuDefinition() {} + virtual ~MenuDefinition() = default; virtual uint16_t getResFlags() const { return 0; } virtual MenuDefKind getKind() const { return MkBase; } @@ -818,7 +818,7 @@ public: enum StmtKind { StBase = 0, StBlock = 1, StValue = 2 }; virtual raw_ostream &log(raw_ostream &OS) const { return OS << "VI stmt\n"; } - virtual ~VersionInfoStmt() {} + virtual ~VersionInfoStmt() = default; virtual StmtKind getKind() const { return StBase; } static bool classof(const VersionInfoStmt *S) { diff --git a/llvm/tools/llvm-rc/ResourceVisitor.h b/llvm/tools/llvm-rc/ResourceVisitor.h index a121a0a..1815c6b 100644 --- a/llvm/tools/llvm-rc/ResourceVisitor.h +++ b/llvm/tools/llvm-rc/ResourceVisitor.h @@ -55,7 +55,7 @@ public: virtual Error visitVersionStmt(const VersionStmt *) = 0; virtual Error visitMenuStmt(const MenuStmt *) = 0; - virtual ~Visitor() {} + virtual ~Visitor() = default; }; } // namespace rc diff --git a/llvm/tools/llvm-readobj/ObjDumper.cpp b/llvm/tools/llvm-readobj/ObjDumper.cpp index 0b59dd4..20e027a 100644 --- a/llvm/tools/llvm-readobj/ObjDumper.cpp +++ b/llvm/tools/llvm-readobj/ObjDumper.cpp @@ -41,7 +41,7 @@ ObjDumper::ObjDumper(ScopedPrinter &Writer, StringRef ObjName) : W(Writer) { }; } -ObjDumper::~ObjDumper() {} +ObjDumper::~ObjDumper() = default; void ObjDumper::reportUniqueWarning(Error Err) const { reportUniqueWarning(toString(std::move(Err))); diff --git a/llvm/tools/llvm-readtapi/DiffEngine.h b/llvm/tools/llvm-readtapi/DiffEngine.h index 7ab57d4..b350ceef 100644 --- a/llvm/tools/llvm-readtapi/DiffEngine.h +++ b/llvm/tools/llvm-readtapi/DiffEngine.h @@ -39,7 +39,7 @@ enum DiffAttrKind { class AttributeDiff { public: AttributeDiff(DiffAttrKind Kind) : Kind(Kind){}; - virtual ~AttributeDiff(){}; + virtual ~AttributeDiff() = default; DiffAttrKind getKind() const { return Kind; } private: diff --git a/llvm/tools/llvm-xray/xray-graph.h b/llvm/tools/llvm-xray/xray-graph.h index fd96449..bf25f8d 100644 --- a/llvm/tools/llvm-xray/xray-graph.h +++ b/llvm/tools/llvm-xray/xray-graph.h @@ -86,7 +86,7 @@ public: }; GraphT G; - using VertexIdentifier = typename decltype(G)::VertexIdentifier; + using VertexIdentifier = decltype(G)::VertexIdentifier; using EdgeIdentifier = decltype(G)::EdgeIdentifier; /// Use a Map to store the Function stack for each thread whilst building the |
