[MustExecute] Silence clang warning about unused captured 'this'
authorMikael Holmen <mikael.holmen@ericsson.com>
Thu, 31 Oct 2019 08:40:29 +0000 (09:40 +0100)
committerMikael Holmen <mikael.holmen@ericsson.com>
Thu, 31 Oct 2019 08:41:05 +0000 (09:41 +0100)
New code introduced in fe799c97fa caused clang to complain with

../lib/Analysis/MustExecute.cpp:360:34: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
  GetterTy<LoopInfo> LIGetter = [this](const Function &F) {
                                 ^~~~
../lib/Analysis/MustExecute.cpp:365:44: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
  GetterTy<PostDominatorTree> PDTGetter = [this](const Function &F) {
                                           ^~~~
2 errors generated.

llvm/lib/Analysis/MustExecute.cpp

index a796cc7..585c984 100644 (file)
@@ -357,12 +357,12 @@ bool MustBeExecutedContextPrinter::runOnModule(Module &M) {
   // We provide non-PM analysis here because the old PM doesn't like to query
   // function passes from a module pass. Given that this is a printer, we don't
   // care much about memory leaks.
-  GetterTy<LoopInfo> LIGetter = [this](const Function &F) {
+  GetterTy<LoopInfo> LIGetter = [](const Function &F) {
     DominatorTree *DT = new DominatorTree(const_cast<Function &>(F));
     LoopInfo *LI = new LoopInfo(*DT);
     return LI;
   };
-  GetterTy<PostDominatorTree> PDTGetter = [this](const Function &F) {
+  GetterTy<PostDominatorTree> PDTGetter = [](const Function &F) {
     PostDominatorTree *PDT = new PostDominatorTree(const_cast<Function &>(F));
     return PDT;
   };