[cfe-commits] r59605 - /cfe/trunk/include/clang/Basic/IdentifierTable.h
Chris Lattner
sabre at nondot.org
Tue Nov 18 23:49:14 PST 2008
Author: lattner
Date: Wed Nov 19 01:49:14 2008
New Revision: 59605
URL: http://llvm.org/viewvc/llvm-project?rev=59605&view=rev
Log:
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);
}
Modified:
cfe/trunk/include/clang/Basic/IdentifierTable.h
Modified: cfe/trunk/include/clang/Basic/IdentifierTable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/IdentifierTable.h?rev=59605&r1=59604&r2=59605&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/IdentifierTable.h (original)
+++ cfe/trunk/include/clang/Basic/IdentifierTable.h Wed Nov 19 01:49:14 2008
@@ -62,6 +62,12 @@
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.
///
More information about the cfe-commits
mailing list