summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvmc2/CompilationGraph.h
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:47:46 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-09-22 20:47:46 +0000
commit8a2bdc74b2217e1004cda962384fa16f045d6bb8 (patch)
treee15cd7dcece314baffd15841ba684ed20318d37c /llvm/tools/llvmc2/CompilationGraph.h
parent632d982a7fa0f486e464842fc352cac3d6781146 (diff)
downloadbcm5719-llvm-8a2bdc74b2217e1004cda962384fa16f045d6bb8.tar.gz
bcm5719-llvm-8a2bdc74b2217e1004cda962384fa16f045d6bb8.zip
Get rid of GlobalLanguageMap. Global state is evil.
llvm-svn: 56462
Diffstat (limited to 'llvm/tools/llvmc2/CompilationGraph.h')
-rw-r--r--llvm/tools/llvmc2/CompilationGraph.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/llvm/tools/llvmc2/CompilationGraph.h b/llvm/tools/llvmc2/CompilationGraph.h
index 4324c38ab85..71ae2272eb8 100644
--- a/llvm/tools/llvmc2/CompilationGraph.h
+++ b/llvm/tools/llvmc2/CompilationGraph.h
@@ -32,6 +32,14 @@ namespace llvmc {
typedef llvm::StringSet<> InputLanguagesSet;
+ /// LanguageMap - Maps from extensions to language names.
+ class LanguageMap : public llvm::StringMap<std::string> {
+ public:
+
+ /// GetLanguage - Find the language name corresponding to a given file.
+ const std::string& GetLanguage(const llvm::sys::Path&) const;
+ };
+
/// Edge - Represents an edge of the compilation graph.
class Edge : public llvm::RefCountedBaseVPTR<Edge> {
public:
@@ -128,7 +136,7 @@ namespace llvmc {
/// Build - Build target(s) from the input file set. Command-line
/// options are passed implicitly as global variables.
- int Build(llvm::sys::Path const& tempDir);
+ int Build(llvm::sys::Path const& TempDir, const LanguageMap& LangMap);
/// getNode - Return a reference to the node correponding to the
/// given tool name. Throws std::runtime_error.
@@ -161,16 +169,19 @@ namespace llvmc {
/// starting at StartNode.
void PassThroughGraph (const llvm::sys::Path& In, const Node* StartNode,
const InputLanguagesSet& InLangs,
- const llvm::sys::Path& TempDir) const;
+ const llvm::sys::Path& TempDir,
+ const LanguageMap& LangMap) const;
/// FindToolChain - Find head of the toolchain corresponding to the given file.
const Node* FindToolChain(const llvm::sys::Path& In,
- const std::string* forceLanguage,
- InputLanguagesSet& InLangs) const;
+ const std::string* ForceLanguage,
+ InputLanguagesSet& InLangs,
+ const LanguageMap& LangMap) const;
/// BuildInitial - Traverse the initial parts of the toolchains.
void BuildInitial(InputLanguagesSet& InLangs,
- const llvm::sys::Path& TempDir);
+ const llvm::sys::Path& TempDir,
+ const LanguageMap& LangMap);
/// TopologicalSort - Sort the nodes in topological order.
void TopologicalSort(std::vector<const Node*>& Out);
OpenPOWER on IntegriCloud