[clang] [NFC] Delete useless call (PR #126874)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 01:12:28 PST 2025


================
@@ -440,7 +440,6 @@ static SVal castArgToParamTypeIfNeeded(const CallEvent &Call, unsigned ArgIdx,
     return ArgVal;
 
   const FunctionDecl *Definition = CallExprDecl;
-  Definition->hasBody(Definition);
----------------
steakhal wrote:

The removal of this would break the `clang/test/Analysis/region-store.c:79:3` test case. It's intentional.
The `hasBody` (awkwardly though), sets the parameter (`Definition`) to the definition decl of the function decl if it has definition.

I could have used the `if (const auto *Def = CallExprDecl.getDefinition()) Definition = Def;` but that would have been longer to spell, along with a controlflow statement.

https://github.com/llvm/llvm-project/pull/126874


More information about the cfe-commits mailing list