Skip to content

Commit f002f30

Browse files
[clang] Remove unused local variables (NFC) (#138453)
1 parent 46c7306 commit f002f30

27 files changed

+0
-40
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,6 @@ RValue CodeGenFunction::emitBuiltinOSLogFormat(const CallExpr &E) {
19491949
analyze_os_log::OSLogBufferLayout Layout;
19501950
analyze_os_log::computeOSLogBufferLayout(Ctx, &E, Layout);
19511951
Address BufAddr = EmitPointerWithAlignment(E.getArg(0));
1952-
llvm::SmallVector<llvm::Value *, 4> RetainableOperands;
19531952

19541953
// Ignore argument 1, the format string. It is not currently used.
19551954
CallArgList Args;

clang/lib/CodeGen/CGCUDANV.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,6 @@ void CGNVCUDARuntime::transformManagedVars() {
11941194
// registered. The linker will provide a pointer to this section so we can
11951195
// register the symbols with the linked device image.
11961196
void CGNVCUDARuntime::createOffloadingEntries() {
1197-
SmallVector<char, 32> Out;
11981197
llvm::object::OffloadKind Kind = CGM.getLangOpts().HIP
11991198
? llvm::object::OffloadKind::OFK_HIP
12001199
: llvm::object::OffloadKind::OFK_Cuda;

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ void CodeGenModule::EmitCXXModuleInitFunc(Module *Primary) {
748748
// Add any initializers with specified priority; this uses the same approach
749749
// as EmitCXXGlobalInitFunc().
750750
if (!PrioritizedCXXGlobalInits.empty()) {
751-
SmallVector<llvm::Function *, 8> LocalCXXGlobalInits;
752751
llvm::array_pod_sort(PrioritizedCXXGlobalInits.begin(),
753752
PrioritizedCXXGlobalInits.end());
754753
for (SmallVectorImpl<GlobalInitData>::iterator

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3955,8 +3955,6 @@ void CodeGenFunction::EmitCfiCheckFail() {
39553955
{CFITCK_UnrelatedCast, SanitizerKind::SO_CFIUnrelatedCast},
39563956
{CFITCK_ICall, SanitizerKind::SO_CFIICall}};
39573957

3958-
SmallVector<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>, 5>
3959-
Checks;
39603958
for (auto CheckKindOrdinalPair : CheckKinds) {
39613959
int Kind = CheckKindOrdinalPair.first;
39623960
SanitizerKind::SanitizerOrdinal Ordinal = CheckKindOrdinalPair.second;

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1814,7 +1814,6 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
18141814

18151815
// We'll need to enter cleanup scopes in case any of the element
18161816
// initializers throws an exception.
1817-
SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
18181817
CodeGenFunction::CleanupDeactivationScope DeactivateCleanups(CGF);
18191818

18201819
unsigned curInitIndex = 0;

clang/lib/CodeGen/CGHLSLRuntime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
446446
// HLSL neither supports priorities or COMDat values, so we will check those
447447
// in an assert but not handle them.
448448

449-
llvm::SmallVector<Function *> CtorFns;
450449
for (const auto &Ctor : CA->operands()) {
451450
if (isa<ConstantAggregateZero>(Ctor))
452451
continue;

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3827,8 +3827,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
38273827
} else {
38283828
SuperClass = llvm::ConstantPointerNull::get(PtrToInt8Ty);
38293829
}
3830-
// Empty vector used to construct empty method lists
3831-
SmallVector<llvm::Constant*, 1> empty;
38323830
// Generate the method and instance variable lists
38333831
llvm::Constant *MethodList = GenerateMethodList(ClassName, "",
38343832
InstanceMethods, false);

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3495,7 +3495,6 @@ bool CodeGenFunction::EmitOMPWorksharingLoop(
34953495
Ordered = true;
34963496
}
34973497

3498-
llvm::DenseSet<const Expr *> EmittedFinals;
34993498
emitAlignedClause(*this, S);
35003499
bool HasLinears = EmitOMPLinearClauseInit(S);
35013500
// Emit helper vars inits.

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2533,7 +2533,6 @@ static void GetSDLFromOffloadArchive(
25332533

25342534
C.addTempFile(C.getArgs().MakeArgString(OutputLib));
25352535

2536-
ArgStringList CmdArgs;
25372536
SmallString<128> DeviceTriple;
25382537
DeviceTriple += Action::GetOffloadKindName(JA.getOffloadingDeviceKind());
25392538
DeviceTriple += '-';

clang/lib/Driver/ToolChains/HLSL.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ HLSLToolChain::TranslateArgs(const DerivedArgList &Args, StringRef BoundArch,
287287
for (Arg *A : Args) {
288288
if (A->getOption().getID() == options::OPT_dxil_validator_version) {
289289
StringRef ValVerStr = A->getValue();
290-
std::string ErrorMsg;
291290
if (!isLegalValidatorVersion(ValVerStr, getDriver()))
292291
continue;
293292
}

clang/lib/Driver/ToolChains/OHOS.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ ToolChain::path_list OHOS::getRuntimePaths() const {
303303

304304
// Third try the effective triple.
305305
P.assign(D.ResourceDir);
306-
std::string SysRoot = computeSysRoot();
307306
llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple),
308307
SelectedMultilib.gccSuffix());
309308
Paths.push_back(P.c_str());

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,6 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
974974

975975
if (LangOpts.ObjCRuntime.getKind() == ObjCRuntime::GNUstep) {
976976
auto version = LangOpts.ObjCRuntime.getVersion();
977-
std::string versionString = "1";
978977
// Don't rely on the tuple argument, because we can be asked to target
979978
// later ABIs than we actually support, so clamp these values to those
980979
// currently supported

clang/lib/Lex/PPDirectives.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3659,7 +3659,6 @@ void Preprocessor::HandleElifFamilyDirective(Token &ElifToken,
36593659
std::optional<LexEmbedParametersResult>
36603660
Preprocessor::LexEmbedParameters(Token &CurTok, bool ForHasEmbed) {
36613661
LexEmbedParametersResult Result{};
3662-
SmallVector<Token, 2> ParameterTokens;
36633662
tok::TokenKind EndTokenKind = ForHasEmbed ? tok::r_paren : tok::eod;
36643663

36653664
auto DiagMismatchedBracesAndSkipToEOD =

clang/lib/Parse/ParsePragma.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3455,7 +3455,6 @@ void PragmaSTDC_FENV_ROUNDHandler::HandlePragma(Preprocessor &PP,
34553455
PragmaIntroducer Introducer,
34563456
Token &Tok) {
34573457
Token PragmaName = Tok;
3458-
SmallVector<Token, 1> TokenList;
34593458
if (!PP.getTargetInfo().hasStrictFP() && !PP.getLangOpts().ExpStrictFP) {
34603459
PP.Diag(Tok.getLocation(), diag::warn_pragma_fp_ignored)
34613460
<< PragmaName.getIdentifierInfo()->getName();

clang/lib/Sema/SemaCodeComplete.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4837,7 +4837,6 @@ void SemaCodeCompletion::CodeCompleteAttribute(
48374837
// We skip this if the scope was already spelled and not guarded, or
48384838
// we must spell it and can't guard it.
48394839
if (!(InScope && !InScopeUnderscore) && SyntaxSupportsGuards) {
4840-
llvm::SmallString<32> Guarded;
48414840
if (Scope.empty()) {
48424841
Add(Scope, Name, /*Underscores=*/true);
48434842
} else {

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,6 @@ static void handleDiagnoseIfAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
851851
}
852852

853853
StringRef WarningGroup;
854-
SmallVector<StringRef, 2> Options;
855854
if (AL.getNumArgs() > 3) {
856855
if (!S.checkStringLiteralArgumentAttr(AL, 3, WarningGroup))
857856
return;

clang/lib/Sema/SemaDeclObjC.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3589,7 +3589,6 @@ ObjCMethodDecl *SemaObjC::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
35893589

35903590
// Gather the non-hidden methods.
35913591
ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
3592-
SmallVector<ObjCMethodDecl *, 4> Methods;
35933592
for (ObjCMethodList *M = &MethList; M; M = M->getNext()) {
35943593
if (M->getMethod() && M->getMethod()->isUnconditionallyVisible())
35953594
return M->getMethod();

clang/lib/Sema/SemaInit.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5842,7 +5842,6 @@ static void TryOrBuildParenListInitialization(
58425842

58435843
if (const ArrayType *AT =
58445844
S.getASTContext().getAsArrayType(Entity.getType())) {
5845-
SmallVector<InitializedEntity, 4> ElementEntities;
58465845
uint64_t ArrayLength;
58475846
// C++ [dcl.init]p16.5
58485847
// if the destination type is an array, the object is initialized as

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5777,7 +5777,6 @@ processImplicitMapsWithDefaultMappers(Sema &S, DSAStackTy *Stack,
57775777
// Check for the default mapper for data members.
57785778
if (S.getLangOpts().OpenMP < 50)
57795779
return;
5780-
SmallVector<OMPClause *, 4> ImplicitMaps;
57815780
for (int Cnt = 0, EndCnt = Clauses.size(); Cnt < EndCnt; ++Cnt) {
57825781
auto *C = dyn_cast<OMPMapClause>(Clauses[Cnt]);
57835782
if (!C)
@@ -14901,8 +14900,6 @@ StmtResult SemaOpenMP::ActOnOpenMPUnrollDirective(ArrayRef<OMPClause *> Clauses,
1490114900
std::string OrigVarName = OrigVar->getNameInfo().getAsString();
1490214901
std::string OuterIVName = (Twine(".unrolled.iv.") + OrigVarName).str();
1490314902
std::string InnerIVName = (Twine(".unroll_inner.iv.") + OrigVarName).str();
14904-
std::string InnerTripCountName =
14905-
(Twine(".unroll_inner.tripcount.") + OrigVarName).str();
1490614903

1490714904
// Create the iteration variable for the unrolled loop.
1490814905
VarDecl *OuterIVDecl =
@@ -15317,9 +15314,7 @@ StmtResult SemaOpenMP::ActOnOpenMPInterchangeDirective(
1531715314

1531815315
assert(LoopHelper.Counters.size() == 1 &&
1531915316
"Single-dimensional loop iteration space expected");
15320-
auto *OrigCntVar = cast<DeclRefExpr>(LoopHelper.Counters.front());
1532115317

15322-
std::string OrigVarName = OrigCntVar->getNameInfo().getAsString();
1532315318
addLoopPreInits(Context, LoopHelper, LoopStmts[I], OriginalInits[I],
1532415319
PreInits);
1532515320
}

clang/lib/Serialization/ASTReader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10188,8 +10188,6 @@ void ASTReader::ReadComments() {
1018810188
}
1018910189
}
1019010190
NextCursor:
10191-
llvm::DenseMap<FileID, std::map<unsigned, RawComment *>>
10192-
FileToOffsetToComment;
1019310191
for (RawComment *C : Comments) {
1019410192
SourceLocation CommentLoc = C->getBeginLoc();
1019510193
if (CommentLoc.isValid()) {

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5599,7 +5599,6 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
55995599
// Writing all of the tentative definitions in this file, in
56005600
// TentativeDefinitions order. Generally, this record will be empty for
56015601
// headers.
5602-
RecordData TentativeDefinitions;
56035602
AddLazyVectorDecls(*this, SemaRef.TentativeDefinitions);
56045603

56055604
// Writing all of the file scoped decls in this file.

clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ const NoteTag *taintOriginTrackerTag(CheckerContext &C,
154154
return C.getNoteTag([TaintedSymbols = std::move(TaintedSymbols),
155155
TaintedArgs = std::move(TaintedArgs), CallLocation](
156156
PathSensitiveBugReport &BR) -> std::string {
157-
SmallString<256> Msg;
158157
// We give diagnostics only for taint related reports
159158
if (!BR.isInteresting(CallLocation) ||
160159
BR.getBugType().getCategory() != categories::TaintedData) {

clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,6 @@ void NonLocalizedStringChecker::checkPostObjCMessage(const ObjCMethodCall &msg,
972972
const IdentifierInfo *odInfo = OD->getIdentifier();
973973

974974
Selector S = msg.getSelector();
975-
std::string SelectorName = S.getAsString();
976975

977976
std::pair<const IdentifierInfo *, Selector> MethodDescription = {odInfo, S};
978977

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ static std::string getModuleContextHash(const ModuleDeps &MD,
577577
llvm::vfs::FileSystem &VFS) {
578578
llvm::HashBuilder<llvm::TruncatedBLAKE3<16>, llvm::endianness::native>
579579
HashBuilder;
580-
SmallString<32> Scratch;
581580

582581
// Hash the compiler version and serialization version to ensure the module
583582
// will be readable.

clang/tools/libclang/CIndex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4689,7 +4689,6 @@ static const ExprEvalResult *evaluateExpr(Expr *expr, CXCursor C) {
46894689
if (ER.Val.isFloat()) {
46904690
llvm::SmallVector<char, 100> Buffer;
46914691
ER.Val.getFloat().toString(Buffer);
4692-
std::string floatStr(Buffer.data(), Buffer.size());
46934692
result->EvalType = CXEval_Float;
46944693
bool ignored;
46954694
llvm::APFloat apFloat = ER.Val.getFloat();

clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,8 @@ TEST(CallDescription, AliasNames) {
361361
std::cont v;
362362
v.data();
363363
})code";
364-
constexpr StringRef UseStructNameInSpelling = R"code(
365-
void foo() {
366-
std::container v;
367-
v.data();
368-
})code";
369364
const std::string UseAliasInSpellingCode =
370365
(Twine{AliasNamesCode} + UseAliasInSpelling).str();
371-
const std::string UseStructNameInSpellingCode =
372-
(Twine{AliasNamesCode} + UseStructNameInSpelling).str();
373366

374367
// Test if the code spells the alias, wile we match against the struct name,
375368
// and again matching against the alias.

clang/utils/TableGen/ClangAttrEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4638,7 +4638,6 @@ static void GenerateSpellingIndexToSemanticSpelling(const Record &Attr,
46384638
// Generate the enumeration we will use for the mapping.
46394639
SemanticSpellingMap SemanticToSyntacticMap;
46404640
std::string Enum = CreateSemanticSpellings(Spellings, SemanticToSyntacticMap);
4641-
std::string Name = Attr.getName().str() + "AttrSpellingMap";
46424641

46434642
OS << "unsigned spellingIndexToSemanticSpelling(";
46444643
OS << "const ParsedAttr &Attr) const override {\n";

0 commit comments

Comments
 (0)