diff options
-rw-r--r-- | clang/unittests/Tooling/LookupTest.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/unittests/Tooling/LookupTest.cpp b/clang/unittests/Tooling/LookupTest.cpp index 632acbe4ba4..cc3922d01b5 100644 --- a/clang/unittests/Tooling/LookupTest.cpp +++ b/clang/unittests/Tooling/LookupTest.cpp @@ -13,18 +13,19 @@ using namespace clang; namespace { struct GetDeclsVisitor : TestVisitor<GetDeclsVisitor> { - std::function<void(CallExpr *)> OnCall = [&](CallExpr *Expr) {}; - std::function<void(RecordTypeLoc)> OnRecordTypeLoc = [&](RecordTypeLoc Type) { - }; + std::function<void(CallExpr *)> OnCall; + std::function<void(RecordTypeLoc)> OnRecordTypeLoc; SmallVector<Decl *, 4> DeclStack; bool VisitCallExpr(CallExpr *Expr) { - OnCall(Expr); + if (OnCall) + OnCall(Expr); return true; } bool VisitRecordTypeLoc(RecordTypeLoc Loc) { - OnRecordTypeLoc(Loc); + if (OnRecordTypeLoc) + OnRecordTypeLoc(Loc); return true; } |