[llvm] c950495 - [MustExecute] Silence clang warning about unused captured 'this'

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 01:45:15 PDT 2019


Author: Mikael Holmen
Date: 2019-10-31T09:41:05+01:00
New Revision: c9504954052a7630a6e760006297b5fc73a03e4a

URL: https://github.com/llvm/llvm-project/commit/c9504954052a7630a6e760006297b5fc73a03e4a
DIFF: https://github.com/llvm/llvm-project/commit/c9504954052a7630a6e760006297b5fc73a03e4a.diff

LOG: [MustExecute] Silence clang warning about unused captured 'this'

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.

Added: 
    

Modified: 
    llvm/lib/Analysis/MustExecute.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MustExecute.cpp b/llvm/lib/Analysis/MustExecute.cpp
index a796cc79ad89..585c984a00fb 100644
--- a/llvm/lib/Analysis/MustExecute.cpp
+++ b/llvm/lib/Analysis/MustExecute.cpp
@@ -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;
   };


        


More information about the llvm-commits mailing list