forked from OSchip/llvm-project
Remove redundant string initialization (NFC)
Identified with readability-redundant-string-init.
This commit is contained in:
parent
7006d34ce7
commit
0542d15211
|
@ -24,7 +24,7 @@ void LimitedRandomnessCheck::registerMatchers(MatchFinder *Finder) {
|
|||
}
|
||||
|
||||
void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
std::string Msg = "";
|
||||
std::string Msg;
|
||||
if (getLangOpts().CPlusPlus)
|
||||
Msg = "; use C++11 random library instead";
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ M68kTargetInfo::M68kTargetInfo(const llvm::Triple &Triple,
|
|||
const TargetOptions &)
|
||||
: TargetInfo(Triple) {
|
||||
|
||||
std::string Layout = "";
|
||||
std::string Layout;
|
||||
|
||||
// M68k is Big Endian
|
||||
Layout += "E";
|
||||
|
|
|
@ -414,7 +414,7 @@ public:
|
|||
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
|
||||
IntMaxType = SignedLong;
|
||||
Int64Type = SignedLong;
|
||||
std::string DataLayout = "";
|
||||
std::string DataLayout;
|
||||
|
||||
if (Triple.isOSAIX()) {
|
||||
// TODO: Set appropriate ABI for AIX platform.
|
||||
|
|
|
@ -1434,7 +1434,7 @@ llvm::Value *CGOpenMPRuntime::emitUpdateLocation(CodeGenFunction &CGF,
|
|||
Loc.isInvalid()) {
|
||||
SrcLocStr = OMPBuilder.getOrCreateDefaultSrcLocStr();
|
||||
} else {
|
||||
std::string FunctionName = "";
|
||||
std::string FunctionName;
|
||||
if (const auto *FD = dyn_cast_or_null<FunctionDecl>(CGF.CurFuncDecl))
|
||||
FunctionName = FD->getQualifiedNameAsString();
|
||||
PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
|
||||
|
@ -9540,7 +9540,7 @@ emitMappingInformation(CodeGenFunction &CGF, llvm::OpenMPIRBuilder &OMPBuilder,
|
|||
Loc = MapExprs.getMapDecl()->getLocation();
|
||||
}
|
||||
|
||||
std::string ExprName = "";
|
||||
std::string ExprName;
|
||||
if (MapExprs.getMapExpr()) {
|
||||
PrintingPolicy P(CGF.getContext().getLangOpts());
|
||||
llvm::raw_string_ostream OS(ExprName);
|
||||
|
|
|
@ -28,7 +28,7 @@ std::string computeName(const FormatToken *NamespaceTok) {
|
|||
assert(NamespaceTok &&
|
||||
NamespaceTok->isOneOf(tok::kw_namespace, TT_NamespaceMacro) &&
|
||||
"expecting a namespace token");
|
||||
std::string name = "";
|
||||
std::string name;
|
||||
const FormatToken *Tok = NamespaceTok->getNextNonComment();
|
||||
if (NamespaceTok->is(TT_NamespaceMacro)) {
|
||||
// Collects all the non-comment tokens between opening parenthesis
|
||||
|
@ -224,7 +224,7 @@ std::pair<tooling::Replacements, unsigned> NamespaceEndCommentsFixer::analyze(
|
|||
return {Fixes, 0};
|
||||
}
|
||||
|
||||
std::string AllNamespaceNames = "";
|
||||
std::string AllNamespaceNames;
|
||||
size_t StartLineIndex = SIZE_MAX;
|
||||
StringRef NamespaceTokenText;
|
||||
unsigned int CompactedNamespacesCount = 0;
|
||||
|
|
|
@ -354,7 +354,7 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
|
|||
break;
|
||||
case llvm::Triple::PS4: {
|
||||
// <isysroot> gets prepended later in AddPath().
|
||||
std::string BaseSDKPath = "";
|
||||
std::string BaseSDKPath;
|
||||
if (!HasSysroot) {
|
||||
const char *envValue = getenv("SCE_ORBIS_SDK_DIR");
|
||||
if (envValue)
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
} // namespace
|
||||
|
||||
static std::string getName(const CallEvent &Call) {
|
||||
std::string Name = "";
|
||||
std::string Name;
|
||||
if (const auto *MD = dyn_cast<CXXMethodDecl>(Call.getDecl()))
|
||||
if (const CXXRecordDecl *RD = MD->getParent())
|
||||
Name += RD->getNameAsString() + "::";
|
||||
|
|
|
@ -470,7 +470,7 @@ int main(int argc, const char **argv) {
|
|||
AdjustingCompilations->appendArgumentsAdjuster(
|
||||
[&ResourceDirCache](const tooling::CommandLineArguments &Args,
|
||||
StringRef FileName) {
|
||||
std::string LastO = "";
|
||||
std::string LastO;
|
||||
bool HasResourceDir = false;
|
||||
bool ClangCLMode = false;
|
||||
auto FlagsEnd = llvm::find(Args, "--");
|
||||
|
|
|
@ -1473,7 +1473,7 @@ Intrinsic::DagEmitter::emitDagCall(DagInit *DI, bool MatchMangledName) {
|
|||
Intr.Dependencies.insert(&Callee);
|
||||
|
||||
// Now create the call itself.
|
||||
std::string S = "";
|
||||
std::string S;
|
||||
if (!Callee.isBigEndianSafe())
|
||||
S += CallPrefix.str();
|
||||
S += Callee.getMangledName(true) + "(";
|
||||
|
|
|
@ -600,7 +600,7 @@ void CommandCompletions::VariablePath(CommandInterpreter &interpreter,
|
|||
void CommandCompletions::Registers(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request,
|
||||
SearchFilter *searcher) {
|
||||
std::string reg_prefix = "";
|
||||
std::string reg_prefix;
|
||||
if (request.GetCursorArgumentPrefix().startswith("$"))
|
||||
reg_prefix = "$";
|
||||
|
||||
|
|
|
@ -1111,7 +1111,7 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec &arch,
|
|||
triple.getSubArch() == llvm::Triple::NoSubArch)
|
||||
triple.setArchName("armv8.7a");
|
||||
|
||||
std::string features_str = "";
|
||||
std::string features_str;
|
||||
const char *triple_str = triple.getTriple().c_str();
|
||||
|
||||
// ARM Cortex M0-M7 devices only execute thumb instructions
|
||||
|
|
|
@ -137,7 +137,7 @@ EmulateInstructionMIPS::EmulateInstructionMIPS(
|
|||
break;
|
||||
}
|
||||
|
||||
std::string features = "";
|
||||
std::string features;
|
||||
uint32_t arch_flags = arch.GetFlags();
|
||||
if (arch_flags & ArchSpec::eMIPSAse_msa)
|
||||
features += "+msa,";
|
||||
|
|
|
@ -137,7 +137,7 @@ EmulateInstructionMIPS64::EmulateInstructionMIPS64(
|
|||
break;
|
||||
}
|
||||
|
||||
std::string features = "";
|
||||
std::string features;
|
||||
uint32_t arch_flags = arch.GetFlags();
|
||||
if (arch_flags & ArchSpec::eMIPSAse_msa)
|
||||
features += "+msa,";
|
||||
|
|
|
@ -100,14 +100,14 @@ InstrumentationRuntimeMainThreadChecker::RetrieveReportData(
|
|||
if (!apiname_ptr)
|
||||
return StructuredData::ObjectSP();
|
||||
|
||||
std::string apiName = "";
|
||||
std::string apiName;
|
||||
Status read_error;
|
||||
target.ReadCStringFromMemory(apiname_ptr, apiName, read_error);
|
||||
if (read_error.Fail())
|
||||
return StructuredData::ObjectSP();
|
||||
|
||||
std::string className = "";
|
||||
std::string selector = "";
|
||||
std::string className;
|
||||
std::string selector;
|
||||
if (apiName.substr(0, 2) == "-[") {
|
||||
size_t spacePos = apiName.find(' ');
|
||||
if (spacePos != std::string::npos) {
|
||||
|
|
|
@ -711,7 +711,7 @@ addr_t InstrumentationRuntimeTSan::GetMainRacyAddress(
|
|||
std::string InstrumentationRuntimeTSan::GetLocationDescription(
|
||||
StructuredData::ObjectSP report, addr_t &global_addr,
|
||||
std::string &global_name, std::string &filename, uint32_t &line) {
|
||||
std::string result = "";
|
||||
std::string result;
|
||||
|
||||
ProcessSP process_sp = GetProcessSP();
|
||||
|
||||
|
@ -820,8 +820,8 @@ bool InstrumentationRuntimeTSan::NotifyBreakpointHit(
|
|||
report->GetAsDictionary()->AddIntegerItem("memory_address", main_address);
|
||||
|
||||
addr_t global_addr = 0;
|
||||
std::string global_name = "";
|
||||
std::string location_filename = "";
|
||||
std::string global_name;
|
||||
std::string location_filename;
|
||||
uint32_t location_line = 0;
|
||||
std::string location_description = instance->GetLocationDescription(
|
||||
report, global_addr, global_name, location_filename, location_line);
|
||||
|
|
|
@ -115,7 +115,7 @@ Status MinidumpFileBuilder::AddSystemInfo(const llvm::Triple &target_triple) {
|
|||
sys_info.PlatformId = platform_id;
|
||||
m_data.AppendData(&sys_info, sizeof(llvm::minidump::SystemInfo));
|
||||
|
||||
std::string csd_string = "";
|
||||
std::string csd_string;
|
||||
|
||||
error = WriteString(csd_string, &m_data);
|
||||
if (error.Fail()) {
|
||||
|
|
|
@ -693,7 +693,7 @@ const UnixSignalsSP &PlatformRemoteGDBServer::GetRemoteUnixSignals() {
|
|||
if (object_sp && object_sp->IsValid())
|
||||
notify = object_sp->GetBooleanValue();
|
||||
|
||||
std::string description{""};
|
||||
std::string description;
|
||||
object_sp = dict->GetValueForKey("description");
|
||||
if (object_sp && object_sp->IsValid())
|
||||
description = std::string(object_sp->GetStringValue());
|
||||
|
|
|
@ -1509,7 +1509,7 @@ RegisterContextUnwind::SavedLocationForRegister(
|
|||
regnum.GetName(), regnum.GetAsKind(eRegisterKindLLDB));
|
||||
return UnwindLLDB::RegisterSearchResult::eRegisterFound;
|
||||
} else {
|
||||
std::string unwindplan_name("");
|
||||
std::string unwindplan_name;
|
||||
if (m_full_unwind_plan_sp) {
|
||||
unwindplan_name += "via '";
|
||||
unwindplan_name += m_full_unwind_plan_sp->GetSourceName().AsCString();
|
||||
|
|
|
@ -74,7 +74,7 @@ std::string DWARFAbbreviationDeclarationSet::getCodeRange() const {
|
|||
for (const auto &Decl : Decls)
|
||||
Codes.push_back(Decl.getCode());
|
||||
|
||||
std::string Buffer = "";
|
||||
std::string Buffer;
|
||||
raw_string_ostream Stream(Buffer);
|
||||
// Each iteration through this loop represents a single contiguous range in
|
||||
// the set of codes.
|
||||
|
|
|
@ -410,7 +410,7 @@ void AMDGPUTargetID::setTargetIDFromTargetIDStream(StringRef TargetID) {
|
|||
}
|
||||
|
||||
std::string AMDGPUTargetID::toString() const {
|
||||
std::string StringRep = "";
|
||||
std::string StringRep;
|
||||
raw_string_ostream StreamRep(StringRep);
|
||||
|
||||
auto TargetTriple = STI.getTargetTriple();
|
||||
|
@ -421,7 +421,7 @@ std::string AMDGPUTargetID::toString() const {
|
|||
<< TargetTriple.getOSName() << '-'
|
||||
<< TargetTriple.getEnvironmentName() << '-';
|
||||
|
||||
std::string Processor = "";
|
||||
std::string Processor;
|
||||
// TODO: Following else statement is present here because we used various
|
||||
// alias names for GPUs up until GFX9 (e.g. 'fiji' is same as 'gfx803').
|
||||
// Remove once all aliases are removed from GCNProcessors.td.
|
||||
|
@ -432,7 +432,7 @@ std::string AMDGPUTargetID::toString() const {
|
|||
Twine(Version.Stepping))
|
||||
.str();
|
||||
|
||||
std::string Features = "";
|
||||
std::string Features;
|
||||
if (Optional<uint8_t> HsaAbiVersion = getHsaAbiVersion(&STI)) {
|
||||
switch (*HsaAbiVersion) {
|
||||
case ELF::ELFABIVERSION_AMDGPU_HSA_V2:
|
||||
|
|
Loading…
Reference in New Issue