mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +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.
|
||||
bool MetadataContext::isValidName(const StringRef MDName) {
|
||||
const char *Name = MDName.data();
|
||||
if (!Name)
|
||||
if (MDName.empty())
|
||||
return false;
|
||||
|
||||
if (!isalpha(*Name))
|
||||
if (!isalpha(MDName[1]))
|
||||
return false;
|
||||
|
||||
unsigned Length = strlen(Name);
|
||||
unsigned Count = 1;
|
||||
++Name;
|
||||
while (Name &&
|
||||
(isalnum(*Name) || *Name == '_' || *Name == '-' || *Name == '.')) {
|
||||
++Name;
|
||||
++Count;
|
||||
for (StringRef::iterator I = MDName.begin() + 1, E = MDName.end(); I != E;
|
||||
++I) {
|
||||
if (!isalnum(*I) && *I != '_' && *I != '-' && *I != '.')
|
||||
return false;
|
||||
}
|
||||
if (Length != Count)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user