[PATCH] D79624: [NFC][DwarfDebug] Prefer explicit to auto type deduction

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 23:57:38 PDT 2020


dblaikie added a comment.

> We should use explicit type instead of auto type deduction when the type is so obvious.

This seems like it goes against the LLVM Style Guide, which says "Don’t “almost always” use auto, but **do use auto with** initializers like cast<Foo>(...) or other **places where the type is already obvious from the context**."

I don't think it's super necessary (I wouldn't advocate for someone changing this code to use auto alone, anymore than I advocate for the change to remove auto here), but equally I'm not sure this change was warranted - please revert it.

If you like, you can keep these things as references, rather than pointers, I think that's generally good - I'm all for more references/fewer pointers. And certainly the old code was misleading in that it unnecessarily used reference lifetime extension, and should've instead use ```const auto *``` if it was going to have these as pointer typed variables.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79624





More information about the llvm-commits mailing list