aboutsummaryrefslogtreecommitdiffstats
path: root/utils
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
commitcdbfa1aa913916d9480e651433388bc95b11c70a (patch)
treebd6c8475e211483b2956467729abb6d5044e9908 /utils
parent71ded9b23ed7e7eabc136024a0f8bc97f6cdc4f7 (diff)
downloadexternal_llvm-cdbfa1aa913916d9480e651433388bc95b11c70a.zip
external_llvm-cdbfa1aa913916d9480e651433388bc95b11c70a.tar.gz
external_llvm-cdbfa1aa913916d9480e651433388bc95b11c70a.tar.bz2
Get rid of GlobalLanguageMap. Global state is evil.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index bc74299..133415b 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -826,8 +826,9 @@ bool EmitCaseTest1Arg(const std::string& TestName,
O << "InLangs.count(\"" << OptName << "\") != 0";
return true;
} else if (TestName == "in_language") {
+ // TODO: remove this restriction
// Works only for cmd_line!
- O << "GetLanguage(inFile) == \"" << OptName << '\"';
+ O << "LangMap.GetLanguage(inFile) == \"" << OptName << '\"';
return true;
} else if (TestName == "not_empty") {
if (OptName == "o") {
@@ -1205,7 +1206,8 @@ void EmitGenerateActionMethod (const ToolProperties& P,
O << Indent1 << "Action GenerateAction(const sys::Path& inFile,\n";
O << Indent2 << "const sys::Path& outFile,\n"
- << Indent2 << "const InputLanguagesSet& InLangs) const\n"
+ << Indent2 << "const InputLanguagesSet& InLangs,\n"
+ << Indent2 << "const LanguageMap& LangMap) const\n"
<< Indent1 << "{\n"
<< Indent2 << "const char* cmd;\n"
<< Indent2 << "std::vector<std::string> vec;\n";
@@ -1245,7 +1247,8 @@ void EmitGenerateActionMethods (const ToolProperties& P,
if (!P.isJoin())
O << Indent1 << "Action GenerateAction(const PathVector& inFiles,\n"
<< Indent2 << "const llvm::sys::Path& outFile,\n"
- << Indent2 << "const InputLanguagesSet& InLangs) const\n"
+ << Indent2 << "const InputLanguagesSet& InLangs,\n"
+ << Indent2 << "const LanguageMap& LangMap) const\n"
<< Indent1 << "{\n"
<< Indent2 << "throw std::runtime_error(\"" << P.Name
<< " is not a Join tool!\");\n"
@@ -1451,7 +1454,7 @@ void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
throw std::string("Error in the language map definition!");
// Generate code
- O << "void llvmc::PopulateLanguageMap() {\n";
+ O << "void llvmc::PopulateLanguageMap(LanguageMap& langMap) {\n";
for (unsigned i = 0; i < LangsToSuffixesList->size(); ++i) {
Record* LangToSuffixes = LangsToSuffixesList->getElementAsRecord(i);
@@ -1460,7 +1463,7 @@ void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
const ListInit* Suffixes = LangToSuffixes->getValueAsListInit("suffixes");
for (unsigned i = 0; i < Suffixes->size(); ++i)
- O << Indent1 << "GlobalLanguageMap[\""
+ O << Indent1 << "langMap[\""
<< InitPtrToString(Suffixes->getElement(i))
<< "\"] = \"" << Lang << "\";\n";
}
@@ -1588,8 +1591,7 @@ void EmitPopulateCompilationGraph (Record* CompilationGraph,
ListInit* edges = CompilationGraph->getValueAsListInit("edges");
// Generate code
- O << "void llvmc::PopulateCompilationGraph(CompilationGraph& G) {\n"
- << Indent1 << "PopulateLanguageMap();\n\n";
+ O << "void llvmc::PopulateCompilationGraph(CompilationGraph& G) {\n";
// Insert vertices