aboutsummaryrefslogtreecommitdiff
path: root/tools/llvmc2/CompilationGraph.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-05-30 06:19:52 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-05-30 06:19:52 +0000
commit2e73e851d8a4b5abea990011c201dc391e5e04c1 (patch)
tree6ee6babd033cf0eb247f3a8b58c6ecf34408613c /tools/llvmc2/CompilationGraph.cpp
parentef4160dff0b348e669a29b1427a2131b53750506 (diff)
New tests for the 'case' expression: not_empty, in_language.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc2/CompilationGraph.cpp')
-rw-r--r--tools/llvmc2/CompilationGraph.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp
index 92f3104c01..cf174dd56f 100644
--- a/tools/llvmc2/CompilationGraph.cpp
+++ b/tools/llvmc2/CompilationGraph.cpp
@@ -32,6 +32,19 @@ extern cl::list<std::string> InputFilenames;
extern cl::opt<std::string> OutputFilename;
extern cl::list<std::string> Languages;
+namespace llvmc {
+ /// ExtsToLangs - Map from file extensions to language names.
+ LanguageMap GlobalLanguageMap;
+
+ /// GetLanguage - Find the language name corresponding to the given file.
+ const std::string& GetLanguage(const sys::Path& File) {
+ LanguageMap::const_iterator Lang = GlobalLanguageMap.find(File.getSuffix());
+ if (Lang == GlobalLanguageMap.end())
+ throw std::runtime_error("Unknown suffix: " + File.getSuffix());
+ return Lang->second;
+ }
+}
+
namespace {
/// ChooseEdge - Return the edge with the maximum weight.
@@ -87,14 +100,6 @@ const Node& CompilationGraph::getNode(const std::string& ToolName) const {
return I->second;
}
-// Find the language name corresponding to the given file.
-const std::string& CompilationGraph::getLanguage(const sys::Path& File) const {
- LanguageMap::const_iterator Lang = ExtsToLangs.find(File.getSuffix());
- if (Lang == ExtsToLangs.end())
- throw std::runtime_error("Unknown suffix: " + File.getSuffix());
- return Lang->second;
-}
-
// Find the tools list corresponding to the given language name.
const CompilationGraph::tools_vector_type&
CompilationGraph::getToolsVector(const std::string& LangName) const
@@ -200,7 +205,7 @@ FindToolChain(const sys::Path& In, const std::string* forceLanguage,
// Determine the input language.
const std::string& InLanguage =
- forceLanguage ? *forceLanguage : getLanguage(In);
+ forceLanguage ? *forceLanguage : GetLanguage(In);
// Add the current input language to the input language set.
InLangs.insert(InLanguage);