-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang] Remove unused local variables (NFC) #138453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang] Remove unused local variables (NFC) #138453
Conversation
@llvm/pr-subscribers-clang-static-analyzer-1 @llvm/pr-subscribers-clang-driver Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138453.diff 27 Files Affected:
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 1e4e055e04afd..6235473d19a31 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1949,7 +1949,6 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) {
analyze_os_log::OSLogBufferLayout Layout;
analyze_os_log::computeOSLogBufferLayout(Ctx, &E, Layout);
Address BufAddr = EmitPointerWithAlignment(E.getArg(0));
- llvm::SmallVector<llvm::Value *, 4> RetainableOperands;
// Ignore argument 1, the format string. It is not currently used.
CallArgList Args;
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 395263331d141..dd26be74e561b 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -1194,7 +1194,6 @@ void CGNVCUDARuntime::transformManagedVars() {
// registered. The linker will provide a pointer to this section so we can
// register the symbols with the linked device image.
void CGNVCUDARuntime::createOffloadingEntries() {
- SmallVector<char, 32> Out;
llvm::object::OffloadKind Kind = CGM.getLangOpts().HIP
? llvm::object::OffloadKind::OFK_HIP
: llvm::object::OffloadKind::OFK_Cuda;
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 8a214da6bf628..69d77f283db3b 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -748,7 +748,6 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) {
// Add any initializers with specified priority; this uses the same approach
// as EmitCXXGlobalInitFunc().
if (!PrioritizedCXXGlobalInits.empty()) {
- SmallVector<llvm::Function *, 8> LocalCXXGlobalInits;
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
PrioritizedCXXGlobalInits.end());
for (SmallVectorImpl<GlobalInitData>::iterator
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index bba7d1e805f3f..2e01adc51fdf0 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3955,8 +3955,6 @@ void CodeGenFunction::EmitCfiCheckFail() {
{CFITCK_UnrelatedCast, SanitizerKind::SO_CFIUnrelatedCast},
{CFITCK_ICall, SanitizerKind::SO_CFIICall}};
- SmallVector<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>, 5>
- Checks;
for (auto CheckKindOrdinalPair : CheckKinds) {
int Kind = CheckKindOrdinalPair.first;
SanitizerKind::SanitizerOrdinal Ordinal = CheckKindOrdinalPair.second;
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 87b2a73fb0c03..7917cdb7e12b6 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1814,7 +1814,6 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
// We'll need to enter cleanup scopes in case any of the element
// initializers throws an exception.
- SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
CodeGenFunction::CleanupDeactivationScope DeactivateCleanups(CGF);
unsigned curInitIndex = 0;
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 6136417fcad60..f6608faaa7309 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -446,7 +446,6 @@ static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
// HLSL neither supports priorities or COMDat values, so we will check those
// in an assert but not handle them.
- llvm::SmallVector<Function *> CtorFns;
for (const auto &Ctor : CA->operands()) {
if (isa<ConstantAggregateZero>(Ctor))
continue;
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 33f6b0470061f..e03539d1ccdd0 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -3827,8 +3827,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
} else {
SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty);
}
- // Empty vector used to construct empty method lists
- SmallVector<llvm::Constant*, 1> empty;
// Generate the method and instance variable lists
llvm::Constant *MethodList = GenerateMethodList(ClassName, "",
InstanceMethods, false);
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index cd3ded088ee27..803c7ed37635e 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3495,7 +3495,6 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
Ordered = true;
}
- llvm::DenseSet<const Expr *> EmittedFinals;
emitAlignedClause(*this, S);
bool HasLinears = EmitOMPLinearClauseInit(S);
// Emit helper vars inits.
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0406142fa916b..109316d0a27e7 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2533,7 +2533,6 @@ static void GetSDLFromOffloadArchive(
C.addTempFile(C.getArgs().MakeArgString(OutputLib));
- ArgStringList CmdArgs;
SmallString<128> DeviceTriple;
DeviceTriple += Action::GetOffloadKindName(JA.getOffloadingDeviceKind());
DeviceTriple += '-';
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index b71e27c20043a..e4466211686a9 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -287,7 +287,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
for (Arg *A : Args) {
if (A->getOption().getID() == options::OPT_dxil_validator_version) {
StringRef ValVerStr = A->getValue();
- std::string ErrorMsg;
if (!isLegalValidatorVersion(ValVerStr, getDriver()))
continue;
}
diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp
index 1cfa2a8f43b9d..ab9c1f5ad4ea1 100644
--- a/clang/lib/Driver/ToolChains/OHOS.cpp
+++ b/clang/lib/Driver/ToolChains/OHOS.cpp
@@ -303,7 +303,6 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
// Third try the effective triple.
P.assign(D.ResourceDir);
- std::string SysRoot = computeSysRoot();
llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple),
SelectedMultilib.gccSuffix());
Paths.push_back(P.c_str());
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1f297f228fc1b..e083c1a896804 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -974,7 +974,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::GNUstep) {
auto version = LangOpts.ObjCRuntime.getVersion();
- std::string versionString = "1";
// Don't rely on the tuple argument, because we can be asked to target
// later ABIs than we actually support, so clamp these values to those
// currently supported
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 6468e62889413..384d167cbcf88 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -3659,7 +3659,6 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
std::optional<LexEmbedParametersResult>
Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
LexEmbedParametersResult Result{};
- SmallVector<Token, 2> ParameterTokens;
tok::TokenKind EndTokenKind = ForHasEmbed ? tok::r_paren : tok::eod;
auto DiagMismatchedBracesAndSkipToEOD =
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 9f9e4bb92af8c..69f3568cfdba7 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -3455,7 +3455,6 @@ void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) {
Token PragmaName = Tok;
- SmallVector<Token, 1> TokenList;
if (!PP.getTargetInfo().hasStrictFP() && !PP.getLangOpts().ExpStrictFP) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_fp_ignored)
<< PragmaName.getIdentifierInfo()->getName();
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index ed10730ef986b..f9f7c192f19d2 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4837,7 +4837,6 @@ void SemaCodeCompletion::CodeCompleteAttribute(
// We skip this if the scope was already spelled and not guarded, or
// we must spell it and can't guard it.
if (!(InScope && !InScopeUnderscore) && SyntaxSupportsGuards) {
- llvm::SmallString<32> Guarded;
if (Scope.empty()) {
Add(Scope, Name, /*Underscores=*/true);
} else {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index d9d535c22fc40..bfb3ee9dcbd16 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -851,7 +851,6 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
StringRef WarningGroup;
- SmallVector<StringRef, 2> Options;
if (AL.getNumArgs() > 3) {
if (!S.checkStringLiteralArgumentAttr(AL, 3, WarningGroup))
return;
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index a4698f76af4eb..9dbc3efbca405 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3589,7 +3589,6 @@ ObjCMethodDecl *SemaObjC::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
// Gather the non-hidden methods.
ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
- SmallVector<ObjCMethodDecl *, 4> Methods;
for (ObjCMethodList *M = &MethList; M; M = M->getNext()) {
if (M->getMethod() && M->getMethod()->isUnconditionallyVisible())
return M->getMethod();
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 160fbddbdff15..e5670dab03cb0 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -5842,7 +5842,6 @@ static void TryOrBuildParenListInitialization(
if (const ArrayType *AT =
S.getASTContext().getAsArrayType(Entity.getType())) {
- SmallVector<InitializedEntity, 4> ElementEntities;
uint64_t ArrayLength;
// C++ [dcl.init]p16.5
// if the destination type is an array, the object is initialized as
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index c261d291ea142..835dba22a858d 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -5777,7 +5777,6 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
// Check for the default mapper for data members.
if (S.getLangOpts().OpenMP < 50)
return;
- SmallVector<OMPClause *, 4> ImplicitMaps;
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
if (!C)
@@ -14901,8 +14900,6 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
std::string OrigVarName = OrigVar->getNameInfo().getAsString();
std::string OuterIVName = (Twine(".unrolled.iv.") + OrigVarName).str();
std::string InnerIVName = (Twine(".unroll_inner.iv.") + OrigVarName).str();
- std::string InnerTripCountName =
- (Twine(".unroll_inner.tripcount.") + OrigVarName).str();
// Create the iteration variable for the unrolled loop.
VarDecl *OuterIVDecl =
@@ -15317,9 +15314,7 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
assert(LoopHelper.Counters.size() == 1 &&
"Single-dimensional loop iteration space expected");
- auto *OrigCntVar = cast<DeclRefExpr>(LoopHelper.Counters.front());
- std::string OrigVarName = OrigCntVar->getNameInfo().getAsString();
addLoopPreInits(Context, LoopHelper, LoopStmts[I], OriginalInits[I],
PreInits);
}
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index cda521808d1de..106a652049b07 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10188,8 +10188,6 @@ void ASTReader::ReadComments() {
}
}
NextCursor:
- llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
- FileToOffsetToComment;
for (RawComment *C : Comments) {
SourceLocation CommentLoc = C->getBeginLoc();
if (CommentLoc.isValid()) {
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 2772038bf3755..8c5adc3959398 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5599,7 +5599,6 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
// Writing all of the tentative definitions in this file, in
// TentativeDefinitions order. Generally, this record will be empty for
// headers.
- RecordData TentativeDefinitions;
AddLazyVectorDecls(*this, SemaRef.TentativeDefinitions);
// Writing all of the file scoped decls in this file.
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index 1b61370a580d9..5915c8f3aaace 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -154,7 +154,6 @@ const NoteTag *taintOriginTrackerTag(CheckerContext &C,
return C.getNoteTag([TaintedSymbols = std::move(TaintedSymbols),
TaintedArgs = std::move(TaintedArgs), CallLocation](
PathSensitiveBugReport &BR) -> std::string {
- SmallString<256> Msg;
// We give diagnostics only for taint related reports
if (!BR.isInteresting(CallLocation) ||
BR.getBugType().getCategory() != categories::TaintedData) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
index ddcf0469e030e..e9abc9ab2a1f9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
@@ -972,7 +972,6 @@ void NonLocalizedStringChecker::checkPostObjCMessage(const ObjCMethodCall &msg,
const IdentifierInfo *odInfo = OD->getIdentifier();
Selector S = msg.getSelector();
- std::string SelectorName = S.getAsString();
std::pair<const IdentifierInfo *, Selector> MethodDescription = {odInfo, S};
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index b3016f90122df..45901cbcedcb7 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -577,7 +577,6 @@ static std::string getModuleContextHash(const ModuleDeps &MD,
llvm::vfs::FileSystem &VFS) {
llvm::HashBuilder<llvm::TruncatedBLAKE3<16>, llvm::endianness::native>
HashBuilder;
- SmallString<32> Scratch;
// Hash the compiler version and serialization version to ensure the module
// will be readable.
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 809000a5086b1..ef4097888bc47 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4689,7 +4689,6 @@ static const ExprEvalResult *evaluateExpr(Expr *expr, CXCursor C) {
if (ER.Val.isFloat()) {
llvm::SmallVector<char, 100> Buffer;
ER.Val.getFloat().toString(Buffer);
- std::string floatStr(Buffer.data(), Buffer.size());
result->EvalType = CXEval_Float;
bool ignored;
llvm::APFloat apFloat = ER.Val.getFloat();
diff --git a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
index aed49a1f5f78d..434c1d1526a22 100644
--- a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
+++ b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
@@ -361,15 +361,8 @@ TEST(CallDescription, AliasNames) {
std::cont v;
v.data();
})code";
- constexpr StringRef UseStructNameInSpelling = R"code(
- void foo() {
- std::container v;
- v.data();
- })code";
const std::string UseAliasInSpellingCode =
(Twine{AliasNamesCode} + UseAliasInSpelling).str();
- const std::string UseStructNameInSpellingCode =
- (Twine{AliasNamesCode} + UseStructNameInSpelling).str();
// Test if the code spells the alias, wile we match against the struct name,
// and again matching against the alias.
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index b7f7f8f0b2fe2..9684ec9520e5a 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -4638,7 +4638,6 @@ static void GenerateSpellingIndexToSemanticSpelling(const Record &Attr,
// Generate the enumeration we will use for the mapping.
SemanticSpellingMap SemanticToSyntacticMap;
std::string Enum = CreateSemanticSpellings(Spellings, SemanticToSyntacticMap);
- std::string Name = Attr.getName().str() + "AttrSpellingMap";
OS << "unsigned spellingIndexToSemanticSpelling(";
OS << "const ParsedAttr &Attr) const override {\n";
|
@llvm/pr-subscribers-clang-codegen Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138453.diff 27 Files Affected:
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 1e4e055e04afd..6235473d19a31 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1949,7 +1949,6 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) {
analyze_os_log::OSLogBufferLayout Layout;
analyze_os_log::computeOSLogBufferLayout(Ctx, &E, Layout);
Address BufAddr = EmitPointerWithAlignment(E.getArg(0));
- llvm::SmallVector<llvm::Value *, 4> RetainableOperands;
// Ignore argument 1, the format string. It is not currently used.
CallArgList Args;
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 395263331d141..dd26be74e561b 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -1194,7 +1194,6 @@ void CGNVCUDARuntime::transformManagedVars() {
// registered. The linker will provide a pointer to this section so we can
// register the symbols with the linked device image.
void CGNVCUDARuntime::createOffloadingEntries() {
- SmallVector<char, 32> Out;
llvm::object::OffloadKind Kind = CGM.getLangOpts().HIP
? llvm::object::OffloadKind::OFK_HIP
: llvm::object::OffloadKind::OFK_Cuda;
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 8a214da6bf628..69d77f283db3b 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -748,7 +748,6 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) {
// Add any initializers with specified priority; this uses the same approach
// as EmitCXXGlobalInitFunc().
if (!PrioritizedCXXGlobalInits.empty()) {
- SmallVector<llvm::Function *, 8> LocalCXXGlobalInits;
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
PrioritizedCXXGlobalInits.end());
for (SmallVectorImpl<GlobalInitData>::iterator
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index bba7d1e805f3f..2e01adc51fdf0 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3955,8 +3955,6 @@ void CodeGenFunction::EmitCfiCheckFail() {
{CFITCK_UnrelatedCast, SanitizerKind::SO_CFIUnrelatedCast},
{CFITCK_ICall, SanitizerKind::SO_CFIICall}};
- SmallVector<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>, 5>
- Checks;
for (auto CheckKindOrdinalPair : CheckKinds) {
int Kind = CheckKindOrdinalPair.first;
SanitizerKind::SanitizerOrdinal Ordinal = CheckKindOrdinalPair.second;
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 87b2a73fb0c03..7917cdb7e12b6 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1814,7 +1814,6 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
// We'll need to enter cleanup scopes in case any of the element
// initializers throws an exception.
- SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
CodeGenFunction::CleanupDeactivationScope DeactivateCleanups(CGF);
unsigned curInitIndex = 0;
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 6136417fcad60..f6608faaa7309 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -446,7 +446,6 @@ static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
// HLSL neither supports priorities or COMDat values, so we will check those
// in an assert but not handle them.
- llvm::SmallVector<Function *> CtorFns;
for (const auto &Ctor : CA->operands()) {
if (isa<ConstantAggregateZero>(Ctor))
continue;
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 33f6b0470061f..e03539d1ccdd0 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -3827,8 +3827,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
} else {
SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty);
}
- // Empty vector used to construct empty method lists
- SmallVector<llvm::Constant*, 1> empty;
// Generate the method and instance variable lists
llvm::Constant *MethodList = GenerateMethodList(ClassName, "",
InstanceMethods, false);
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index cd3ded088ee27..803c7ed37635e 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3495,7 +3495,6 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
Ordered = true;
}
- llvm::DenseSet<const Expr *> EmittedFinals;
emitAlignedClause(*this, S);
bool HasLinears = EmitOMPLinearClauseInit(S);
// Emit helper vars inits.
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0406142fa916b..109316d0a27e7 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2533,7 +2533,6 @@ static void GetSDLFromOffloadArchive(
C.addTempFile(C.getArgs().MakeArgString(OutputLib));
- ArgStringList CmdArgs;
SmallString<128> DeviceTriple;
DeviceTriple += Action::GetOffloadKindName(JA.getOffloadingDeviceKind());
DeviceTriple += '-';
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index b71e27c20043a..e4466211686a9 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -287,7 +287,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
for (Arg *A : Args) {
if (A->getOption().getID() == options::OPT_dxil_validator_version) {
StringRef ValVerStr = A->getValue();
- std::string ErrorMsg;
if (!isLegalValidatorVersion(ValVerStr, getDriver()))
continue;
}
diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp
index 1cfa2a8f43b9d..ab9c1f5ad4ea1 100644
--- a/clang/lib/Driver/ToolChains/OHOS.cpp
+++ b/clang/lib/Driver/ToolChains/OHOS.cpp
@@ -303,7 +303,6 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
// Third try the effective triple.
P.assign(D.ResourceDir);
- std::string SysRoot = computeSysRoot();
llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple),
SelectedMultilib.gccSuffix());
Paths.push_back(P.c_str());
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1f297f228fc1b..e083c1a896804 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -974,7 +974,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::GNUstep) {
auto version = LangOpts.ObjCRuntime.getVersion();
- std::string versionString = "1";
// Don't rely on the tuple argument, because we can be asked to target
// later ABIs than we actually support, so clamp these values to those
// currently supported
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 6468e62889413..384d167cbcf88 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -3659,7 +3659,6 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
std::optional<LexEmbedParametersResult>
Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
LexEmbedParametersResult Result{};
- SmallVector<Token, 2> ParameterTokens;
tok::TokenKind EndTokenKind = ForHasEmbed ? tok::r_paren : tok::eod;
auto DiagMismatchedBracesAndSkipToEOD =
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 9f9e4bb92af8c..69f3568cfdba7 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -3455,7 +3455,6 @@ void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) {
Token PragmaName = Tok;
- SmallVector<Token, 1> TokenList;
if (!PP.getTargetInfo().hasStrictFP() && !PP.getLangOpts().ExpStrictFP) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_fp_ignored)
<< PragmaName.getIdentifierInfo()->getName();
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index ed10730ef986b..f9f7c192f19d2 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4837,7 +4837,6 @@ void SemaCodeCompletion::CodeCompleteAttribute(
// We skip this if the scope was already spelled and not guarded, or
// we must spell it and can't guard it.
if (!(InScope && !InScopeUnderscore) && SyntaxSupportsGuards) {
- llvm::SmallString<32> Guarded;
if (Scope.empty()) {
Add(Scope, Name, /*Underscores=*/true);
} else {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index d9d535c22fc40..bfb3ee9dcbd16 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -851,7 +851,6 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
StringRef WarningGroup;
- SmallVector<StringRef, 2> Options;
if (AL.getNumArgs() > 3) {
if (!S.checkStringLiteralArgumentAttr(AL, 3, WarningGroup))
return;
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index a4698f76af4eb..9dbc3efbca405 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3589,7 +3589,6 @@ ObjCMethodDecl *SemaObjC::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
// Gather the non-hidden methods.
ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
- SmallVector<ObjCMethodDecl *, 4> Methods;
for (ObjCMethodList *M = &MethList; M; M = M->getNext()) {
if (M->getMethod() && M->getMethod()->isUnconditionallyVisible())
return M->getMethod();
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 160fbddbdff15..e5670dab03cb0 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -5842,7 +5842,6 @@ static void TryOrBuildParenListInitialization(
if (const ArrayType *AT =
S.getASTContext().getAsArrayType(Entity.getType())) {
- SmallVector<InitializedEntity, 4> ElementEntities;
uint64_t ArrayLength;
// C++ [dcl.init]p16.5
// if the destination type is an array, the object is initialized as
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index c261d291ea142..835dba22a858d 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -5777,7 +5777,6 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
// Check for the default mapper for data members.
if (S.getLangOpts().OpenMP < 50)
return;
- SmallVector<OMPClause *, 4> ImplicitMaps;
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
if (!C)
@@ -14901,8 +14900,6 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
std::string OrigVarName = OrigVar->getNameInfo().getAsString();
std::string OuterIVName = (Twine(".unrolled.iv.") + OrigVarName).str();
std::string InnerIVName = (Twine(".unroll_inner.iv.") + OrigVarName).str();
- std::string InnerTripCountName =
- (Twine(".unroll_inner.tripcount.") + OrigVarName).str();
// Create the iteration variable for the unrolled loop.
VarDecl *OuterIVDecl =
@@ -15317,9 +15314,7 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
assert(LoopHelper.Counters.size() == 1 &&
"Single-dimensional loop iteration space expected");
- auto *OrigCntVar = cast<DeclRefExpr>(LoopHelper.Counters.front());
- std::string OrigVarName = OrigCntVar->getNameInfo().getAsString();
addLoopPreInits(Context, LoopHelper, LoopStmts[I], OriginalInits[I],
PreInits);
}
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index cda521808d1de..106a652049b07 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10188,8 +10188,6 @@ void ASTReader::ReadComments() {
}
}
NextCursor:
- llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
- FileToOffsetToComment;
for (RawComment *C : Comments) {
SourceLocation CommentLoc = C->getBeginLoc();
if (CommentLoc.isValid()) {
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 2772038bf3755..8c5adc3959398 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5599,7 +5599,6 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
// Writing all of the tentative definitions in this file, in
// TentativeDefinitions order. Generally, this record will be empty for
// headers.
- RecordData TentativeDefinitions;
AddLazyVectorDecls(*this, SemaRef.TentativeDefinitions);
// Writing all of the file scoped decls in this file.
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index 1b61370a580d9..5915c8f3aaace 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -154,7 +154,6 @@ const NoteTag *taintOriginTrackerTag(CheckerContext &C,
return C.getNoteTag([TaintedSymbols = std::move(TaintedSymbols),
TaintedArgs = std::move(TaintedArgs), CallLocation](
PathSensitiveBugReport &BR) -> std::string {
- SmallString<256> Msg;
// We give diagnostics only for taint related reports
if (!BR.isInteresting(CallLocation) ||
BR.getBugType().getCategory() != categories::TaintedData) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
index ddcf0469e030e..e9abc9ab2a1f9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
@@ -972,7 +972,6 @@ void NonLocalizedStringChecker::checkPostObjCMessage(const ObjCMethodCall &msg,
const IdentifierInfo *odInfo = OD->getIdentifier();
Selector S = msg.getSelector();
- std::string SelectorName = S.getAsString();
std::pair<const IdentifierInfo *, Selector> MethodDescription = {odInfo, S};
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index b3016f90122df..45901cbcedcb7 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -577,7 +577,6 @@ static std::string getModuleContextHash(const ModuleDeps &MD,
llvm::vfs::FileSystem &VFS) {
llvm::HashBuilder<llvm::TruncatedBLAKE3<16>, llvm::endianness::native>
HashBuilder;
- SmallString<32> Scratch;
// Hash the compiler version and serialization version to ensure the module
// will be readable.
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 809000a5086b1..ef4097888bc47 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4689,7 +4689,6 @@ static const ExprEvalResult *evaluateExpr(Expr *expr, CXCursor C) {
if (ER.Val.isFloat()) {
llvm::SmallVector<char, 100> Buffer;
ER.Val.getFloat().toString(Buffer);
- std::string floatStr(Buffer.data(), Buffer.size());
result->EvalType = CXEval_Float;
bool ignored;
llvm::APFloat apFloat = ER.Val.getFloat();
diff --git a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
index aed49a1f5f78d..434c1d1526a22 100644
--- a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
+++ b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
@@ -361,15 +361,8 @@ TEST(CallDescription, AliasNames) {
std::cont v;
v.data();
})code";
- constexpr StringRef UseStructNameInSpelling = R"code(
- void foo() {
- std::container v;
- v.data();
- })code";
const std::string UseAliasInSpellingCode =
(Twine{AliasNamesCode} + UseAliasInSpelling).str();
- const std::string UseStructNameInSpellingCode =
- (Twine{AliasNamesCode} + UseStructNameInSpelling).str();
// Test if the code spells the alias, wile we match against the struct name,
// and again matching against the alias.
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index b7f7f8f0b2fe2..9684ec9520e5a 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -4638,7 +4638,6 @@ static void GenerateSpellingIndexToSemanticSpelling(const Record &Attr,
// Generate the enumeration we will use for the mapping.
SemanticSpellingMap SemanticToSyntacticMap;
std::string Enum = CreateSemanticSpellings(Spellings, SemanticToSyntacticMap);
- std::string Name = Attr.getName().str() + "AttrSpellingMap";
OS << "unsigned spellingIndexToSemanticSpelling(";
OS << "const ParsedAttr &Attr) const override {\n";
|
@llvm/pr-subscribers-hlsl Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138453.diff 27 Files Affected:
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 1e4e055e04afd..6235473d19a31 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -1949,7 +1949,6 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) {
analyze_os_log::OSLogBufferLayout Layout;
analyze_os_log::computeOSLogBufferLayout(Ctx, &E, Layout);
Address BufAddr = EmitPointerWithAlignment(E.getArg(0));
- llvm::SmallVector<llvm::Value *, 4> RetainableOperands;
// Ignore argument 1, the format string. It is not currently used.
CallArgList Args;
diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp
index 395263331d141..dd26be74e561b 100644
--- a/clang/lib/CodeGen/CGCUDANV.cpp
+++ b/clang/lib/CodeGen/CGCUDANV.cpp
@@ -1194,7 +1194,6 @@ void CGNVCUDARuntime::transformManagedVars() {
// registered. The linker will provide a pointer to this section so we can
// register the symbols with the linked device image.
void CGNVCUDARuntime::createOffloadingEntries() {
- SmallVector<char, 32> Out;
llvm::object::OffloadKind Kind = CGM.getLangOpts().HIP
? llvm::object::OffloadKind::OFK_HIP
: llvm::object::OffloadKind::OFK_Cuda;
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 8a214da6bf628..69d77f283db3b 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -748,7 +748,6 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) {
// Add any initializers with specified priority; this uses the same approach
// as EmitCXXGlobalInitFunc().
if (!PrioritizedCXXGlobalInits.empty()) {
- SmallVector<llvm::Function *, 8> LocalCXXGlobalInits;
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
PrioritizedCXXGlobalInits.end());
for (SmallVectorImpl<GlobalInitData>::iterator
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index bba7d1e805f3f..2e01adc51fdf0 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3955,8 +3955,6 @@ void CodeGenFunction::EmitCfiCheckFail() {
{CFITCK_UnrelatedCast, SanitizerKind::SO_CFIUnrelatedCast},
{CFITCK_ICall, SanitizerKind::SO_CFIICall}};
- SmallVector<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>, 5>
- Checks;
for (auto CheckKindOrdinalPair : CheckKinds) {
int Kind = CheckKindOrdinalPair.first;
SanitizerKind::SanitizerOrdinal Ordinal = CheckKindOrdinalPair.second;
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 87b2a73fb0c03..7917cdb7e12b6 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1814,7 +1814,6 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
// We'll need to enter cleanup scopes in case any of the element
// initializers throws an exception.
- SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
CodeGenFunction::CleanupDeactivationScope DeactivateCleanups(CGF);
unsigned curInitIndex = 0;
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 6136417fcad60..f6608faaa7309 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -446,7 +446,6 @@ static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
// HLSL neither supports priorities or COMDat values, so we will check those
// in an assert but not handle them.
- llvm::SmallVector<Function *> CtorFns;
for (const auto &Ctor : CA->operands()) {
if (isa<ConstantAggregateZero>(Ctor))
continue;
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 33f6b0470061f..e03539d1ccdd0 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -3827,8 +3827,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
} else {
SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty);
}
- // Empty vector used to construct empty method lists
- SmallVector<llvm::Constant*, 1> empty;
// Generate the method and instance variable lists
llvm::Constant *MethodList = GenerateMethodList(ClassName, "",
InstanceMethods, false);
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index cd3ded088ee27..803c7ed37635e 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -3495,7 +3495,6 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
Ordered = true;
}
- llvm::DenseSet<const Expr *> EmittedFinals;
emitAlignedClause(*this, S);
bool HasLinears = EmitOMPLinearClauseInit(S);
// Emit helper vars inits.
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 0406142fa916b..109316d0a27e7 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2533,7 +2533,6 @@ static void GetSDLFromOffloadArchive(
C.addTempFile(C.getArgs().MakeArgString(OutputLib));
- ArgStringList CmdArgs;
SmallString<128> DeviceTriple;
DeviceTriple += Action::GetOffloadKindName(JA.getOffloadingDeviceKind());
DeviceTriple += '-';
diff --git a/clang/lib/Driver/ToolChains/HLSL.cpp b/clang/lib/Driver/ToolChains/HLSL.cpp
index b71e27c20043a..e4466211686a9 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -287,7 +287,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
for (Arg *A : Args) {
if (A->getOption().getID() == options::OPT_dxil_validator_version) {
StringRef ValVerStr = A->getValue();
- std::string ErrorMsg;
if (!isLegalValidatorVersion(ValVerStr, getDriver()))
continue;
}
diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp
index 1cfa2a8f43b9d..ab9c1f5ad4ea1 100644
--- a/clang/lib/Driver/ToolChains/OHOS.cpp
+++ b/clang/lib/Driver/ToolChains/OHOS.cpp
@@ -303,7 +303,6 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
// Third try the effective triple.
P.assign(D.ResourceDir);
- std::string SysRoot = computeSysRoot();
llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple),
SelectedMultilib.gccSuffix());
Paths.push_back(P.c_str());
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 1f297f228fc1b..e083c1a896804 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -974,7 +974,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::GNUstep) {
auto version = LangOpts.ObjCRuntime.getVersion();
- std::string versionString = "1";
// Don't rely on the tuple argument, because we can be asked to target
// later ABIs than we actually support, so clamp these values to those
// currently supported
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 6468e62889413..384d167cbcf88 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -3659,7 +3659,6 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
std::optional<LexEmbedParametersResult>
Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
LexEmbedParametersResult Result{};
- SmallVector<Token, 2> ParameterTokens;
tok::TokenKind EndTokenKind = ForHasEmbed ? tok::r_paren : tok::eod;
auto DiagMismatchedBracesAndSkipToEOD =
diff --git a/clang/lib/Parse/ParsePragma.cpp b/clang/lib/Parse/ParsePragma.cpp
index 9f9e4bb92af8c..69f3568cfdba7 100644
--- a/clang/lib/Parse/ParsePragma.cpp
+++ b/clang/lib/Parse/ParsePragma.cpp
@@ -3455,7 +3455,6 @@ void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &Tok) {
Token PragmaName = Tok;
- SmallVector<Token, 1> TokenList;
if (!PP.getTargetInfo().hasStrictFP() && !PP.getLangOpts().ExpStrictFP) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_fp_ignored)
<< PragmaName.getIdentifierInfo()->getName();
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index ed10730ef986b..f9f7c192f19d2 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -4837,7 +4837,6 @@ void SemaCodeCompletion::CodeCompleteAttribute(
// We skip this if the scope was already spelled and not guarded, or
// we must spell it and can't guard it.
if (!(InScope && !InScopeUnderscore) && SyntaxSupportsGuards) {
- llvm::SmallString<32> Guarded;
if (Scope.empty()) {
Add(Scope, Name, /*Underscores=*/true);
} else {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index d9d535c22fc40..bfb3ee9dcbd16 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -851,7 +851,6 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
StringRef WarningGroup;
- SmallVector<StringRef, 2> Options;
if (AL.getNumArgs() > 3) {
if (!S.checkStringLiteralArgumentAttr(AL, 3, WarningGroup))
return;
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index a4698f76af4eb..9dbc3efbca405 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -3589,7 +3589,6 @@ ObjCMethodDecl *SemaObjC::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
// Gather the non-hidden methods.
ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
- SmallVector<ObjCMethodDecl *, 4> Methods;
for (ObjCMethodList *M = &MethList; M; M = M->getNext()) {
if (M->getMethod() && M->getMethod()->isUnconditionallyVisible())
return M->getMethod();
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 160fbddbdff15..e5670dab03cb0 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -5842,7 +5842,6 @@ static void TryOrBuildParenListInitialization(
if (const ArrayType *AT =
S.getASTContext().getAsArrayType(Entity.getType())) {
- SmallVector<InitializedEntity, 4> ElementEntities;
uint64_t ArrayLength;
// C++ [dcl.init]p16.5
// if the destination type is an array, the object is initialized as
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index c261d291ea142..835dba22a858d 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -5777,7 +5777,6 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
// Check for the default mapper for data members.
if (S.getLangOpts().OpenMP < 50)
return;
- SmallVector<OMPClause *, 4> ImplicitMaps;
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
if (!C)
@@ -14901,8 +14900,6 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
std::string OrigVarName = OrigVar->getNameInfo().getAsString();
std::string OuterIVName = (Twine(".unrolled.iv.") + OrigVarName).str();
std::string InnerIVName = (Twine(".unroll_inner.iv.") + OrigVarName).str();
- std::string InnerTripCountName =
- (Twine(".unroll_inner.tripcount.") + OrigVarName).str();
// Create the iteration variable for the unrolled loop.
VarDecl *OuterIVDecl =
@@ -15317,9 +15314,7 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
assert(LoopHelper.Counters.size() == 1 &&
"Single-dimensional loop iteration space expected");
- auto *OrigCntVar = cast<DeclRefExpr>(LoopHelper.Counters.front());
- std::string OrigVarName = OrigCntVar->getNameInfo().getAsString();
addLoopPreInits(Context, LoopHelper, LoopStmts[I], OriginalInits[I],
PreInits);
}
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index cda521808d1de..106a652049b07 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10188,8 +10188,6 @@ void ASTReader::ReadComments() {
}
}
NextCursor:
- llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
- FileToOffsetToComment;
for (RawComment *C : Comments) {
SourceLocation CommentLoc = C->getBeginLoc();
if (CommentLoc.isValid()) {
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 2772038bf3755..8c5adc3959398 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5599,7 +5599,6 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
// Writing all of the tentative definitions in this file, in
// TentativeDefinitions order. Generally, this record will be empty for
// headers.
- RecordData TentativeDefinitions;
AddLazyVectorDecls(*this, SemaRef.TentativeDefinitions);
// Writing all of the file scoped decls in this file.
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index 1b61370a580d9..5915c8f3aaace 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -154,7 +154,6 @@ const NoteTag *taintOriginTrackerTag(CheckerContext &C,
return C.getNoteTag([TaintedSymbols = std::move(TaintedSymbols),
TaintedArgs = std::move(TaintedArgs), CallLocation](
PathSensitiveBugReport &BR) -> std::string {
- SmallString<256> Msg;
// We give diagnostics only for taint related reports
if (!BR.isInteresting(CallLocation) ||
BR.getBugType().getCategory() != categories::TaintedData) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
index ddcf0469e030e..e9abc9ab2a1f9 100644
--- a/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
@@ -972,7 +972,6 @@ void NonLocalizedStringChecker::checkPostObjCMessage(const ObjCMethodCall &msg,
const IdentifierInfo *odInfo = OD->getIdentifier();
Selector S = msg.getSelector();
- std::string SelectorName = S.getAsString();
std::pair<const IdentifierInfo *, Selector> MethodDescription = {odInfo, S};
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index b3016f90122df..45901cbcedcb7 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -577,7 +577,6 @@ static std::string getModuleContextHash(const ModuleDeps &MD,
llvm::vfs::FileSystem &VFS) {
llvm::HashBuilder<llvm::TruncatedBLAKE3<16>, llvm::endianness::native>
HashBuilder;
- SmallString<32> Scratch;
// Hash the compiler version and serialization version to ensure the module
// will be readable.
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 809000a5086b1..ef4097888bc47 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -4689,7 +4689,6 @@ static const ExprEvalResult *evaluateExpr(Expr *expr, CXCursor C) {
if (ER.Val.isFloat()) {
llvm::SmallVector<char, 100> Buffer;
ER.Val.getFloat().toString(Buffer);
- std::string floatStr(Buffer.data(), Buffer.size());
result->EvalType = CXEval_Float;
bool ignored;
llvm::APFloat apFloat = ER.Val.getFloat();
diff --git a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
index aed49a1f5f78d..434c1d1526a22 100644
--- a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
+++ b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
@@ -361,15 +361,8 @@ TEST(CallDescription, AliasNames) {
std::cont v;
v.data();
})code";
- constexpr StringRef UseStructNameInSpelling = R"code(
- void foo() {
- std::container v;
- v.data();
- })code";
const std::string UseAliasInSpellingCode =
(Twine{AliasNamesCode} + UseAliasInSpelling).str();
- const std::string UseStructNameInSpellingCode =
- (Twine{AliasNamesCode} + UseStructNameInSpelling).str();
// Test if the code spells the alias, wile we match against the struct name,
// and again matching against the alias.
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index b7f7f8f0b2fe2..9684ec9520e5a 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -4638,7 +4638,6 @@ static void GenerateSpellingIndexToSemanticSpelling(const Record &Attr,
// Generate the enumeration we will use for the mapping.
SemanticSpellingMap SemanticToSyntacticMap;
std::string Enum = CreateSemanticSpellings(Spellings, SemanticToSyntacticMap);
- std::string Name = Attr.getName().str() + "AttrSpellingMap";
OS << "unsigned spellingIndexToSemanticSpelling(";
OS << "const ParsedAttr &Attr) const override {\n";
|
No description provided.