[llvm-commits] [llvm] r60871 - /llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
Mikhail Glushenkov
foldr at codedgers.com
Thu Dec 11 02:34:40 PST 2008
Author: foldr
Date: Thu Dec 11 04:34:18 2008
New Revision: 60871
URL: http://llvm.org/viewvc/llvm-project?rev=60871&view=rev
Log:
Put Edge* classes into anonymous namespace.
Prevents conflicts between plugins.
Modified:
llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=60871&r1=60870&r2=60871&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Thu Dec 11 04:34:18 2008
@@ -1500,7 +1500,6 @@
void EmitPopulateLanguageMap (const RecordKeeper& Records, std::ostream& O)
{
// Generate code
- O << "namespace {\n\n";
O << "void PopulateLanguageMapLocal(LanguageMap& langMap) {\n";
// Get the relevant field out of RecordKeeper
@@ -1526,7 +1525,7 @@
}
}
- O << "}\n\n}\n\n";
+ O << "}\n\n";
}
/// IncDecWeight - Helper function passed to EmitCaseConstructHandler()
@@ -1595,7 +1594,6 @@
const ToolDescriptions& ToolDescs,
std::ostream& O)
{
- O << "namespace {\n\n";
O << "void PopulateCompilationGraphLocal(CompilationGraph& G) {\n";
for (ToolDescriptions::const_iterator B = ToolDescs.begin(),
@@ -1625,7 +1623,7 @@
++i;
}
- O << "}\n\n}\n\n";
+ O << "}\n\n";
}
/// ExtractHookNames - Extract the hook names from all instances of
@@ -1692,8 +1690,7 @@
/// EmitRegisterPlugin - Emit code to register this plugin.
void EmitRegisterPlugin(int Priority, std::ostream& O) {
- O << "namespace {\n\n"
- << "struct Plugin : public llvmc::BasePlugin {\n\n"
+ O << "struct Plugin : public llvmc::BasePlugin {\n\n"
<< Indent1 << "int Priority() const { return " << Priority << "; }\n\n"
<< Indent1 << "void PopulateLanguageMap(LanguageMap& langMap) const\n"
<< Indent1 << "{ PopulateLanguageMapLocal(langMap); }\n\n"
@@ -1702,7 +1699,7 @@
<< Indent1 << "{ PopulateCompilationGraphLocal(graph); }\n"
<< "};\n\n"
- << "static llvmc::RegisterPlugin<Plugin> RP;\n\n}\n\n";
+ << "static llvmc::RegisterPlugin<Plugin> RP;\n\n";
}
/// EmitIncludes - Emit necessary #include directives and some
@@ -1811,6 +1808,8 @@
// Emit hook declarations.
EmitHookDeclarations(Data.ToolDescs, O);
+ O << "namespace {\n\n";
+
// Emit PopulateLanguageMap() function
// (a language map maps from file extensions to language names).
EmitPopulateLanguageMap(Records, O);
@@ -1829,6 +1828,7 @@
// Emit code for plugin registration.
EmitRegisterPlugin(Data.Priority, O);
+ O << "} // End anonymous namespace.\n";
// EOF
}
More information about the llvm-commits
mailing list