[cfe-commits] r165412 - in /cfe/trunk: include/clang/Tooling/FileMatchTrie.h lib/Tooling/FileMatchTrie.cpp unittests/Tooling/CompilationDatabaseTest.cpp
Daniel Jasper
djasper at google.com
Mon Oct 8 11:31:55 PDT 2012
Author: djasper
Date: Mon Oct 8 13:31:54 2012
New Revision: 165412
URL: http://llvm.org/viewvc/llvm-project?rev=165412&view=rev
Log:
FileNameMatchTrie: Use StringRef instead of Twines where possible.
Modified:
cfe/trunk/include/clang/Tooling/FileMatchTrie.h
cfe/trunk/lib/Tooling/FileMatchTrie.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
Modified: cfe/trunk/include/clang/Tooling/FileMatchTrie.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/FileMatchTrie.h?rev=165412&r1=165411&r2=165412&view=diff
==============================================================================
--- cfe/trunk/include/clang/Tooling/FileMatchTrie.h (original)
+++ cfe/trunk/include/clang/Tooling/FileMatchTrie.h Mon Oct 8 13:31:54 2012
@@ -18,7 +18,6 @@
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Twine.h"
#include <string>
#include <vector>
@@ -28,7 +27,7 @@
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;
Modified: cfe/trunk/lib/Tooling/FileMatchTrie.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/FileMatchTrie.cpp?rev=165412&r1=165411&r2=165412&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/FileMatchTrie.cpp (original)
+++ cfe/trunk/lib/Tooling/FileMatchTrie.cpp Mon Oct 8 13:31:54 2012
@@ -23,9 +23,8 @@
/// \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);
}
};
Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp?rev=165412&r1=165411&r2=165412&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Mon Oct 8 13:31:54 2012
@@ -84,8 +84,8 @@
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);
}
};
More information about the cfe-commits
mailing list