#include "clang/Basic/LLVM.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Twine.h"
#include <string>
#include <vector>
struct PathComparator {
virtual ~PathComparator() {}
- virtual bool equivalent(const Twine &FileA, const Twine &FileB) const = 0;
+ virtual bool equivalent(StringRef FileA, StringRef FileB) const = 0;
};
class FileMatchTrieNode;
/// \brief Default \c PathComparator using \c llvm::sys::fs::equivalent().
struct DefaultPathComparator : public PathComparator {
virtual ~DefaultPathComparator() {}
- virtual bool equivalent(const Twine &FileA, const Twine &FileB) const {
- return FileA.str() == FileB.str() ||
- llvm::sys::fs::equivalent(FileA, FileB);
+ virtual bool equivalent(StringRef FileA, StringRef FileB) const {
+ return FileA == FileB || llvm::sys::fs::equivalent(FileA, FileB);
}
};
struct FakeComparator : public PathComparator {
virtual ~FakeComparator() {}
- virtual bool equivalent(const Twine &FileA, const Twine &FileB) const {
- return StringRef(FileA.str()).equals_lower(FileB.str());
+ virtual bool equivalent(StringRef FileA, StringRef FileB) const {
+ return FileA.equals_lower(FileB);
}
};