diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:10:47 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:10:47 +0000 |
commit | 14ec27fff1cddeb0255dc384f353a1a7e51b1c7e (patch) | |
tree | f9bb3dbf275b6db9f117f87a54c98f19f8573f8f /utils | |
parent | b5ccfbf0a977504476f740cab14cc5ffc332575b (diff) | |
download | external_llvm-14ec27fff1cddeb0255dc384f353a1a7e51b1c7e.zip external_llvm-14ec27fff1cddeb0255dc384f353a1a7e51b1c7e.tar.gz external_llvm-14ec27fff1cddeb0255dc384f353a1a7e51b1c7e.tar.bz2 |
Some small tweaks to make the generated code prettier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/LLVMCConfigurationEmitter.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp index 8f51c67..2bac703 100644 --- a/utils/TableGen/LLVMCConfigurationEmitter.cpp +++ b/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. |