shafik added inline comments.

================
Comment at: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:6508
+      if (parent_type_class == clang::Type::LValueReference)
+        pointee_clang_type = GetLValueReferenceType(type).GetPointeeType();
+      else
----------------
teemperor wrote:
> I think the logic here is reversed? `type` is a reference type (potentially 
> behind a typedef). `GetLValueReferenceType` on `type` returns the reference 
> type *to* that type. Not the underlying reference. The fallback for this is 
> just that it returns the current type IIRC if you already have a reference, 
> that's why this works. So, `GetLValueReferenceType` is just a no-op and 
> `GetPointeeType` is doing the actual dereferencing. I think just the 
> `GetPointeeType` is needed.
Maybe I am confused but I thought given:

```
TypedefType 0x7fb11c841460 'std::__compressed_pair_elem<struct 
std::basic_string<char, struct std::char_traits<char>, class 
std::allocator<char> >::__rep, 0, false>::const_reference' sugar
|-Typedef 0x7fb11c8413f0 'const_reference'
`-LValueReferenceType 0x7fb11c8413c0 'const struct std::basic_string<char, 
struct std::char_traits<char>, class std::allocator<char> >::__rep &'
  `-QualType 0x7fb11cac3361 'const struct std::basic_string<char, struct 
std::char_traits<char>, class std::allocator<char> >::__rep' const
    `-RecordType 0x7fb11cac3360 'struct std::basic_string<char, struct 
std::char_traits<char>, class std::allocator<char> >::__rep'
      `-CXXRecord 0x7fb11cac32b8 '__rep'
```

that `llvm::cast<clang::ReferenceType>(GetQualType(type).getTypePtr())` was 
intended to obtain:

```
LValueReferenceType 0x7fb11c829630 'const struct std::basic_string<char, struct 
std::char_traits<char>, class std::allocator<char> >::__rep &'
`-QualType 0x7fb11cac3361 'const struct std::basic_string<char, struct 
std::char_traits<char>, class std::allocator<char> >::__rep' const
  `-RecordType 0x7fb11cac3360 'struct std::basic_string<char, struct 
std::char_traits<char>, class std::allocator<char> >::__rep'
    `-CXXRecord 0x7fb11cac32b8 '__rep'
```

which is what `GetLValueReferenceType(type)` does.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108717/new/

https://reviews.llvm.org/D108717

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to