Lines Matching defs:attr
82 std::optional<std::string> getUglyfiedCXX11Attr(const clang::Attr& attr) {
86 if (attr.isClangScope())
88 else if (attr.isGNUScope())
91 if (!attr.getAttrName()->getName().starts_with("__")) {
93 attr_string += attr.getAttrName()->getName();
96 attr_string += attr.getAttrName()->getName();
101 std::optional<std::string> getUglyfiedGNUAttr(const clang::Attr& attr) {
102 return "__" + attr.getAttrName()->getName().str() + "__";
105 std::optional<std::string> getUglified(const clang::Attr& attr) {
106 if (attr.isCXX11Attribute()) {
107 return getUglyfiedCXX11Attr(attr);
108 } else if (attr.isGNUAttribute()) {
109 return getUglyfiedGNUAttr(attr);
122 finder->addMatcher(attr(isPretty()).bind("normal_attribute"), this);
126 if (const auto* attr = result.Nodes.getNodeAs<clang::Attr>("normal_attribute"); attr != nullptr) {
127 auto diagnostic = diag(attr->getLoc(), "Non-standard attributes should use the _Ugly spelling");
128 auto uglified = getUglified(*attr);
130 diagnostic << clang::FixItHint::CreateReplacement(attr->getRange(), *uglified);