[PATCH] D89785: [clangd] Add basic support for attributes (selection, hover)

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 23 00:02:43 PDT 2020


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/AST.cpp:434
+    for (AttributedTypeLoc ATL = *ATLPtr; !ATL.isNull();
+         ATL = ATL.getNextTypeLoc().getAs<AttributedTypeLoc>())
+      Result.push_back(ATL.getAttr());
----------------
this looks like not safe, `getNextTypeLoc()` may return a null TypeLoc.


================
Comment at: clang-tools-extra/clangd/unittests/ASTTests.cpp:233
+  };
+  ASSERT_THAT(DeclAttrs("X"), Each(implicitAttr()));
+  ASSERT_THAT(DeclAttrs("Y"), Contains(attrKind(attr::WarnUnusedResult)));
----------------
sorry, I'm not familiar with attributes, what is an implicit attr? It is unclear to me why there is an attr for `class X`, the source code doesn't have any attribute label for X (the same question for f and a)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89785



More information about the cfe-commits mailing list