Skip to content

Commit

Permalink
Fixes some instances of auto usage with unintentional copy
Browse files Browse the repository at this point in the history
Just switch the uses over to `const auto&`
  • Loading branch information
Sonicadvance1 committed Feb 13, 2025
1 parent 6651f9e commit 7cd4d53
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FEXCore/Source/Interface/IR/AOTIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ bool AOTIRCaptureCache::PostCompileCode(FEXCore::Core::InternalThreadState* Thre

auto LocalRIP = GuestRIP - AOTIRCacheEntry.VAFileStart;
auto LocalStartAddr = StartAddr - AOTIRCacheEntry.VAFileStart;
auto FileId = AOTIRCacheEntry.Entry->FileId;
const auto& FileId = AOTIRCacheEntry.Entry->FileId;

// The lambda is converted to std::function. This is tricky to refactor so it doesn't allocate memory through glibc.
// NOTE: unique_ptr must be passed as a raw pointer since std::function requires lambda captures to be copyable
Expand Down
2 changes: 1 addition & 1 deletion FEXCore/Source/Interface/IR/Passes/IRDumperPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class IRDumper final : public FEXCore::IR::Pass {
};

IRDumper::IRDumper() {
const auto DumpIRStr = DumpIR();
const auto& DumpIRStr = DumpIR();
if (DumpIRStr == "stderr" || DumpIRStr == "stdout" || DumpIRStr == "no") {
// Intentionally do nothing
} else if (DumpIRStr == "server") {
Expand Down
2 changes: 1 addition & 1 deletion FEXCore/Source/Utils/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void Initialize() {
return;
}

auto DataDirectory = Config::GetTelemetryDirectory();
const auto& DataDirectory = Config::GetTelemetryDirectory();

// Ensure the folder structure is created for our configuration
if (!FHU::Filesystem::Exists(DataDirectory) && !FHU::Filesystem::CreateDirectories(DataDirectory)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/CodeSizeValidation/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static bool TestInstructions(FEXCore::Context::Context* CTX, FEXCore::Core::Inte
bool ShouldShowCode = INSTStats->first.HostCodeInstructions != CurrentTest->ExpectedInstructionCount;

if (ShouldShowCode) {
for (auto Line : INSTStats->second) {
for (const auto& Line : INSTStats->second) {
LogMan::Msg::EFmt("\t{}", Line);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/FEXLoader/FEXLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int main(int argc, char** argv, char** const envp) {
LogMan::Throw::UnInstallHandler();
LogMan::Msg::UnInstallHandler();
} else {
auto LogFile = OutputLog();
const auto& LogFile = OutputLog();
// If stderr or stdout then we need to dup the FD
// In some cases some applications will close stderr and stdout
// then redirect the FD to either a log OR some cases just not use
Expand Down
2 changes: 1 addition & 1 deletion Source/Tools/FEXRootFSFetcher/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ParseArguments(int argc, char** argv) {
}

if (Options.is_set_by_user("force_ui")) {
auto Option = Options["force_ui"];
const auto& Option = Options["force_ui"];
if (Option == "tty") {
UIOption = UIOverrideOption::TTY;
} else if (Option == "zenity") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ FileManager::FileManager(FEXCore::Context::Context* ctx)
}

// Now that we loaded the thunks object, walk through and ensure dependencies are enabled as well
auto ThunkGuestPath = Is64BitMode() ? ThunkGuestLibs() : ThunkGuestLibs32();
const auto& ThunkGuestPath = Is64BitMode() ? ThunkGuestLibs() : ThunkGuestLibs32();
for (const auto& DBObject : ThunkDB) {
if (!DBObject.second.Enabled) {
continue;
Expand Down

0 comments on commit 7cd4d53

Please sign in to comment.