[PATCH] D107696: [CodeComplete] Basic code completion for attribute names.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 10 12:52:43 PDT 2021


sammccall added inline comments.


================
Comment at: clang/lib/Sema/SemaCodeComplete.cpp:4390
+  auto AddCompletions = [&](const ParsedAttrInfo &A) {
+    if (A.IsTargetSpecific && !A.existsInTarget(Context.getTargetInfo()))
+      return;
----------------
aaron.ballman wrote:
> Should we also early return if the attribute is ignored? (See `IgnoredAttr` in `Attr.td`) I'm assuming that attributes which do nothing are unlikely to be high-value attributes to autocomplete (so maybe they'd go at the end of the list if we wanted to keep them).
Hmm, I'm not sure about that.
They do nothing *in clang*, but using clang-based code completion doesn't particularly mean we'll use clang to build the code.
Something must care about the attribute, even if it's just a doc generator or something.

In practice, there are 6 attrs with Ignored = 1:
 - `bounded` is an openbsd-gcc extension
 - 3 are cuda-specific and probably only used by cuda stdlib headers
 - `__w64` is a keyword so not relevant here
 - `property` is actually supported by clang, it seems `Ignored` is lying!

So none of these are *terribly* important, but they also don't seem so worthless that it's important to exclude them. (There are other attributes that aren't important too!)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107696



More information about the cfe-commits mailing list