[Bug 20466] New: Inspecting variable with same name as a type does not work

Bug ID 20466
Summary Inspecting variable with same name as a type does not work
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter Matthew.Arsenault@amd.com
Classification Unclassified

If a variable has the same name as a type, lldb gets confused.

For example, in LLVM:

  SDNode *Base = Node;
  // This algorithm requires a reasonably low use count before finding a match
  // to avoid uselessly blowing up compile time in large blocks.
  unsigned UseCount = 0;
  for (SDNode::use_iterator I = Chain->use_begin(), E = Chain->use_end();
       I != E && UseCount < 100; ++I, ++UseCount) {
    SDNode *User = *I;
    if (User == Node || !Visited.insert(User)) // Breakpoint
    int64_t Offset1, Offset2;

If I set a breakpoint at the commented line, I can only do anything with Base.
It has the same type as "User", but I cannot do anything to it since User is
also a type. Printing it just does nothing with no explanation.

(lldb) p Base
(llvm::SDNode *) $3 = 0x0000000104818128
(lldb) p User
(lldb) p Base->dump(DAG)
0x104818128: v2i32,ch = S_LOAD_DWORDX2_IMM 0x104817d08, 0x104817e10,
0x103c00670<Mem:LD8[undef(addrspace=2)](nontemporal)> [ORD=1]
(lldb) p User->dump(DAG)
error: cannot use arrow operator on a type
error: 1 errors parsing expression