summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2008-05-30 06:10:47 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2008-05-30 06:10:47 +0000
commitf1c87ff378b97551b381741c8f9cde311bf27a2c (patch)
tree33d3d3b9780a9bde294b243b1858b966feb18c66 /llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
parente57a4033385c5976cbb17af1e962b1224a61183b (diff)
downloadbcm5719-llvm-f1c87ff378b97551b381741c8f9cde311bf27a2c.tar.gz
bcm5719-llvm-f1c87ff378b97551b381741c8f9cde311bf27a2c.zip
Some small tweaks to make the generated code prettier.
llvm-svn: 51729
Diffstat (limited to 'llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp')
-rw-r--r--llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 8f51c67da81..2bac7036e29 100644
--- a/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/llvm/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -776,13 +776,22 @@ void EmitForwardOptionPropertyHandlingCode (const ToolOptionDescription& D,
}
}
+// A helper function used by EmitOptionPropertyHandlingCode() that
+// tells us whether we should emit any code at all.
+bool ToolOptionHasInterestingProperties(const ToolOptionDescription& D) {
+ if (!D.isForward() && !D.isUnpackValues() && D.Props.empty())
+ return false;
+ return true;
+}
+
/// EmitOptionPropertyHandlingCode - Helper function used by
/// EmitGenerateActionMethod(). Emits code that handles option
/// properties.
-void EmitOptionPropertyHandlingCode (const ToolProperties& P,
- const ToolOptionDescription& D,
+void EmitOptionPropertyHandlingCode (const ToolOptionDescription& D,
std::ostream& O)
{
+ if (!ToolOptionHasInterestingProperties(D))
+ return;
// Start of the if-clause.
O << Indent2 << "if (";
if (D.Type == OptionType::Switch)
@@ -878,7 +887,8 @@ class EmitCmdLineVecFillCallback {
void operator()(const Init* Statement, const char* IndentLevel,
std::ostream& O) const
{
- EmitCmdLineVecFill(Statement, ToolName, Version, IndentLevel, O);
+ EmitCmdLineVecFill(Statement, ToolName, Version,
+ (std::string(IndentLevel) + Indent1).c_str(), O);
}
};
@@ -910,7 +920,7 @@ void EmitGenerateActionMethod (const ToolProperties& P,
for (ToolOptionDescriptions::const_iterator B = P.OptDescs.begin(),
E = P.OptDescs.end(); B != E; ++B) {
const ToolOptionDescription& val = B->second;
- EmitOptionPropertyHandlingCode(P, val, O);
+ EmitOptionPropertyHandlingCode(val, O);
}
// Handle the Sink property.
OpenPOWER on IntegriCloud