[PATCH] D32707: lldb-dwarfdump -verify [-quiet]

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 15:01:56 PDT 2017


aprantl added inline comments.


================
Comment at: tools/llvm-dwarfdump/llvm-dwarfdump.cpp:130
   if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get()))
     DumpObjectFile(*Obj, Filename);
   else if (auto *Fat = dyn_cast<MachOUniversalBinary>(BinOrErr->get()))
----------------
aprantl wrote:
> clayborg wrote:
> > There are two calls to DumpObjectFile here, see the call below. Do we want to duplicate the twine below twice? Seems cleaner to do it the way it is currently done? The top loop uses std::for_each to we can't get the return value so we have to use a global anyway.
> If we stick with boolean return values, we could use std::all_of(Objects.begin(), Objects.end(), Verify) and it would still look kind of nice.
Hmm.. I guess it will be more like: 
```
auto Action = [&](Object *Obj)->bool {
 bool Result = true;
  if (Dump && !Quiet)
     DumpObjectFile(*Obj);
  if (Verify)
     Result = VerifyObjectFile(Obj);
  return Result; 
};

std::all_of(Objects.begin(), Objects.end(), Action) 
```
 


https://reviews.llvm.org/D32707





More information about the llvm-commits mailing list