Lines Matching refs:Name

43 ReservedIdentifierCheck::ReservedIdentifierCheck(StringRef Name,  in ReservedIdentifierCheck()  argument
45 : RenamerClangTidyCheck(Name, Context), in ReservedIdentifierCheck()
64 static bool hasReservedDoubleUnderscore(StringRef Name, in hasReservedDoubleUnderscore() argument
67 return Name.find("__") != StringRef::npos; in hasReservedDoubleUnderscore()
68 return Name.startswith("__"); in hasReservedDoubleUnderscore()
72 getDoubleUnderscoreFixup(StringRef Name, const LangOptions &LangOpts) { in getDoubleUnderscoreFixup() argument
73 if (hasReservedDoubleUnderscore(Name, LangOpts)) in getDoubleUnderscoreFixup()
74 return collapseConsecutive(Name, '_'); in getDoubleUnderscoreFixup()
78 static bool startsWithUnderscoreCapital(StringRef Name) { in startsWithUnderscoreCapital() argument
79 return Name.size() >= 2 && Name[0] == '_' && std::isupper(Name[1]); in startsWithUnderscoreCapital()
82 static Optional<std::string> getUnderscoreCapitalFixup(StringRef Name) { in getUnderscoreCapitalFixup() argument
83 if (startsWithUnderscoreCapital(Name)) in getUnderscoreCapitalFixup()
84 return std::string(Name.drop_front(1)); in getUnderscoreCapitalFixup()
88 static bool startsWithUnderscoreInGlobalNamespace(StringRef Name, in startsWithUnderscoreInGlobalNamespace() argument
90 return IsInGlobalNamespace && Name.size() >= 1 && Name[0] == '_'; in startsWithUnderscoreInGlobalNamespace()
94 getUnderscoreGlobalNamespaceFixup(StringRef Name, bool IsInGlobalNamespace) { in getUnderscoreGlobalNamespaceFixup() argument
95 if (startsWithUnderscoreInGlobalNamespace(Name, IsInGlobalNamespace)) in getUnderscoreGlobalNamespaceFixup()
96 return std::string(Name.drop_front(1)); in getUnderscoreGlobalNamespaceFixup()
100 static std::string getNonReservedFixup(std::string Name) { in getNonReservedFixup() argument
101 assert(!Name.empty()); in getNonReservedFixup()
102 if (Name[0] == '_' || std::isupper(Name[0])) in getNonReservedFixup()
103 Name.insert(Name.begin(), '_'); in getNonReservedFixup()
105 Name.insert(Name.begin(), 2, '_'); in getNonReservedFixup()
106 return Name; in getNonReservedFixup()
110 getFailureInfoImpl(StringRef Name, bool IsInGlobalNamespace, in getFailureInfoImpl() argument
113 assert(!Name.empty()); in getFailureInfoImpl()
114 if (llvm::is_contained(AllowedIdentifiers, Name)) in getFailureInfoImpl()
135 .getValueOr(Name); in getFailureInfoImpl()
147 if (!(hasReservedDoubleUnderscore(Name, LangOpts) || in getFailureInfoImpl()
148 startsWithUnderscoreCapital(Name) || in getFailureInfoImpl()
149 startsWithUnderscoreInGlobalNamespace(Name, IsInGlobalNamespace))) in getFailureInfoImpl()
150 return FailureInfo{NonReservedTag, getNonReservedFixup(std::string(Name))}; in getFailureInfoImpl()