summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit2f51489a62f598617bf9bf74f0dabc2aeca65e0c (patch)
tree1f10c30139f3332b5b0a7ef95837848ccc2b393d /llvm/tools/llvmc2/CompilationGraph.cpp
parent90777a5b82ce888d8654ec463b3b2a5b63226fd9 (diff)
downloadbcm5719-llvm-2f51489a62f598617bf9bf74f0dabc2aeca65e0c.tar.gz
bcm5719-llvm-2f51489a62f598617bf9bf74f0dabc2aeca65e0c.zip
New tests for the 'case' expression: not_empty, in_language.
llvm-svn: 51744
Diffstat (limited to 'llvm/tools/llvmc2/CompilationGraph.cpp')
-rw-r--r--llvm/tools/llvmc2/CompilationGraph.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/tools/llvmc2/CompilationGraph.cpp b/llvm/tools/llvmc2/CompilationGraph.cpp
index 92f3104c018..cf174dd56f3 100644
--- a/llvm/tools/llvmc2/CompilationGraph.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud