[PATCH] D119705: [flang] Fix `LoweringBridge::validModule`

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 10:58:31 PST 2022


schweitz added inline comments.


================
Comment at: flang/include/flang/Lower/Bridge.h:87
 
-  bool validModule() { return getModule(); }
+  bool validModule() { return (nullptr != module); }
 
----------------
awarzynski wrote:
> schweitz wrote:
> > Someone else called this "Yoda style". But their question remains: why use it?
> [[ https://en.wikipedia.org/wiki/Yoda_conditions | Yoda Condition ]] ;-)
> 
> Tl:Dr With this style, you will never write `var = 0` instead of `var == 0` (compilers will complain about `0 = var`, but not about `0 == var`). Happy to change to `module != nullptr` if that's what you prefer.
I expect that `module != nullptr` wouldn't attract any attention. ;)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119705



More information about the llvm-commits mailing list