Skip to content

Commit 895668c

Browse files
committed
Remove use of auto in a bunch of places
1 parent 6f812ed commit 895668c

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ InstrumentationBoundsSafetyStopInfo::InstrumentationBoundsSafetyStopInfo(
9898
m_description = SOFT_TRAP_FALLBACK_CATEGORY;
9999

100100
bool warning_emitted_for_failure = false;
101-
auto [Description, MaybeSuggestedStackIndex] =
101+
auto [MaybeDescription, MaybeSuggestedStackIndex] =
102102
ComputeStopReasonAndSuggestedStackFrame(warning_emitted_for_failure);
103-
if (Description)
104-
m_description = Description.value();
103+
if (MaybeDescription)
104+
m_description = MaybeDescription.value();
105105
if (MaybeSuggestedStackIndex)
106106
m_value = MaybeSuggestedStackIndex.value();
107107

108108
// Emit warning about the failure to compute the stop info if one wasn't
109109
// already emitted.
110-
if ((!Description.has_value()) && !warning_emitted_for_failure) {
111-
if (auto thread_sp = GetThread()) {
110+
if ((!MaybeDescription.has_value()) && !warning_emitted_for_failure) {
111+
if (ThreadSP thread_sp = GetThread()) {
112112
lldb::user_id_t debugger_id =
113113
thread_sp->GetProcess()->GetTarget().GetDebugger().GetID();
114114
Debugger::ReportWarning(
@@ -121,7 +121,7 @@ InstrumentationBoundsSafetyStopInfo::InstrumentationBoundsSafetyStopInfo(
121121
std::pair<std::optional<std::string>, std::optional<uint32_t>>
122122
InstrumentationBoundsSafetyStopInfo::ComputeStopReasonAndSuggestedStackFrame(
123123
bool &warning_emitted_for_failure) {
124-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
124+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
125125
ThreadSP thread_sp = GetThread();
126126
if (!thread_sp) {
127127
LLDB_LOGF(log_category, "failed to get thread while stopped");
@@ -131,7 +131,7 @@ InstrumentationBoundsSafetyStopInfo::ComputeStopReasonAndSuggestedStackFrame(
131131
lldb::user_id_t debugger_id =
132132
thread_sp->GetProcess()->GetTarget().GetDebugger().GetID();
133133

134-
auto parent_sf = thread_sp->GetStackFrameAtIndex(1);
134+
StackFrameSP parent_sf = thread_sp->GetStackFrameAtIndex(1);
135135
if (!parent_sf) {
136136
LLDB_LOGF(log_category, "got nullptr when fetching stackframe at index 1");
137137
return {};
@@ -161,7 +161,7 @@ InstrumentationBoundsSafetyStopInfo::
161161
// frame #2: `bad_read(index=10)
162162
// ```
163163
// ....
164-
const auto *TrapReasonFuncName = parent_sf->GetFunctionName();
164+
const char *TrapReasonFuncName = parent_sf->GetFunctionName();
165165

166166
auto MaybeTrapReason =
167167
clang::CodeGen::DemangleTrapReasonInDebugInfo(TrapReasonFuncName);
@@ -172,8 +172,8 @@ InstrumentationBoundsSafetyStopInfo::
172172
TrapReasonFuncName);
173173
return {};
174174
}
175-
auto category = MaybeTrapReason.value().first;
176-
auto message = MaybeTrapReason.value().second;
175+
llvm::StringRef category = MaybeTrapReason.value().first;
176+
llvm::StringRef message = MaybeTrapReason.value().second;
177177

178178
// TODO: Clang should probably be changed to emit the "Soft " prefix itself
179179
std::string stop_reason;
@@ -204,8 +204,8 @@ InstrumentationBoundsSafetyStopInfo::
204204
ThreadSP thread_sp, lldb::user_id_t debugger_id,
205205
bool &warning_emitted_for_failure) {
206206

207-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
208-
auto softtrap_sf = thread_sp->GetStackFrameAtIndex(0);
207+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
208+
StackFrameSP softtrap_sf = thread_sp->GetStackFrameAtIndex(0);
209209
if (!softtrap_sf) {
210210
LLDB_LOGF(log_category, "got nullptr when fetching stackframe at index 0");
211211
return {};
@@ -249,7 +249,7 @@ InstrumentationBoundsSafetyStopInfo::
249249
return {};
250250
}
251251

252-
auto rc = thread_sp->GetRegisterContext();
252+
RegisterContextSP rc = thread_sp->GetRegisterContext();
253253
if (!rc) {
254254
LLDB_LOGF(log_category, "failed to get register context");
255255
return {};
@@ -260,7 +260,7 @@ InstrumentationBoundsSafetyStopInfo::
260260
// https://github.com/llvm/llvm-project/issues/168602
261261
// Don't try for architectures where examining the first register won't
262262
// work.
263-
auto process = thread_sp->GetProcess();
263+
ProcessSP process = thread_sp->GetProcess();
264264
if (!process) {
265265
LLDB_LOGF(log_category, "failed to get process");
266266
return {};
@@ -286,7 +286,7 @@ InstrumentationBoundsSafetyStopInfo::
286286
};
287287

288288
// Examine the register for the first argument.
289-
auto *arg0_info = rc->GetRegisterInfo(
289+
const RegisterInfo *arg0_info = rc->GetRegisterInfo(
290290
lldb::RegisterKind::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
291291
if (!arg0_info) {
292292
LLDB_LOGF(log_category,
@@ -374,7 +374,7 @@ InstrumentationRuntimeBoundsSafety::GetPatternForRuntimeLibrary() {
374374

375375
bool InstrumentationRuntimeBoundsSafety::CheckIfRuntimeIsValid(
376376
const lldb::ModuleSP module_sp) {
377-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
377+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
378378
for (const auto &SoftTrapFunc : getBoundsSafetySoftTrapRuntimeFuncs()) {
379379
ConstString test_sym(SoftTrapFunc);
380380

@@ -401,7 +401,7 @@ bool InstrumentationRuntimeBoundsSafety::NotifyBreakpointHit(
401401
InstrumentationRuntimeBoundsSafety *const instance =
402402
static_cast<InstrumentationRuntimeBoundsSafety *>(baton);
403403

404-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
404+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
405405
ProcessSP process_sp = instance->GetProcessSP();
406406
if (!process_sp) {
407407
LLDB_LOGF(log_category, "failed to get process from baton");
@@ -439,14 +439,14 @@ void InstrumentationRuntimeBoundsSafety::Activate() {
439439
if (IsActive())
440440
return;
441441

442-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
442+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
443443
ProcessSP process_sp = GetProcessSP();
444444
if (!process_sp) {
445445
LLDB_LOGF(log_category, "could not get process during Activate()");
446446
return;
447447
}
448448

449-
auto breakpoint = process_sp->GetTarget().CreateBreakpoint(
449+
BreakpointSP breakpoint = process_sp->GetTarget().CreateBreakpoint(
450450
/*containingModules=*/nullptr,
451451
/*containingSourceFiles=*/nullptr, getBoundsSafetySoftTrapRuntimeFuncs(),
452452
eFunctionNameTypeFull, eLanguageTypeUnknown,
@@ -481,7 +481,7 @@ void InstrumentationRuntimeBoundsSafety::Activate() {
481481

482482
void InstrumentationRuntimeBoundsSafety::Deactivate() {
483483
SetActive(false);
484-
auto *log_category = GetLog(LLDBLog::InstrumentationRuntime);
484+
Log *log_category = GetLog(LLDBLog::InstrumentationRuntime);
485485
if (ProcessSP process_sp = GetProcessSP()) {
486486
bool success =
487487
process_sp->GetTarget().RemoveBreakpointByID(GetBreakpointID());

0 commit comments

Comments
 (0)