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 | 49c017f4ea6f5795403cb23896a8b6cf4ef5ef6e (patch) | |
tree | 634c52df4e65095e50a38fcadfc4c814142aefc9 /clang | |
parent | 66e3877b42fea73fde704c45ad340b13516b7e84 (diff) | |
download | bcm5719-llvm-49c017f4ea6f5795403cb23896a8b6cf4ef5ef6e.tar.gz bcm5719-llvm-49c017f4ea6f5795403cb23896a8b6cf4ef5ef6e.zip |
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);
}
llvm-svn: 59605
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/Basic/IdentifierTable.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/IdentifierTable.h b/clang/include/clang/Basic/IdentifierTable.h index cbd27547ac3..78013047519 100644 --- a/clang/include/clang/Basic/IdentifierTable.h +++ b/clang/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. /// |