[llvm-commits] [llvm] r111619 - in /llvm/trunk: include/llvm/CompilerDriver/BuiltinOptions.h lib/CompilerDriver/BuiltinOptions.cpp tools/llvmc/examples/mcc16/Hooks.cpp utils/TableGen/LLVMCConfigurationEmitter.cpp
Mikhail Glushenkov
foldr at codedgers.com
Fri Aug 20 04:24:44 PDT 2010
Author: foldr
Date: Fri Aug 20 06:24:44 2010
New Revision: 111619
URL: http://llvm.org/viewvc/llvm-project?rev=111619&view=rev
Log:
llvmc: Cut global namespace pollution.
Modified:
llvm/trunk/include/llvm/CompilerDriver/BuiltinOptions.h
llvm/trunk/lib/CompilerDriver/BuiltinOptions.cpp
llvm/trunk/tools/llvmc/examples/mcc16/Hooks.cpp
llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
Modified: llvm/trunk/include/llvm/CompilerDriver/BuiltinOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/BuiltinOptions.h?rev=111619&r1=111618&r2=111619&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/BuiltinOptions.h (original)
+++ llvm/trunk/include/llvm/CompilerDriver/BuiltinOptions.h Fri Aug 20 06:24:44 2010
@@ -18,6 +18,8 @@
#include <string>
+namespace llvmc {
+
namespace SaveTempsEnum { enum Values { Cwd, Obj, Unset }; }
extern llvm::cl::list<std::string> InputFilenames;
@@ -32,4 +34,6 @@
extern llvm::cl::opt<bool> WriteGraph;
extern llvm::cl::opt<SaveTempsEnum::Values> SaveTemps;
+} // End namespace llvmc.
+
#endif // LLVM_INCLUDE_COMPILER_DRIVER_BUILTIN_OPTIONS_H
Modified: llvm/trunk/lib/CompilerDriver/BuiltinOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CompilerDriver/BuiltinOptions.cpp?rev=111619&r1=111618&r2=111619&view=diff
==============================================================================
--- llvm/trunk/lib/CompilerDriver/BuiltinOptions.cpp (original)
+++ llvm/trunk/lib/CompilerDriver/BuiltinOptions.cpp Fri Aug 20 06:24:44 2010
@@ -19,7 +19,7 @@
namespace cl = llvm::cl;
-// External linkage here is intentional.
+namespace llvmc {
cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input file>"),
cl::ZeroOrMore);
@@ -57,3 +57,5 @@
clEnumValN(SaveTempsEnum::Obj, "", "Same as 'cwd'"),
clEnumValEnd),
cl::ValueOptional);
+
+} // End namespace llvmc.
Modified: llvm/trunk/tools/llvmc/examples/mcc16/Hooks.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/examples/mcc16/Hooks.cpp?rev=111619&r1=111618&r2=111619&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/examples/mcc16/Hooks.cpp (original)
+++ llvm/trunk/tools/llvmc/examples/mcc16/Hooks.cpp Fri Aug 20 06:24:44 2010
@@ -4,13 +4,16 @@
#include <string>
-using namespace llvm;
-
namespace llvmc {
extern char *ProgramName;
+
+ namespace autogenerated {
+ extern llvm::cl::opt<std::string> AutoGeneratedParameter_p;
+ }
}
-extern cl::opt<std::string> AutoGeneratedParameter_p;
+using namespace llvm;
+using namespace llvmc;
// Returns the platform specific directory separator via #ifdefs.
// FIXME: This currently work on linux and windows only. It does not
@@ -29,10 +32,10 @@
std::string
GetLowerCasePartDefine(void) {
std::string Partname;
- if (AutoGeneratedParameter_p.empty()) {
+ if (autogenerated::AutoGeneratedParameter_p.empty()) {
Partname = "16f1xxx";
} else {
- Partname = AutoGeneratedParameter_p;
+ Partname = autogenerated::AutoGeneratedParameter_p;
}
std::string LowerCase;
@@ -46,10 +49,10 @@
std::string
GetUpperCasePartDefine(void) {
std::string Partname;
- if (AutoGeneratedParameter_p.empty()) {
+ if (autogenerated::AutoGeneratedParameter_p.empty()) {
Partname = "16f1xxx";
} else {
- Partname = AutoGeneratedParameter_p;
+ Partname = autogenerated::AutoGeneratedParameter_p;
}
std::string UpperCase;
Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=111619&r1=111618&r2=111619&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Fri Aug 20 06:24:44 2010
@@ -2909,7 +2909,6 @@
if (HookNames.empty())
return;
- O << "namespace hooks {\n";
for (HookInfoMap::const_iterator B = HookNames.begin(),
E = HookNames.end(); B != E; ++B) {
const char* HookName = B->first();
@@ -2928,7 +2927,6 @@
O <<");\n";
}
- O << "}\n\n";
}
/// EmitIncludes - Emit necessary #include directives and some
@@ -3013,12 +3011,19 @@
EmitIncludes(O);
// Emit global option registration code.
+ O << "namespace llvmc {\n"
+ << "namespace autogenerated {\n\n";
EmitOptionDefinitions(Data.OptDescs, Data.HasSink, O);
+ O << "} // End namespace autogenerated.\n"
+ << "} // End namespace llvmc.\n\n";
// Emit hook declarations.
+ O << "namespace hooks {\n";
EmitHookDeclarations(Data.ToolDescs, Data.OptDescs, O);
+ O << "} // End namespace hooks.\n\n";
O << "namespace {\n\n";
+ O << "using namespace llvmc::autogenerated;\n\n";
// Emit Tool classes.
for (ToolDescriptions::const_iterator B = Data.ToolDescs.begin(),
More information about the llvm-commits
mailing list