#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/TokenKinds.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
/// Unlike the version in IdentifierTable, this returns a pointer instead
/// of a reference. If the pointer is NULL then the IdentifierInfo cannot
/// be found.
- //
- // FIXME: Move to StringRef API.
- virtual IdentifierInfo* get(const char *NameStart, const char *NameEnd) = 0;
+ virtual IdentifierInfo* get(llvm::StringRef Name) = 0;
};
/// \brief An abstract class used to resolve numerical identifier
// No entry; if we have an external lookup, look there first.
if (ExternalLookup) {
- II = ExternalLookup->get(NameStart, NameEnd);
+ II = ExternalLookup->get(llvm::StringRef(NameStart, NameEnd-NameStart));
if (II) {
// Cache in the StringMap for subsequent lookups.
Entry.setValue(II);
return LHS == RHS;
}
};
-
+
template <>
struct isPodLike<clang::Selector> { static const bool value = true; };
/// Unlike the version in IdentifierTable, this returns a pointer instead
/// of a reference. If the pointer is NULL then the IdentifierInfo cannot
/// be found.
- IdentifierInfo *get(const char *NameStart, const char *NameEnd);
+ IdentifierInfo *get(llvm::StringRef Name);
/// Create - This method creates PTHManager objects. The 'file' argument
/// is the name of the PTH file. This method returns NULL upon failure.
return II;
}
-IdentifierInfo* PTHManager::get(const char *NameStart, const char *NameEnd) {
+IdentifierInfo* PTHManager::get(llvm::StringRef Name) {
PTHStringIdLookup& SL = *((PTHStringIdLookup*)StringIdLookup);
// Double check our assumption that the last character isn't '\0'.
- assert(NameEnd==NameStart || NameStart[NameEnd-NameStart-1] != '\0');
- PTHStringIdLookup::iterator I = SL.find(std::make_pair(NameStart,
- NameEnd - NameStart));
+ assert(Name.empty() || Name.data()[Name.size()-1] != '\0');
+ PTHStringIdLookup::iterator I = SL.find(std::make_pair(Name.data(),
+ Name.size()));
if (I == SL.end()) // No identifier found?
return 0;
CacheTy::iterator I = Cache.find(path);
// If we don't get a hit in the PTH file just forward to 'stat'.
- if (I == Cache.end())
+ if (I == Cache.end())
return StatSysCallCache::stat(path, buf);
const PTHStatData& Data = *I;