[Lldb-commits] [lldb] r277608 - Fix an unused variable warning in release builds.

Luke Drummond via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 3 09:29:45 PDT 2016


Author: ldrumm
Date: Wed Aug  3 11:29:45 2016
New Revision: 277608

URL: http://llvm.org/viewvc/llvm-project?rev=277608&view=rev
Log:
Fix an unused variable warning in release builds.

``num_params`` was unused in RenderScript ABI fixup pass ``cloneToStructRetFnTy``
and was only used in an `assert()` that the number of function parameters for the cloned
function was correct.

Now we actually use this variable, rather than recomputing it, and avoid the unused variable
warning when building without asserts enabled.

Subscribers: lldb-commits

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp?rev=277608&r1=277607&r2=277608&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp Wed Aug  3 11:29:45 2016
@@ -103,8 +103,8 @@ cloneToStructRetFnTy(llvm::CallInst *cal
     if (log)
         log->Printf("%s - cloning to StructRet function for '%s'", __FUNCTION__, name.str().c_str());
 
-    std::vector<llvm::Type *> new_params{orig_type->getNumParams() + 1, nullptr};
     unsigned num_params = orig_type->getNumParams();
+    std::vector<llvm::Type *> new_params{num_params + 1, nullptr};
     std::vector<llvm::Type *> params{orig_type->param_begin(), orig_type->param_end()};
 
     // This may not work if the function is somehow declared void as llvm is strongly typed




More information about the lldb-commits mailing list