diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-19 07:49:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-19 07:49:14 +0000 |
commit | 845222ccd992282bf74b2fca53e7c3b84a81c098 (patch) | |
tree | 5e6b6edad26c5396d69e116664cceb7d111e81ef /include/clang/Basic/IdentifierTable.h | |
parent | edc66f3ab000f54e0e03c5840d7b54e9bf8615cb (diff) |
add a new helper method. It is unclear to me why this doesn't work, but GCC
won't match it:
template<std::size_t StrLen>
bool isName(const char Str[StrLen]) const {
return getLength() == StrLen-1 && !memcmp(getName(), Str, StrLen-1);
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59605 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r-- | include/clang/Basic/IdentifierTable.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index cbd27547ac..7801304751 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -62,6 +62,12 @@ class IdentifierInfo { public: IdentifierInfo(); + /// isName - Return true if this is the identifier for the specified string. + bool isName(const char *Str) const { + unsigned Len = strlen(Str); + return getLength() == Len && !memcmp(getName(), Str, Len); + } + /// getName - Return the actual string for this identifier. The returned /// string is properly null terminated. /// |