[Lldb-commits] [PATCH] D71212: [lldb] Centralize type "desugaring" logic in ClangASTContext

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 10 04:59:55 PST 2019

labath marked an inline comment as done.
labath added inline comments.

Comment at: lldb/source/Symbol/ClangASTContext.cpp:2489
+    case clang::Type::Typedef:
+      type = cast<clang::TypedefType>(type)->getDecl()->getUnderlyingType();
+      break;
teemperor wrote:
> QualType already has a `getDesugaredType` implementation that does the same (but handles more cases, so you still need the switch statement but you can unify all the case bodies if you want to keep this NFC).
Good idea. I should have checked clang for similar functionality. Though, the right function here seems to be `getLocallyUnqualifiedSingleStepDesugaredType`. "SingleStep" because we want to avoid desugaring all the way if the caller has asked us to stop at typedefs. And "LocallyUnqualified" because: a) that's what the current code does; b) the non-locally unqualified version requires a ClangASTContext, which is not available in all callers.

That said, I think that the `LocallyUnqualified` thing should be fixed as it's probably the cause of some subtle bugs.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list