[PATCH] D132089: [BOLT][NFC] Simplify handleRelocation

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 18:42:05 PDT 2022


rafauler added inline comments.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:2428-2429
   if (!IsSectionRelocation) {
-    if (BinaryFunction *BF =
-            BC->getBinaryFunctionContainingAddress(SymbolAddress)) {
+    BinaryFunction *BF = BC->getBinaryFunctionContainingAddress(SymbolAddress);
+    if (BF) {
       if (BF != ReferencedBF) {
----------------
I think it's better to have BinaryFunction *BF inside the if clause, so it's clear that the scope of the BF variable does not extend past this if. Unless I'm missing something else.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132089/new/

https://reviews.llvm.org/D132089



More information about the llvm-commits mailing list