njames93 added inline comments.

================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:6763
+/// (but not "nodiscard" or "clang::warn_unused_result").
+AST_MATCHER_P(Attr, hasAttrName, llvm::StringRef, Name) {
+  return Node.getAttrName() && Node.getAttrName()->isStr(Name);
----------------
AST_MATCHER macros that take `StringRef` paramaters don't own the data for the 
string, which will result in UB if they are passed a reference to a string that 
is destroyed while the matcher is still matching. It's much safer to use 
`std::string` in this case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89743

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

Reply via email to