mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-13 17:06:15 +00:00
Simplify code. No intended functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84790 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f7ce17e8a8
commit
f8ea2e28bb
@ -259,23 +259,17 @@ unsigned MetadataContext::registerMDKind(const StringRef Name) {
|
|||||||
|
|
||||||
/// isValidName - Return true if Name is a valid custom metadata handler name.
|
/// isValidName - Return true if Name is a valid custom metadata handler name.
|
||||||
bool MetadataContext::isValidName(const StringRef MDName) {
|
bool MetadataContext::isValidName(const StringRef MDName) {
|
||||||
const char *Name = MDName.data();
|
if (MDName.empty())
|
||||||
if (!Name)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!isalpha(*Name))
|
if (!isalpha(MDName[1]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned Length = strlen(Name);
|
for (StringRef::iterator I = MDName.begin() + 1, E = MDName.end(); I != E;
|
||||||
unsigned Count = 1;
|
++I) {
|
||||||
++Name;
|
if (!isalnum(*I) && *I != '_' && *I != '-' && *I != '.')
|
||||||
while (Name &&
|
return false;
|
||||||
(isalnum(*Name) || *Name == '_' || *Name == '-' || *Name == '.')) {
|
|
||||||
++Name;
|
|
||||||
++Count;
|
|
||||||
}
|
}
|
||||||
if (Length != Count)
|
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user