If we have int foo(int a) { return a; } and we run with --function-signature
enabled, we want a single variable declaration for a which is reused
later.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 40407 Build 40514: arc lint + arc unit
Event Timeline
Take line 8 here https://reviews.llvm.org/D68766#change-4geuqNmmUCZL
`; ARGPROMOTION-NEXT: ret i32 [[X_VAL]]`
It uses [[X_VAL]] which is an argument of the function.
Without this check line would look like this:
`; ARGPROMOTION-NEXT: ret i32 [[X:.%*]]`
which has no relationship to the argument.
Now that i believe there's some testing infra for these utils, add/update tests for this?
This is "opt-in" with the --function-signature option. I added an explicit test and the basic test should cover that as well, e.g., only the .funcsig. version is affected.
Right, we couldn't have already matched function arg names because we don't normally do that.
Unit tests: fail. 61155 tests passed, 1 failed and 728 were skipped.
failed: LLVM.tools/UpdateTestChecks/update_test_checks/argument_name_reuse.test
clang-tidy: pass.
clang-format: pass.
Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml