[PATCH] D150221: Add option -fkeep-static-variables to emit all static variables

Chris Bowler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 13:59:00 PDT 2023


cebowleratibm added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2207
+        addUsedOrCompilerUsedGlobal(GV);
+      else if (CodeGenOpts.KeepStaticConsts && VD->getType().isConstQualified())
+        addUsedOrCompilerUsedGlobal(GV);
----------------
why not fold the `if` and `else if` together given that they perform the same action.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3096
+        return true;
+      else if (CodeGenOpts.KeepStaticConsts && VD->getType().isConstQualified())
+        return true;
----------------
Fold to a single return.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150221



More information about the cfe-commits mailing list