Remove unused variables in the monorepo (#204994)
https://github.com/llvm/llvm-project/pull/203084 adds diagnostics about unused variables to the libc++ containers. This patch is the fallout from the projects I tried to build with it.
This commit is contained in:
parent
35cfa14e38
commit
34bdee76b8
29 changed files with 12 additions and 71 deletions
|
|
@ -613,13 +613,6 @@ IncludeFixer::lookupCached(const SymbolID &ID) const {
|
|||
Index.lookup(Req, [&](const Symbol &Sym) { Matches.insert(Sym); });
|
||||
auto Syms = std::move(Matches).build();
|
||||
|
||||
std::vector<Fix> Fixes;
|
||||
if (!Syms.empty()) {
|
||||
auto &Matched = *Syms.begin();
|
||||
if (!Matched.IncludeHeaders.empty() && Matched.Definition &&
|
||||
Matched.CanonicalDeclaration.FileURI == Matched.Definition.FileURI)
|
||||
Fixes = fixesForSymbols(Syms);
|
||||
}
|
||||
auto E = LookupCache.try_emplace(ID, std::move(Syms));
|
||||
return &E.first->second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1078,9 +1078,6 @@ public:
|
|||
auto I = ConditionalExpansions.find(InstanceKey);
|
||||
// If existing instance of condition not found, add one.
|
||||
if (I == ConditionalExpansions.end()) {
|
||||
std::string InstanceSourceLine =
|
||||
getSourceLocationString(PP, InstanceLoc) + ":\n" +
|
||||
getSourceLine(PP, InstanceLoc) + "\n";
|
||||
ConditionalExpansions[InstanceKey] =
|
||||
ConditionalTracker(DirectiveKind, ConditionValue,
|
||||
ConditionUnexpandedHandle, InclusionPathHandle);
|
||||
|
|
|
|||
|
|
@ -534,7 +534,6 @@ void hexagon::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
std::string HexagonToolChain::getHexagonTargetDir(
|
||||
const std::string &InstalledDir,
|
||||
const SmallVectorImpl<std::string> &PrefixDirs) const {
|
||||
std::string InstallRelDir;
|
||||
const Driver &D = getDriver();
|
||||
|
||||
// Locate the rest of the toolchain ...
|
||||
|
|
|
|||
|
|
@ -2149,8 +2149,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
|
|||
ErrnoIrrelevant)
|
||||
.ArgConstraint(NotNull(ArgNo(0))));
|
||||
} else {
|
||||
const auto ReturnsZeroOrMinusOne =
|
||||
ConstraintSet{ReturnValueCondition(WithinRange, Range(-1, 0))};
|
||||
const auto ReturnsZero =
|
||||
ConstraintSet{ReturnValueCondition(WithinRange, SingleValue(0))};
|
||||
const auto ReturnsMinusOne =
|
||||
|
|
@ -2161,8 +2159,6 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
|
|||
ConstraintSet{ReturnValueCondition(WithinRange, Range(0, IntMax))};
|
||||
const auto ReturnsNonZero =
|
||||
ConstraintSet{ReturnValueCondition(OutOfRange, SingleValue(0))};
|
||||
const auto ReturnsFileDescriptor =
|
||||
ConstraintSet{ReturnValueCondition(WithinRange, Range(-1, IntMax))};
|
||||
const auto &ReturnsValidFileDescriptor = ReturnsNonnegative;
|
||||
|
||||
auto ValidFileDescriptorOrAtFdcwd = [&](ArgNo ArgN) {
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ std::tuple<Decl *, Decl *> ASTImporterTestBase::getImportedDecl(
|
|||
StringRef FromSrcCode, TestLanguage FromLang, StringRef ToSrcCode,
|
||||
TestLanguage ToLang, StringRef Identifier) {
|
||||
std::vector<std::string> FromArgs = getCommandLineArgsForLanguage(FromLang);
|
||||
std::vector<std::string> ToArgs = getCommandLineArgsForLanguage(ToLang);
|
||||
|
||||
FromTUs.emplace_back(FromSrcCode, InputFileName, FromArgs, Creator,
|
||||
ODRHandling);
|
||||
|
|
@ -185,7 +184,6 @@ TranslationUnitDecl *ASTImporterTestBase::getTuDecl(StringRef SrcCode,
|
|||
|
||||
TranslationUnitDecl *ASTImporterTestBase::getToTuDecl(StringRef ToSrcCode,
|
||||
TestLanguage ToLang) {
|
||||
std::vector<std::string> ToArgs = getCommandLineArgsForLanguage(ToLang);
|
||||
assert(!ToAST);
|
||||
lazyInitToAST(ToLang, ToSrcCode, OutputFileName);
|
||||
return ToAST->getASTContext().getTranslationUnitDecl();
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ TEST_F(CodeCompletionTest, TwoDecls) {
|
|||
|
||||
TEST_F(CodeCompletionTest, CompFunDeclsNoError) {
|
||||
auto Err = llvm::Error::success();
|
||||
auto comps = runComp("void app(", Err);
|
||||
runComp("void app(", Err);
|
||||
EXPECT_EQ((bool)Err, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,6 @@ int main() {
|
|||
std::vector<int> ints {};
|
||||
})cpp";
|
||||
|
||||
auto InsertedCode = insert(Code, "<vector>");
|
||||
EXPECT_EQ(Expected, insert(Code, "<vector>"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -627,7 +627,6 @@ public:
|
|||
|
||||
protected:
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
CommandObject::CommandMap::iterator pos;
|
||||
CommandObject *cmd_obj;
|
||||
|
||||
if (args.empty()) {
|
||||
|
|
@ -702,8 +701,6 @@ public:
|
|||
|
||||
protected:
|
||||
void DoExecute(Args &args, CommandReturnObject &result) override {
|
||||
CommandObject::CommandMap::iterator pos;
|
||||
|
||||
if (args.empty()) {
|
||||
result.AppendErrorWithFormat("must call '%s' with one or more valid user "
|
||||
"defined regular expression command names",
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ CommandObjectHelp::CommandOptions::GetDefinitions() {
|
|||
}
|
||||
|
||||
void CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) {
|
||||
CommandObject::CommandMap::iterator pos;
|
||||
CommandObject *cmd_obj;
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
|
||||
|
|
|
|||
|
|
@ -2962,7 +2962,6 @@ void CommandInterpreter::HandleCommandsFromFile(
|
|||
auto input_file_up =
|
||||
FileSystem::Instance().Open(cmd_file, File::eOpenOptionReadOnly);
|
||||
if (!input_file_up) {
|
||||
std::string error = llvm::toString(input_file_up.takeError());
|
||||
result.AppendErrorWithFormatv(
|
||||
"error: an error occurred read file '{0}': {1}\n", cmd_file_path,
|
||||
llvm::fmt_consume(input_file_up.takeError()));
|
||||
|
|
@ -3263,8 +3262,6 @@ void CommandInterpreter::FindCommandsForApropos(llvm::StringRef search_word,
|
|||
bool search_user_commands,
|
||||
bool search_alias_commands,
|
||||
bool search_user_mw_commands) {
|
||||
CommandObject::CommandMap::const_iterator pos;
|
||||
|
||||
if (search_builtin_commands)
|
||||
FindCommandsForApropos(search_word, commands_found, commands_help,
|
||||
m_command_dict);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ bool HexagonDYLDRendezvous::UpdateSOEntries() {
|
|||
|
||||
bool HexagonDYLDRendezvous::UpdateSOEntriesForAddition() {
|
||||
SOEntry entry;
|
||||
iterator pos;
|
||||
|
||||
assert(m_previous.state == eAdd);
|
||||
|
||||
|
|
@ -176,7 +175,6 @@ bool HexagonDYLDRendezvous::UpdateSOEntriesForAddition() {
|
|||
|
||||
bool HexagonDYLDRendezvous::UpdateSOEntriesForDeletion() {
|
||||
SOEntryList entry_list;
|
||||
iterator pos;
|
||||
|
||||
assert(m_previous.state == eDelete);
|
||||
|
||||
|
|
|
|||
|
|
@ -497,7 +497,6 @@ bool DYLDRendezvous::RemoveSOEntriesFromRemote(
|
|||
|
||||
bool DYLDRendezvous::AddSOEntries() {
|
||||
SOEntry entry;
|
||||
iterator pos;
|
||||
|
||||
assert(m_previous.state == eAdd);
|
||||
|
||||
|
|
@ -525,7 +524,6 @@ bool DYLDRendezvous::AddSOEntries() {
|
|||
|
||||
bool DYLDRendezvous::RemoveSOEntries() {
|
||||
SOEntryList entry_list;
|
||||
iterator pos;
|
||||
|
||||
assert(m_previous.state == eDelete);
|
||||
|
||||
|
|
|
|||
|
|
@ -156,15 +156,12 @@ GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
|
|||
__FUNCTION__);
|
||||
|
||||
ConnectionFileDescriptor file_conn;
|
||||
std::string hostname;
|
||||
packet.SetFilePos(::strlen("qLaunchGDBServer;"));
|
||||
llvm::StringRef name;
|
||||
llvm::StringRef value;
|
||||
std::optional<uint16_t> port;
|
||||
while (packet.GetNameColonValue(name, value)) {
|
||||
if (name == "host")
|
||||
hostname = std::string(value);
|
||||
else if (name == "port") {
|
||||
if (name == "port") {
|
||||
// Make the Optional valid so we can use its value
|
||||
port = 0;
|
||||
value.getAsInteger(0, *port);
|
||||
|
|
|
|||
|
|
@ -98,8 +98,6 @@ llvm::Error ProtocolServerMCP::Start(ProtocolServer::Connection connection) {
|
|||
auto listening_uris = m_listener->GetListeningConnectionURI();
|
||||
if (listening_uris.empty())
|
||||
return createStringError("failed to get listening connections");
|
||||
std::string address =
|
||||
llvm::join(m_listener->GetListeningConnectionURI(), ", ");
|
||||
|
||||
ServerInfo info{listening_uris[0]};
|
||||
llvm::Expected<ServerInfoHandle> server_info_handle = ServerInfo::Write(info);
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,6 @@ size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame,
|
|||
|
||||
StackFrameSP selected_frame_sp =
|
||||
m_thread.GetSelectedFrame(DoNoSelectMostRelevantFrame);
|
||||
std::string buffer;
|
||||
std::string marker;
|
||||
for (frame_idx = first_frame; frame_idx < last_frame; ++frame_idx) {
|
||||
frame_sp = GetFrameAtIndex(frame_idx);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ int main(int argc, char **argv) {
|
|||
if (spec.binaries.size() > 0)
|
||||
for (const Binary &binary : spec.binaries) {
|
||||
std::vector<uint8_t> segment_command_bytes;
|
||||
std::vector<uint8_t> payload_bytes;
|
||||
create_lc_note_binary_load_cmd(spec, segment_command_bytes, binary,
|
||||
lc_note_payload_bytes, payload_fileoff);
|
||||
payload_fileoff =
|
||||
|
|
@ -185,7 +184,6 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
if (spec.addressable_bits) {
|
||||
std::vector<uint8_t> segment_command_bytes;
|
||||
std::vector<uint8_t> payload_bytes;
|
||||
create_lc_note_addressable_bits(spec, segment_command_bytes,
|
||||
*spec.addressable_bits,
|
||||
lc_note_payload_bytes, payload_fileoff);
|
||||
|
|
|
|||
|
|
@ -188,7 +188,6 @@ private:
|
|||
|
||||
uint64_t NextSeqNo = 0;
|
||||
PendingJITDispatchResultsMap PendingJITDispatchResults;
|
||||
std::vector<sys::DynamicLibrary> Dylibs;
|
||||
};
|
||||
|
||||
} // end namespace orc
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ public:
|
|||
/// Generic task implementation.
|
||||
template <typename FnT> class GenericNamedTaskImpl : public GenericNamedTask {
|
||||
public:
|
||||
GenericNamedTaskImpl(FnT &&Fn, std::string DescBuffer)
|
||||
: Fn(std::forward<FnT>(Fn)), Desc(DescBuffer.c_str()),
|
||||
DescBuffer(std::move(DescBuffer)) {}
|
||||
GenericNamedTaskImpl(FnT &&Fn, std::string InDescBuffer)
|
||||
: Fn(std::forward<FnT>(Fn)), DescBuffer(std::move(InDescBuffer)),
|
||||
Desc(DescBuffer.c_str()) {}
|
||||
GenericNamedTaskImpl(FnT &&Fn, const char *Desc)
|
||||
: Fn(std::forward<FnT>(Fn)), Desc(Desc) {
|
||||
assert(Desc && "Description cannot be null");
|
||||
|
|
@ -71,8 +71,8 @@ public:
|
|||
|
||||
private:
|
||||
FnT Fn;
|
||||
const char *Desc;
|
||||
std::string DescBuffer;
|
||||
const char *Desc;
|
||||
};
|
||||
|
||||
/// Create a generic named task from a std::string description.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void DWARFCFIState::update(const MCCFIInstruction &Directive) {
|
|||
// updated row and following the previous rows. These middle rows are stored
|
||||
// in `PrecedingRows`. For now, there is no need to store these rows in the
|
||||
// state, so they are ignored in the end.
|
||||
dwarf::UnwindTable::RowContainer PrecedingRows;
|
||||
// dwarf::UnwindTable::RowContainer PrecedingRows;
|
||||
|
||||
// TODO: `.cfi_remember_state` and `.cfi_restore_state` directives are not
|
||||
// supported yet. The reason is that `parseRows` expects the stack of states
|
||||
|
|
|
|||
|
|
@ -88,7 +88,6 @@ static std::string DependencyInfoPath;
|
|||
static bool VersionOption;
|
||||
static bool NoWarningForNoSymbols;
|
||||
static bool WarningsAsErrors;
|
||||
static std::string IgnoredSyslibRoot;
|
||||
|
||||
static const std::array<std::string, 3> StandardSearchDirs{
|
||||
"/lib",
|
||||
|
|
@ -659,9 +658,6 @@ static void parseRawArgs(int Argc, char **Argv) {
|
|||
if (const opt::Arg *A = Args.getLastArg(OPT_dependencyInfoPath))
|
||||
DependencyInfoPath = A->getValue();
|
||||
|
||||
if (const opt::Arg *A = Args.getLastArg(OPT_ignoredSyslibRoot))
|
||||
IgnoredSyslibRoot = A->getValue();
|
||||
|
||||
LibraryOperation =
|
||||
Args.hasArg(OPT_static) ? Operation::Static : Operation::None;
|
||||
DeterministicOption = Args.hasArg(OPT_deterministicOption);
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ namespace llvm {
|
|||
namespace rc {
|
||||
|
||||
RCParser::ParserError::ParserError(const Twine &Expected, const LocIter CurLoc,
|
||||
const LocIter End)
|
||||
: ErrorLoc(CurLoc), FileEnd(End) {
|
||||
const LocIter End) {
|
||||
CurMessage = "Error parsing file: expected " + Expected.str() + ", got " +
|
||||
(CurLoc == End ? "<EOF>" : CurLoc->value()).str();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ public:
|
|||
|
||||
private:
|
||||
std::string CurMessage;
|
||||
LocIter ErrorLoc, FileEnd;
|
||||
};
|
||||
|
||||
explicit RCParser(std::vector<RCToken> TokenList);
|
||||
|
|
|
|||
|
|
@ -987,7 +987,6 @@ computeNotCoveredFunctions(const SymbolizedCoverage &Coverage) {
|
|||
|
||||
static std::set<FileFn>
|
||||
computeCoveredFunctions(const SymbolizedCoverage &Coverage) {
|
||||
auto AllFns = computeFunctions(Coverage.Points);
|
||||
std::set<FileFn> Result;
|
||||
|
||||
for (const auto &Point : Coverage.Points) {
|
||||
|
|
|
|||
|
|
@ -1170,7 +1170,7 @@ TEST(STLExtrasTest, getSingleElement) {
|
|||
}
|
||||
|
||||
TEST(STLExtrasTest, hasNItems) {
|
||||
const std::list<int> V0 = {}, V1 = {1}, V2 = {1, 2};
|
||||
const std::list<int> V0 = {}, V1 = {1};
|
||||
const std::list<int> V3 = {1, 3, 5};
|
||||
|
||||
EXPECT_TRUE(hasNItems(V0, 0));
|
||||
|
|
@ -1191,7 +1191,7 @@ TEST(STLExtrasTest, hasNItems) {
|
|||
}
|
||||
|
||||
TEST(STLExtras, hasNItemsOrMore) {
|
||||
const std::list<int> V0 = {}, V1 = {1}, V2 = {1, 2};
|
||||
const std::list<int> V1 = {1}, V2 = {1, 2};
|
||||
const std::list<int> V3 = {1, 3, 5};
|
||||
|
||||
EXPECT_TRUE(hasNItemsOrMore(V1, 1));
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ TEST_F(PassManagerTest, Basic) {
|
|||
|
||||
testing::internal::CaptureStderr();
|
||||
MPM.run(*M, MAM);
|
||||
std::string Output = testing::internal::GetCapturedStderr();
|
||||
testing::internal::GetCapturedStderr();
|
||||
|
||||
EXPECT_EQ((std::vector<int>{10, 16, 18, 20, 30, 36, 38, 40}), Counts);
|
||||
EXPECT_EQ(40, Count);
|
||||
|
|
|
|||
|
|
@ -81,10 +81,6 @@ TEST(TBDv3, ReadFile) {
|
|||
for (auto &&arch : Archs)
|
||||
Targets.emplace_back(Target(arch, Platform));
|
||||
EXPECT_EQ(Archs, File->getArchitectures());
|
||||
TargetToAttr Uuids = {{Target(AK_armv7, PLATFORM_UNKNOWN),
|
||||
"00000000-0000-0000-0000-000000000000"},
|
||||
{Target(AK_arm64, PLATFORM_UNKNOWN),
|
||||
"11111111-1111-1111-1111-111111111111"}};
|
||||
EXPECT_EQ(File->getPlatforms().size(), 1U);
|
||||
EXPECT_EQ(Platform, *File->getPlatforms().begin());
|
||||
EXPECT_EQ(std::string("Test.dylib"), File->getInstallName());
|
||||
|
|
@ -165,10 +161,6 @@ TEST(TBDv3, ReadMultipleDocuments) {
|
|||
for (auto &&arch : Archs)
|
||||
Targets.emplace_back(Target(arch, Platform));
|
||||
EXPECT_EQ(Archs, File->getArchitectures());
|
||||
TargetToAttr Uuids = {{Target(AK_armv7, PLATFORM_UNKNOWN),
|
||||
"00000000-0000-0000-0000-000000000000"},
|
||||
{Target(AK_arm64, PLATFORM_UNKNOWN),
|
||||
"11111111-1111-1111-1111-111111111111"}};
|
||||
EXPECT_EQ(File->getPlatforms().size(), 1U);
|
||||
EXPECT_EQ(Platform, *File->getPlatforms().begin());
|
||||
EXPECT_EQ(std::string("Test.dylib"), File->getInstallName());
|
||||
|
|
@ -358,7 +350,7 @@ TEST(TBDv3, WriteMultipleDocuments) {
|
|||
Document.addSymbol(EncodeKind::GlobalSymbol, "_sym3", Targets);
|
||||
Document.addSymbol(EncodeKind::GlobalSymbol, "_sym4", Targets);
|
||||
File.addDocument(std::make_shared<InterfaceFile>(std::move(Document)));
|
||||
|
||||
|
||||
SmallString<4096> Buffer;
|
||||
raw_svector_ostream OS(Buffer);
|
||||
Error Result = TextAPIWriter::writeToStream(OS, File);
|
||||
|
|
|
|||
|
|
@ -394,8 +394,6 @@ TEST(TBDv4, WriteMultipleDocuments) {
|
|||
Target(AK_i386, Platform),
|
||||
Target(AK_x86_64, Platform),
|
||||
};
|
||||
TargetToAttr Uuids = {{Targets[0], "00000000-0000-0000-0000-000000000002"},
|
||||
{Targets[1], "11111111-1111-1111-1111-111111111112"}};
|
||||
File.setInstallName("/System/Library/Frameworks/Umbrella.framework/Umbrella");
|
||||
File.setFileType(FileType::TBD_V4);
|
||||
File.addTargets(Targets);
|
||||
|
|
@ -409,8 +407,6 @@ TEST(TBDv4, WriteMultipleDocuments) {
|
|||
Targets[1]);
|
||||
|
||||
// Write Second Document
|
||||
Uuids = {{Targets[0], "00000000-0000-0000-0000-000000000000"},
|
||||
{Targets[1], "11111111-1111-1111-1111-111111111111"}};
|
||||
InterfaceFile Document;
|
||||
Document.setInstallName("/System/Library/Frameworks/A.framework/A");
|
||||
Document.setFileType(FileType::TBD_V4);
|
||||
|
|
|
|||
|
|
@ -6546,7 +6546,6 @@ calculateBoundsOffset(LLVM::ModuleTranslation &moduleTranslation,
|
|||
// to use or standardizing/canonicalizing the order of the bounds to compute
|
||||
// the offset may be useful in the future when there's other frontends with
|
||||
// different formats.
|
||||
std::vector<llvm::Value *> dimensionIndexSizeOffset;
|
||||
for (int i = bounds.size() - 1; i >= 0; --i) {
|
||||
if (auto boundOp = dyn_cast_if_present<omp::MapBoundsOp>(
|
||||
bounds[i].getDefiningOp())) {
|
||||
|
|
|
|||
|
|
@ -3429,7 +3429,6 @@ void OpEmitter::genCodeForAddingArgAndRegionForBuilder(
|
|||
});
|
||||
};
|
||||
if (op.getTrait("::mlir::OpTrait::AttrSizedOperandSegments")) {
|
||||
std::string sizes = op.getGetterName(operandSegmentAttrName);
|
||||
body << " ::llvm::copy(::llvm::ArrayRef<int32_t>({";
|
||||
emitSegment();
|
||||
body << "}), " << builderOpStateProperties
|
||||
|
|
|
|||
Loading…
Reference in a new issue