carlosgalvezp added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp:78
+  // Ignore anonymous structs/classes
+  if (StringRef(BaseTypeName).contains("(unnamed "))
+    return;
----------------
carlosgalvezp wrote:
> AMS21 wrote:
> > I wonder if there's a cleaner and more performant way to check this.
> > I've tried `isAnonymousStructOrUnion()` from the `RecordDecl` but that 
> > seems to be about something else.
> Indeed this seems brittle. Since `RecordDecl` inherits from `NamedDecl`, have 
> you tried the `getName()` function? Hopefully it's an empty string and we can 
> use that instead?
Actually this in `NamedDecl` sounds like what you could use here?

```
  /// Get the identifier that names this declaration, if there is one.
  ///
  /// This will return NULL if this declaration has no name (e.g., for
  /// an unnamed class) or if the name is a special name (C++ constructor,
  /// Objective-C selector, etc.).
  IdentifierInfo *getIdentifier() const { return Name.getAsIdentifierInfo(); }
``


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147411

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

Reply via email to