aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-09 15:03:26 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-09 15:03:26 +0000
commit6a1457e6c1986c37819675a4b5b7b3a9f6551981 (patch)
tree9cebc5037caf94fe17b8eb2576aecc02fe7d31f4 /clang/lib
parent6afa168e31cc47a10b68b9ab5d86519ed60556a2 (diff)
downloadllvm-6a1457e6c1986c37819675a4b5b7b3a9f6551981.zip
llvm-6a1457e6c1986c37819675a4b5b7b3a9f6551981.tar.gz
llvm-6a1457e6c1986c37819675a4b5b7b3a9f6551981.tar.bz2
Tooling: Hide implementation details
NFC. llvm-svn: 231656
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Tooling/CompilationDatabase.cpp10
-rw-r--r--clang/lib/Tooling/FileMatchTrie.cpp15
2 files changed, 15 insertions, 10 deletions
diff --git a/clang/lib/Tooling/CompilationDatabase.cpp b/clang/lib/Tooling/CompilationDatabase.cpp
index 7613988..383fb1a 100644
--- a/clang/lib/Tooling/CompilationDatabase.cpp
+++ b/clang/lib/Tooling/CompilationDatabase.cpp
@@ -29,9 +29,8 @@
#include "llvm/Support/Path.h"
#include <sstream>
#include <system_error>
-
-namespace clang {
-namespace tooling {
+using namespace clang;
+using namespace tooling;
CompilationDatabase::~CompilationDatabase() {}
@@ -109,6 +108,7 @@ CompilationDatabase::autoDetectFromDirectory(StringRef SourceDir,
CompilationDatabasePlugin::~CompilationDatabasePlugin() {}
+namespace {
// Helper for recursively searching through a chain of actions and collecting
// all inputs, direct and indirect, of compile jobs.
struct CompileJobAnalyzer {
@@ -183,6 +183,7 @@ struct MatchesAny {
private:
ArrayRef<std::string> Arr;
};
+} // namespace
/// \brief Strips any positional args and possible argv[0] from a command-line
/// provided by the user to construct a FixedCompilationDatabase.
@@ -324,6 +325,9 @@ FixedCompilationDatabase::getAllCompileCommands() const {
return std::vector<CompileCommand>();
}
+namespace clang {
+namespace tooling {
+
// This anchor is used to force the linker to link in the generated object file
// and thus register the JSONCompilationDatabasePlugin.
extern volatile int JSONAnchorSource;
diff --git a/clang/lib/Tooling/FileMatchTrie.cpp b/clang/lib/Tooling/FileMatchTrie.cpp
index dc9999e..86ed036 100644
--- a/clang/lib/Tooling/FileMatchTrie.cpp
+++ b/clang/lib/Tooling/FileMatchTrie.cpp
@@ -17,18 +17,20 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <sstream>
+using namespace clang;
+using namespace tooling;
-namespace clang {
-namespace tooling {
-
+namespace {
/// \brief Default \c PathComparator using \c llvm::sys::fs::equivalent().
struct DefaultPathComparator : public PathComparator {
- virtual ~DefaultPathComparator() {}
bool equivalent(StringRef FileA, StringRef FileB) const override {
return FileA == FileB || llvm::sys::fs::equivalent(FileA, FileB);
}
};
+}
+namespace clang {
+namespace tooling {
/// \brief A node of the \c FileMatchTrie.
///
/// Each node has storage for up to one path and a map mapping a path segment to
@@ -156,6 +158,8 @@ private:
// The children of this node stored in a map based on the next path segment.
llvm::StringMap<FileMatchTrieNode> Children;
};
+} // end namespace tooling
+} // end namespace clang
FileMatchTrie::FileMatchTrie()
: Root(new FileMatchTrieNode), Comparator(new DefaultPathComparator()) {}
@@ -183,6 +187,3 @@ StringRef FileMatchTrie::findEquivalent(StringRef FileName,
Error << "Path is ambiguous";
return Result;
}
-
-} // end namespace tooling
-} // end namespace clang