[PATCH] D148284: [clangd] Add "readonly" token to const member expressions

Nathan Ridge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 23:10:17 PDT 2023


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:1018
+    const auto BaseType = E->getBaseType();
+    if ((E->isArrow() && BaseType->getPointeeType().isConstQualified()) ||
+        (!E->isArrow() && BaseType.isConstQualified()))
----------------
`getPointeeType()` needs a "null" check (check for empty QualType), this can arise if e.g. `BaseType` is a smart pointer type (`E->isArrow()` will still be true because the expression syntactically uses `->`, but `BaseType` will not be a `PointerType`)

Otherwise looks good, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148284



More information about the llvm-commits mailing list