1 //===-- Variable.cpp ------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "lldb/Symbol/Variable.h" 10 11 #include "lldb/Core/Module.h" 12 #include "lldb/Core/ValueObject.h" 13 #include "lldb/Core/ValueObjectVariable.h" 14 #include "lldb/Symbol/Block.h" 15 #include "lldb/Symbol/CompileUnit.h" 16 #include "lldb/Symbol/CompilerDecl.h" 17 #include "lldb/Symbol/CompilerDeclContext.h" 18 #include "lldb/Symbol/Function.h" 19 #include "lldb/Symbol/SymbolContext.h" 20 #include "lldb/Symbol/SymbolFile.h" 21 #include "lldb/Symbol/Type.h" 22 #include "lldb/Symbol/TypeSystem.h" 23 #include "lldb/Symbol/VariableList.h" 24 #include "lldb/Target/ABI.h" 25 #include "lldb/Target/Process.h" 26 #include "lldb/Target/RegisterContext.h" 27 #include "lldb/Target/StackFrame.h" 28 #include "lldb/Target/Target.h" 29 #include "lldb/Target/Thread.h" 30 #include "lldb/Utility/RegularExpression.h" 31 #include "lldb/Utility/Stream.h" 32 33 #include "llvm/ADT/Twine.h" 34 35 using namespace lldb; 36 using namespace lldb_private; 37 38 Variable::Variable(lldb::user_id_t uid, const char *name, const char *mangled, 39 const lldb::SymbolFileTypeSP &symfile_type_sp, 40 ValueType scope, SymbolContextScope *context, 41 const RangeList &scope_range, Declaration *decl_ptr, 42 const DWARFExpression &location, bool external, 43 bool artificial, bool location_is_constant_data, 44 bool static_member) 45 : UserID(uid), m_name(name), m_mangled(ConstString(mangled)), 46 m_symfile_type_sp(symfile_type_sp), m_scope(scope), 47 m_owner_scope(context), m_scope_range(scope_range), 48 m_declaration(decl_ptr), m_location(location), m_external(external), 49 m_artificial(artificial), m_loc_is_const_data(location_is_constant_data), 50 m_static_member(static_member) {} 51 52 Variable::~Variable() = default; 53 54 lldb::LanguageType Variable::GetLanguage() const { 55 lldb::LanguageType lang = m_mangled.GuessLanguage(); 56 if (lang != lldb::eLanguageTypeUnknown) 57 return lang; 58 59 if (auto *func = m_owner_scope->CalculateSymbolContextFunction()) { 60 if ((lang = func->GetLanguage()) != lldb::eLanguageTypeUnknown) 61 return lang; 62 } else if (auto *comp_unit = 63 m_owner_scope->CalculateSymbolContextCompileUnit()) { 64 if ((lang = comp_unit->GetLanguage()) != lldb::eLanguageTypeUnknown) 65 return lang; 66 } 67 68 return lldb::eLanguageTypeUnknown; 69 } 70 71 ConstString Variable::GetName() const { 72 ConstString name = m_mangled.GetName(); 73 if (name) 74 return name; 75 return m_name; 76 } 77 78 ConstString Variable::GetUnqualifiedName() const { return m_name; } 79 80 bool Variable::NameMatches(ConstString name) const { 81 if (m_name == name) 82 return true; 83 SymbolContext variable_sc; 84 m_owner_scope->CalculateSymbolContext(&variable_sc); 85 86 return m_mangled.NameMatches(name); 87 } 88 bool Variable::NameMatches(const RegularExpression ®ex) const { 89 if (regex.Execute(m_name.AsCString())) 90 return true; 91 if (m_mangled) 92 return m_mangled.NameMatches(regex); 93 return false; 94 } 95 96 Type *Variable::GetType() { 97 if (m_symfile_type_sp) 98 return m_symfile_type_sp->GetType(); 99 return nullptr; 100 } 101 102 void Variable::Dump(Stream *s, bool show_context) const { 103 s->Printf("%p: ", static_cast<const void *>(this)); 104 s->Indent(); 105 *s << "Variable" << (const UserID &)*this; 106 107 if (m_name) 108 *s << ", name = \"" << m_name << "\""; 109 110 if (m_symfile_type_sp) { 111 Type *type = m_symfile_type_sp->GetType(); 112 if (type) { 113 s->Format(", type = {{{0:x-16}} {1} (", type->GetID(), type); 114 type->DumpTypeName(s); 115 s->PutChar(')'); 116 } 117 } 118 119 if (m_scope != eValueTypeInvalid) { 120 s->PutCString(", scope = "); 121 switch (m_scope) { 122 case eValueTypeVariableGlobal: 123 s->PutCString(m_external ? "global" : "static"); 124 break; 125 case eValueTypeVariableArgument: 126 s->PutCString("parameter"); 127 break; 128 case eValueTypeVariableLocal: 129 s->PutCString("local"); 130 break; 131 case eValueTypeVariableThreadLocal: 132 s->PutCString("thread local"); 133 break; 134 default: 135 s->AsRawOstream() << "??? (" << m_scope << ')'; 136 } 137 } 138 139 if (show_context && m_owner_scope != nullptr) { 140 s->PutCString(", context = ( "); 141 m_owner_scope->DumpSymbolContext(s); 142 s->PutCString(" )"); 143 } 144 145 bool show_fullpaths = false; 146 m_declaration.Dump(s, show_fullpaths); 147 148 if (m_location.IsValid()) { 149 s->PutCString(", location = "); 150 ABISP abi; 151 if (m_owner_scope) { 152 ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); 153 if (module_sp) 154 abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()); 155 } 156 m_location.GetDescription(s, lldb::eDescriptionLevelBrief, abi.get()); 157 } 158 159 if (m_external) 160 s->PutCString(", external"); 161 162 if (m_artificial) 163 s->PutCString(", artificial"); 164 165 s->EOL(); 166 } 167 168 bool Variable::DumpDeclaration(Stream *s, bool show_fullpaths, 169 bool show_module) { 170 bool dumped_declaration_info = false; 171 if (m_owner_scope) { 172 SymbolContext sc; 173 m_owner_scope->CalculateSymbolContext(&sc); 174 sc.block = nullptr; 175 sc.line_entry.Clear(); 176 bool show_inlined_frames = false; 177 const bool show_function_arguments = true; 178 const bool show_function_name = true; 179 180 dumped_declaration_info = sc.DumpStopContext( 181 s, nullptr, Address(), show_fullpaths, show_module, show_inlined_frames, 182 show_function_arguments, show_function_name); 183 184 if (sc.function) 185 s->PutChar(':'); 186 } 187 if (m_declaration.DumpStopContext(s, false)) 188 dumped_declaration_info = true; 189 return dumped_declaration_info; 190 } 191 192 size_t Variable::MemorySize() const { return sizeof(Variable); } 193 194 CompilerDeclContext Variable::GetDeclContext() { 195 Type *type = GetType(); 196 if (type) 197 return type->GetSymbolFile()->GetDeclContextContainingUID(GetID()); 198 return CompilerDeclContext(); 199 } 200 201 CompilerDecl Variable::GetDecl() { 202 Type *type = GetType(); 203 return type ? type->GetSymbolFile()->GetDeclForUID(GetID()) : CompilerDecl(); 204 } 205 206 void Variable::CalculateSymbolContext(SymbolContext *sc) { 207 if (m_owner_scope) { 208 m_owner_scope->CalculateSymbolContext(sc); 209 sc->variable = this; 210 } else 211 sc->Clear(false); 212 } 213 214 bool Variable::LocationIsValidForFrame(StackFrame *frame) { 215 // Is the variable is described by a single location? 216 if (!m_location.IsLocationList()) { 217 // Yes it is, the location is valid. 218 return true; 219 } 220 221 if (frame) { 222 Function *function = 223 frame->GetSymbolContext(eSymbolContextFunction).function; 224 if (function) { 225 TargetSP target_sp(frame->CalculateTarget()); 226 227 addr_t loclist_base_load_addr = 228 function->GetAddressRange().GetBaseAddress().GetLoadAddress( 229 target_sp.get()); 230 if (loclist_base_load_addr == LLDB_INVALID_ADDRESS) 231 return false; 232 // It is a location list. We just need to tell if the location list 233 // contains the current address when converted to a load address 234 return m_location.LocationListContainsAddress( 235 loclist_base_load_addr, 236 frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get())); 237 } 238 } 239 return false; 240 } 241 242 bool Variable::LocationIsValidForAddress(const Address &address) { 243 // Be sure to resolve the address to section offset prior to calling this 244 // function. 245 if (address.IsSectionOffset()) { 246 // We need to check if the address is valid for both scope range and value 247 // range. 248 // Empty scope range means block range. 249 bool valid_in_scope_range = 250 GetScopeRange().IsEmpty() || GetScopeRange().FindEntryThatContains( 251 address.GetFileAddress()) != nullptr; 252 if (!valid_in_scope_range) 253 return false; 254 SymbolContext sc; 255 CalculateSymbolContext(&sc); 256 if (sc.module_sp == address.GetModule()) { 257 // Is the variable is described by a single location? 258 if (!m_location.IsLocationList()) { 259 // Yes it is, the location is valid. 260 return true; 261 } 262 263 if (sc.function) { 264 addr_t loclist_base_file_addr = 265 sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); 266 if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) 267 return false; 268 // It is a location list. We just need to tell if the location list 269 // contains the current address when converted to a load address 270 return m_location.LocationListContainsAddress(loclist_base_file_addr, 271 address.GetFileAddress()); 272 } 273 } 274 } 275 return false; 276 } 277 278 bool Variable::IsInScope(StackFrame *frame) { 279 switch (m_scope) { 280 case eValueTypeRegister: 281 case eValueTypeRegisterSet: 282 return frame != nullptr; 283 284 case eValueTypeConstResult: 285 case eValueTypeVariableGlobal: 286 case eValueTypeVariableStatic: 287 case eValueTypeVariableThreadLocal: 288 return true; 289 290 case eValueTypeVariableArgument: 291 case eValueTypeVariableLocal: 292 if (frame) { 293 // We don't have a location list, we just need to see if the block that 294 // this variable was defined in is currently 295 Block *deepest_frame_block = 296 frame->GetSymbolContext(eSymbolContextBlock).block; 297 if (deepest_frame_block) { 298 SymbolContext variable_sc; 299 CalculateSymbolContext(&variable_sc); 300 301 // Check for static or global variable defined at the compile unit 302 // level that wasn't defined in a block 303 if (variable_sc.block == nullptr) 304 return true; 305 306 // Check if the variable is valid in the current block 307 if (variable_sc.block != deepest_frame_block && 308 !variable_sc.block->Contains(deepest_frame_block)) 309 return false; 310 311 // If no scope range is specified then it means that the scope is the 312 // same as the scope of the enclosing lexical block. 313 if (m_scope_range.IsEmpty()) 314 return true; 315 316 addr_t file_address = frame->GetFrameCodeAddress().GetFileAddress(); 317 return m_scope_range.FindEntryThatContains(file_address) != nullptr; 318 } 319 } 320 break; 321 322 default: 323 break; 324 } 325 return false; 326 } 327 328 Status Variable::GetValuesForVariableExpressionPath( 329 llvm::StringRef variable_expr_path, ExecutionContextScope *scope, 330 GetVariableCallback callback, void *baton, VariableList &variable_list, 331 ValueObjectList &valobj_list) { 332 Status error; 333 if (!callback || variable_expr_path.empty()) { 334 error.SetErrorString("unknown error"); 335 return error; 336 } 337 338 switch (variable_expr_path.front()) { 339 case '*': 340 error = Variable::GetValuesForVariableExpressionPath( 341 variable_expr_path.drop_front(), scope, callback, baton, variable_list, 342 valobj_list); 343 if (error.Fail()) { 344 error.SetErrorString("unknown error"); 345 return error; 346 } 347 for (uint32_t i = 0; i < valobj_list.GetSize();) { 348 Status tmp_error; 349 ValueObjectSP valobj_sp( 350 valobj_list.GetValueObjectAtIndex(i)->Dereference(tmp_error)); 351 if (tmp_error.Fail()) { 352 variable_list.RemoveVariableAtIndex(i); 353 valobj_list.RemoveValueObjectAtIndex(i); 354 } else { 355 valobj_list.SetValueObjectAtIndex(i, valobj_sp); 356 ++i; 357 } 358 } 359 return error; 360 case '&': { 361 error = Variable::GetValuesForVariableExpressionPath( 362 variable_expr_path.drop_front(), scope, callback, baton, variable_list, 363 valobj_list); 364 if (error.Success()) { 365 for (uint32_t i = 0; i < valobj_list.GetSize();) { 366 Status tmp_error; 367 ValueObjectSP valobj_sp( 368 valobj_list.GetValueObjectAtIndex(i)->AddressOf(tmp_error)); 369 if (tmp_error.Fail()) { 370 variable_list.RemoveVariableAtIndex(i); 371 valobj_list.RemoveValueObjectAtIndex(i); 372 } else { 373 valobj_list.SetValueObjectAtIndex(i, valobj_sp); 374 ++i; 375 } 376 } 377 } else { 378 error.SetErrorString("unknown error"); 379 } 380 return error; 381 } break; 382 383 default: { 384 static RegularExpression g_regex( 385 llvm::StringRef("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)")); 386 llvm::SmallVector<llvm::StringRef, 2> matches; 387 variable_list.Clear(); 388 if (!g_regex.Execute(variable_expr_path, &matches)) { 389 error.SetErrorStringWithFormat( 390 "unable to extract a variable name from '%s'", 391 variable_expr_path.str().c_str()); 392 return error; 393 } 394 std::string variable_name = matches[1].str(); 395 if (!callback(baton, variable_name.c_str(), variable_list)) { 396 error.SetErrorString("unknown error"); 397 return error; 398 } 399 uint32_t i = 0; 400 while (i < variable_list.GetSize()) { 401 VariableSP var_sp(variable_list.GetVariableAtIndex(i)); 402 ValueObjectSP valobj_sp; 403 if (!var_sp) { 404 variable_list.RemoveVariableAtIndex(i); 405 continue; 406 } 407 ValueObjectSP variable_valobj_sp( 408 ValueObjectVariable::Create(scope, var_sp)); 409 if (!variable_valobj_sp) { 410 variable_list.RemoveVariableAtIndex(i); 411 continue; 412 } 413 414 llvm::StringRef variable_sub_expr_path = 415 variable_expr_path.drop_front(variable_name.size()); 416 if (!variable_sub_expr_path.empty()) { 417 valobj_sp = variable_valobj_sp->GetValueForExpressionPath( 418 variable_sub_expr_path); 419 if (!valobj_sp) { 420 error.SetErrorStringWithFormat( 421 "invalid expression path '%s' for variable '%s'", 422 variable_sub_expr_path.str().c_str(), 423 var_sp->GetName().GetCString()); 424 variable_list.RemoveVariableAtIndex(i); 425 continue; 426 } 427 } else { 428 // Just the name of a variable with no extras 429 valobj_sp = variable_valobj_sp; 430 } 431 432 valobj_list.Append(valobj_sp); 433 ++i; 434 } 435 436 if (variable_list.GetSize() > 0) { 437 error.Clear(); 438 return error; 439 } 440 } break; 441 } 442 error.SetErrorString("unknown error"); 443 return error; 444 } 445 446 bool Variable::DumpLocations(Stream *s, const Address &address) { 447 SymbolContext sc; 448 CalculateSymbolContext(&sc); 449 ABISP abi; 450 if (m_owner_scope) { 451 ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); 452 if (module_sp) 453 abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()); 454 } 455 456 const addr_t file_addr = address.GetFileAddress(); 457 if (sc.function) { 458 addr_t loclist_base_file_addr = 459 sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); 460 if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) 461 return false; 462 return m_location.DumpLocations(s, eDescriptionLevelBrief, 463 loclist_base_file_addr, file_addr, 464 abi.get()); 465 } 466 return false; 467 } 468 469 static void PrivateAutoComplete( 470 StackFrame *frame, llvm::StringRef partial_path, 471 const llvm::Twine 472 &prefix_path, // Anything that has been resolved already will be in here 473 const CompilerType &compiler_type, CompletionRequest &request); 474 475 static void PrivateAutoCompleteMembers( 476 StackFrame *frame, const std::string &partial_member_name, 477 llvm::StringRef partial_path, 478 const llvm::Twine 479 &prefix_path, // Anything that has been resolved already will be in here 480 const CompilerType &compiler_type, CompletionRequest &request) { 481 482 // We are in a type parsing child members 483 const uint32_t num_bases = compiler_type.GetNumDirectBaseClasses(); 484 485 if (num_bases > 0) { 486 for (uint32_t i = 0; i < num_bases; ++i) { 487 CompilerType base_class_type = 488 compiler_type.GetDirectBaseClassAtIndex(i, nullptr); 489 490 PrivateAutoCompleteMembers(frame, partial_member_name, partial_path, 491 prefix_path, 492 base_class_type.GetCanonicalType(), request); 493 } 494 } 495 496 const uint32_t num_vbases = compiler_type.GetNumVirtualBaseClasses(); 497 498 if (num_vbases > 0) { 499 for (uint32_t i = 0; i < num_vbases; ++i) { 500 CompilerType vbase_class_type = 501 compiler_type.GetVirtualBaseClassAtIndex(i, nullptr); 502 503 PrivateAutoCompleteMembers(frame, partial_member_name, partial_path, 504 prefix_path, 505 vbase_class_type.GetCanonicalType(), request); 506 } 507 } 508 509 // We are in a type parsing child members 510 const uint32_t num_fields = compiler_type.GetNumFields(); 511 512 if (num_fields > 0) { 513 for (uint32_t i = 0; i < num_fields; ++i) { 514 std::string member_name; 515 516 CompilerType member_compiler_type = compiler_type.GetFieldAtIndex( 517 i, member_name, nullptr, nullptr, nullptr); 518 519 if (partial_member_name.empty() || 520 llvm::StringRef(member_name).startswith(partial_member_name)) { 521 if (member_name == partial_member_name) { 522 PrivateAutoComplete( 523 frame, partial_path, 524 prefix_path + member_name, // Anything that has been resolved 525 // already will be in here 526 member_compiler_type.GetCanonicalType(), request); 527 } else { 528 request.AddCompletion((prefix_path + member_name).str()); 529 } 530 } 531 } 532 } 533 } 534 535 static void PrivateAutoComplete( 536 StackFrame *frame, llvm::StringRef partial_path, 537 const llvm::Twine 538 &prefix_path, // Anything that has been resolved already will be in here 539 const CompilerType &compiler_type, CompletionRequest &request) { 540 // printf ("\nPrivateAutoComplete()\n\tprefix_path = '%s'\n\tpartial_path = 541 // '%s'\n", prefix_path.c_str(), partial_path.c_str()); 542 std::string remaining_partial_path; 543 544 const lldb::TypeClass type_class = compiler_type.GetTypeClass(); 545 if (partial_path.empty()) { 546 if (compiler_type.IsValid()) { 547 switch (type_class) { 548 default: 549 case eTypeClassArray: 550 case eTypeClassBlockPointer: 551 case eTypeClassBuiltin: 552 case eTypeClassComplexFloat: 553 case eTypeClassComplexInteger: 554 case eTypeClassEnumeration: 555 case eTypeClassFunction: 556 case eTypeClassMemberPointer: 557 case eTypeClassReference: 558 case eTypeClassTypedef: 559 case eTypeClassVector: { 560 request.AddCompletion(prefix_path.str()); 561 } break; 562 563 case eTypeClassClass: 564 case eTypeClassStruct: 565 case eTypeClassUnion: 566 if (prefix_path.str().back() != '.') 567 request.AddCompletion((prefix_path + ".").str()); 568 break; 569 570 case eTypeClassObjCObject: 571 case eTypeClassObjCInterface: 572 break; 573 case eTypeClassObjCObjectPointer: 574 case eTypeClassPointer: { 575 bool omit_empty_base_classes = true; 576 if (compiler_type.GetNumChildren(omit_empty_base_classes, nullptr) > 0) 577 request.AddCompletion((prefix_path + "->").str()); 578 else { 579 request.AddCompletion(prefix_path.str()); 580 } 581 } break; 582 } 583 } else { 584 if (frame) { 585 const bool get_file_globals = true; 586 587 VariableList *variable_list = frame->GetVariableList(get_file_globals); 588 589 if (variable_list) { 590 for (const VariableSP &var_sp : *variable_list) 591 request.AddCompletion(var_sp->GetName().AsCString()); 592 } 593 } 594 } 595 } else { 596 const char ch = partial_path[0]; 597 switch (ch) { 598 case '*': 599 if (prefix_path.str().empty()) { 600 PrivateAutoComplete(frame, partial_path.substr(1), "*", compiler_type, 601 request); 602 } 603 break; 604 605 case '&': 606 if (prefix_path.isTriviallyEmpty()) { 607 PrivateAutoComplete(frame, partial_path.substr(1), std::string("&"), 608 compiler_type, request); 609 } 610 break; 611 612 case '-': 613 if (partial_path.size() > 1 && partial_path[1] == '>' && 614 !prefix_path.str().empty()) { 615 switch (type_class) { 616 case lldb::eTypeClassPointer: { 617 CompilerType pointee_type(compiler_type.GetPointeeType()); 618 if (partial_path.size() > 2 && partial_path[2]) { 619 // If there is more after the "->", then search deeper 620 PrivateAutoComplete(frame, partial_path.substr(2), 621 prefix_path + "->", 622 pointee_type.GetCanonicalType(), request); 623 } else { 624 // Nothing after the "->", so list all members 625 PrivateAutoCompleteMembers( 626 frame, std::string(), std::string(), prefix_path + "->", 627 pointee_type.GetCanonicalType(), request); 628 } 629 } break; 630 default: 631 break; 632 } 633 } 634 break; 635 636 case '.': 637 if (compiler_type.IsValid()) { 638 switch (type_class) { 639 case lldb::eTypeClassUnion: 640 case lldb::eTypeClassStruct: 641 case lldb::eTypeClassClass: 642 if (partial_path.size() > 1 && partial_path[1]) { 643 // If there is more after the ".", then search deeper 644 PrivateAutoComplete(frame, partial_path.substr(1), 645 prefix_path + ".", compiler_type, request); 646 647 } else { 648 // Nothing after the ".", so list all members 649 PrivateAutoCompleteMembers(frame, std::string(), partial_path, 650 prefix_path + ".", compiler_type, 651 request); 652 } 653 break; 654 default: 655 break; 656 } 657 } 658 break; 659 default: 660 if (isalpha(ch) || ch == '_' || ch == '$') { 661 const size_t partial_path_len = partial_path.size(); 662 size_t pos = 1; 663 while (pos < partial_path_len) { 664 const char curr_ch = partial_path[pos]; 665 if (isalnum(curr_ch) || curr_ch == '_' || curr_ch == '$') { 666 ++pos; 667 continue; 668 } 669 break; 670 } 671 672 std::string token(std::string(partial_path), 0, pos); 673 remaining_partial_path = std::string(partial_path.substr(pos)); 674 675 if (compiler_type.IsValid()) { 676 PrivateAutoCompleteMembers(frame, token, remaining_partial_path, 677 prefix_path, compiler_type, request); 678 } else if (frame) { 679 // We haven't found our variable yet 680 const bool get_file_globals = true; 681 682 VariableList *variable_list = 683 frame->GetVariableList(get_file_globals); 684 685 if (!variable_list) 686 break; 687 688 for (VariableSP var_sp : *variable_list) { 689 690 if (!var_sp) 691 continue; 692 693 llvm::StringRef variable_name = var_sp->GetName().GetStringRef(); 694 if (variable_name.startswith(token)) { 695 if (variable_name == token) { 696 Type *variable_type = var_sp->GetType(); 697 if (variable_type) { 698 CompilerType variable_compiler_type( 699 variable_type->GetForwardCompilerType()); 700 PrivateAutoComplete( 701 frame, remaining_partial_path, 702 prefix_path + token, // Anything that has been resolved 703 // already will be in here 704 variable_compiler_type.GetCanonicalType(), request); 705 } else { 706 request.AddCompletion((prefix_path + variable_name).str()); 707 } 708 } else if (remaining_partial_path.empty()) { 709 request.AddCompletion((prefix_path + variable_name).str()); 710 } 711 } 712 } 713 } 714 } 715 break; 716 } 717 } 718 } 719 720 void Variable::AutoComplete(const ExecutionContext &exe_ctx, 721 CompletionRequest &request) { 722 CompilerType compiler_type; 723 724 PrivateAutoComplete(exe_ctx.GetFramePtr(), request.GetCursorArgumentPrefix(), 725 "", compiler_type, request); 726 } 727