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
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp
index 92f3104..cf174dd 100644
--- a/tools/llvmc2/CompilationGraph.cpp
+++ b/tools/llvmc2/CompilationGraph.cpp
@@ -32,6 +32,19 @@
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 @@
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 @@
// 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);