[PATCH] D59664: [llvm] Non-functional change: declared a couple of local variables as const.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 19:07:59 PDT 2019


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/MC/MCContext.h:528
     const MCDwarfLineTable &getMCDwarfLineTable(unsigned CUID) const {
-      auto I = MCDwarfLineTablesCUMap.find(CUID);
+      const auto &I = MCDwarfLineTablesCUMap.find(CUID);
       assert(I != MCDwarfLineTablesCUMap.end());
----------------
This doesn't immediately make sense to me - 'find' probably (I haven't double checked the type of MCDwarfLineTablesCUMap to confirm this, but find on most containers works this way) returns an iterator by value. Binding that to a reference is a bit surprising/confusing/unnecessary (& relies on reference lifetime extension - a rarely used/subtle feature)

So probably don't make this change.


================
Comment at: llvm/lib/MC/MCAsmStreamer.cpp:1914
   // directly, the label is the only work required here.
-  auto &Tables = getContext().getMCDwarfLineTables();
+  const auto &Tables = getContext().getMCDwarfLineTables();
   if (!Tables.empty()) {
----------------
Seems reasonable


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59664





More information about the llvm-commits mailing list