[PATCH] D28911: [LinkerScript] Implement `MEMORY` command

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 21 16:51:04 PST 2017


ruiu added inline comments.


================
Comment at: ELF/LinkerScript.cpp:541
+  MemoryRegion *MatchingMemRegion = nullptr;
+  for (auto &MR : Opt.MemoryRegions) {
+    if ((MR.second.Flags & Sec->Flags) != 0 &&
----------------
meadori wrote:
> ruiu wrote:
> > We don't usually use `auto` in this context.
> This is iterating a map, thus the direct declaration would be something gross like `llvm::DenseMap<llvm::StringRef, MemoryRegion>::value_type`.  Personally, I think the `auto` is cleaner.
> 
> Also, there is precedence in the existing code with things like:
> 
> ```
> for (auto I = Cmd->Commands.begin(); I != E; ++I)
>     process(**I);
> ```
Got it. Then can you use a temporary variable like this so that the type becomes obvious?

  MemroyRegion &M = MR.second;


https://reviews.llvm.org/D28911





More information about the llvm-commits mailing list