diff --git a/include/llvm/LTO/Config.h b/include/llvm/LTO/Config.h index c4bf370fa3d..1a7595d7540 100644 --- a/include/llvm/LTO/Config.h +++ b/include/llvm/LTO/Config.h @@ -114,10 +114,10 @@ struct Config { std::string SplitDwarfOutput; /// Optimization remarks file path. - std::string RemarksFilename = ""; + std::string RemarksFilename; /// Optimization remarks pass filter. - std::string RemarksPasses = ""; + std::string RemarksPasses; /// Whether to emit optimization remarks with hotness informations. bool RemarksWithHotness = false; @@ -138,7 +138,7 @@ struct Config { llvm::Optional RemarksHotnessThreshold = 0; /// The format used for serializing remarks (default: YAML). - std::string RemarksFormat = ""; + std::string RemarksFormat; /// Whether to emit the pass manager debuggging informations. bool DebugPassManager = false; diff --git a/lib/Analysis/CallPrinter.cpp b/lib/Analysis/CallPrinter.cpp index c3922d55602..872a91ad7cb 100644 --- a/lib/Analysis/CallPrinter.cpp +++ b/lib/Analysis/CallPrinter.cpp @@ -196,7 +196,7 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { Function *F = Node->getFunction(); if (F == nullptr) return ""; - std::string attrs = ""; + std::string attrs; if (ShowHeatColors) { uint64_t freq = CGInfo->getFreq(F); std::string color = getHeatColor(freq, CGInfo->getMaxFreq()); diff --git a/lib/Analysis/ConstraintSystem.cpp b/lib/Analysis/ConstraintSystem.cpp index 1d582802f8e..9739c6af576 100644 --- a/lib/Analysis/ConstraintSystem.cpp +++ b/lib/Analysis/ConstraintSystem.cpp @@ -116,7 +116,7 @@ void ConstraintSystem::dump(ArrayRef Names) const { for (unsigned I = 1, S = Row.size(); I < S; ++I) { if (Row[I] == 0) continue; - std::string Coefficient = ""; + std::string Coefficient; if (Row[I] != 1) Coefficient = std::to_string(Row[I]) + " * "; Parts.push_back(Coefficient + Names[I - 1]); diff --git a/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/lib/CodeGen/GlobalISel/InstructionSelect.cpp index f32278d0705..25fae548718 100644 --- a/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -41,7 +41,7 @@ static cl::opt cl::desc("Record GlobalISel rule coverage files of this " "prefix if instrumentation was generated")); #else -static const std::string CoveragePrefix = ""; +static const std::string CoveragePrefix; #endif char InstructionSelect::ID = 0; diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 7bc5c98b89b..32e8393a88e 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -917,7 +917,7 @@ MCSection *TargetLoweringObjectFileELF::getSectionForMachineBasicBlock( } unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_EXECINSTR; - std::string GroupName = ""; + std::string GroupName; if (F.hasComdat()) { Flags |= ELF::SHF_GROUP; GroupName = F.getComdat()->getName().str(); diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index e5e512672da..2fbe707ce8d 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -352,7 +352,7 @@ private: RemainingExpr = RemainingExpr.substr(1).ltrim(); uint64_t StubAddr; - std::string ErrorMsg = ""; + std::string ErrorMsg; std::tie(StubAddr, ErrorMsg) = Checker.getStubOrGOTAddrFor( StubContainerName, Symbol, PCtx.IsInsideLoad, IsStubAddr); @@ -389,7 +389,7 @@ private: RemainingExpr = RemainingExpr.substr(1).ltrim(); uint64_t StubAddr; - std::string ErrorMsg = ""; + std::string ErrorMsg; std::tie(StubAddr, ErrorMsg) = Checker.getSectionAddr( FileName, SectionName, PCtx.IsInsideLoad); diff --git a/lib/Target/Mips/MipsRegisterBankInfo.h b/lib/Target/Mips/MipsRegisterBankInfo.h index 55eeaf096b1..df51606e1e8 100644 --- a/lib/Target/Mips/MipsRegisterBankInfo.h +++ b/lib/Target/Mips/MipsRegisterBankInfo.h @@ -150,7 +150,7 @@ private: class TypeInfoForMF { /// MachineFunction name is used to recognise when MF changes. - std::string MFName = ""; + std::string MFName; /// : value is vector of all MachineInstrs that are waiting for /// key to figure out type of some of its ambiguous operands. DenseMap> diff --git a/lib/Transforms/IPO/Attributor.cpp b/lib/Transforms/IPO/Attributor.cpp index ab4ad7c784a..03ad4513500 100644 --- a/lib/Transforms/IPO/Attributor.cpp +++ b/lib/Transforms/IPO/Attributor.cpp @@ -2459,7 +2459,7 @@ template <> struct DOTGraphTraits : public DefaultDOTGraphTraits { static std::string getNodeLabel(const AADepGraphNode *Node, const AADepGraph *DG) { - std::string AAString = ""; + std::string AAString; raw_string_ostream O(AAString); Node->print(O); return AAString; diff --git a/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp index 19173972879..9d856c85c3b 100644 --- a/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp +++ b/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp @@ -1596,7 +1596,7 @@ public: write(StringRef(Intrinsic::getName(II->getIntrinsicID(), {})) .drop_front(StringRef("llvm.matrix.").size())); write("."); - std::string Tmp = ""; + std::string Tmp; raw_string_ostream SS(Tmp); switch (II->getIntrinsicID()) { diff --git a/tools/llvm-cov/SourceCoverageViewHTML.cpp b/tools/llvm-cov/SourceCoverageViewHTML.cpp index 4db5624e34f..7ab1d6608cc 100644 --- a/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -248,7 +248,7 @@ const char *ReportTitleTag = "h2"; const char *CreatedTimeTag = "h4"; std::string getPathToStyle(StringRef ViewPath) { - std::string PathToStyle = ""; + std::string PathToStyle; std::string PathSep = std::string(sys::path::get_separator()); unsigned NumSeps = ViewPath.count(PathSep); for (unsigned I = 0, E = NumSeps; I < E; ++I) @@ -617,7 +617,7 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L, void SourceCoverageViewHTML::renderLineCoverageColumn( raw_ostream &OS, const LineCoverageStats &Line) { - std::string Count = ""; + std::string Count; if (Line.isMapped()) Count = tag("pre", formatCount(Line.getExecutionCount())); std::string CoverageClass = diff --git a/tools/llvm-ifs/llvm-ifs.cpp b/tools/llvm-ifs/llvm-ifs.cpp index 8906300dca0..4d9a5c365a7 100644 --- a/tools/llvm-ifs/llvm-ifs.cpp +++ b/tools/llvm-ifs/llvm-ifs.cpp @@ -384,7 +384,7 @@ int main(int argc, char *argv[]) { IFSStub Stub; std::map SymbolMap; - std::string PreviousInputFilePath = ""; + std::string PreviousInputFilePath; for (const std::string &InputFilePath : InputFilenames) { Expected> StubOrErr = readInputFile(InputFilePath); if (!StubOrErr) { diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 1fa9879c821..51212d52c18 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -2395,7 +2395,7 @@ void objdump::parseInputMachO(MachOUniversalBinary *UB) { ArchFound = true; Expected> ObjOrErr = I->getAsObjectFile(); - std::string ArchitectureName = ""; + std::string ArchitectureName; if (ArchFlags.size() > 1) ArchitectureName = I->getArchFlagName(); if (ObjOrErr) { @@ -2511,7 +2511,7 @@ void objdump::parseInputMachO(MachOUniversalBinary *UB) { E = UB->end_objects(); I != E; ++I) { Expected> ObjOrErr = I->getAsObjectFile(); - std::string ArchitectureName = ""; + std::string ArchitectureName; if (moreThanOneArch) ArchitectureName = I->getArchFlagName(); if (ObjOrErr) { diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 857d7f56ad7..1ca4a68eb15 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -873,7 +873,7 @@ bool TreePredicateFn::hasPredCode() const { } std::string TreePredicateFn::getPredCode() const { - std::string Code = ""; + std::string Code; if (!isLoad() && !isStore() && !isAtomic()) { Record *MemoryVT = getMemoryVT(); diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp index 1df5902b081..960fe08677f 100644 --- a/utils/TableGen/CodeGenInstruction.cpp +++ b/utils/TableGen/CodeGenInstruction.cpp @@ -472,7 +472,7 @@ HasOneImplicitDefWithKnownVT(const CodeGenTarget &TargetInfo) const { /// include text from the specified variant, returning the new string. std::string CodeGenInstruction:: FlattenAsmStringVariants(StringRef Cur, unsigned Variant) { - std::string Res = ""; + std::string Res; for (;;) { // Find the start of the next variant string. diff --git a/utils/TableGen/CodeGenMapTable.cpp b/utils/TableGen/CodeGenMapTable.cpp index ea53a2d3eee..289a20a96f0 100644 --- a/utils/TableGen/CodeGenMapTable.cpp +++ b/utils/TableGen/CodeGenMapTable.cpp @@ -374,7 +374,7 @@ unsigned MapTableEmitter::emitBinSearchTable(raw_ostream &OS) { for (unsigned i = 0; i < TotalNumInstr; i++) { Record *CurInstr = NumberedInstructions[i]->TheDef; std::vector ColInstrs = MapTable[CurInstr]; - std::string OutStr(""); + std::string OutStr; unsigned RelExists = 0; if (!ColInstrs.empty()) { for (unsigned j = 0; j < NumCol; j++) { diff --git a/utils/TableGen/GlobalISelEmitter.cpp b/utils/TableGen/GlobalISelEmitter.cpp index 4be53930fc5..b238573be49 100644 --- a/utils/TableGen/GlobalISelEmitter.cpp +++ b/utils/TableGen/GlobalISelEmitter.cpp @@ -201,7 +201,7 @@ static Optional MVTToLLT(MVT::SimpleValueType SVT) { } static std::string explainPredicates(const TreePatternNode *N) { - std::string Explanation = ""; + std::string Explanation; StringRef Separator = ""; for (const TreePredicateCall &Call : N->getPredicateCalls()) { const TreePredicateFn &P = Call.Fn; @@ -305,8 +305,8 @@ static Error failedImport(const Twine &Reason) { } static Error isTrivialOperatorNode(const TreePatternNode *N) { - std::string Explanation = ""; - std::string Separator = ""; + std::string Explanation; + std::string Separator; bool HasUnsupportedPredicate = false; for (const TreePredicateCall &Call : N->getPredicateCalls()) { diff --git a/utils/TableGen/RISCVCompressInstEmitter.cpp b/utils/TableGen/RISCVCompressInstEmitter.cpp index dcca207be7c..70f51816173 100644 --- a/utils/TableGen/RISCVCompressInstEmitter.cpp +++ b/utils/TableGen/RISCVCompressInstEmitter.cpp @@ -635,10 +635,10 @@ void RISCVCompressInstEmitter::emitCompressInstEmitter(raw_ostream &o, return; } - std::string CaseString(""); + std::string CaseString; raw_string_ostream CaseStream(CaseString); - std::string PrevOp(""); - std::string CurOp(""); + std::string PrevOp; + std::string CurOp; CaseStream << " switch (MI.getOpcode()) {\n"; CaseStream << " default: return false;\n";