Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / clang / unittests / Tooling / RecursiveASTVisitorTests / LambdaDefaultCapture.cpp
blob4a9175ed2dda2422c3d180f6d9b55ac8aec48d21
1 //===- unittest/Tooling/RecursiveASTVisitorTests/LambdaDefaultCapture.cpp -===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "TestVisitor.h"
11 using namespace clang;
13 namespace {
15 // Matches the (optional) capture-default of a lambda-introducer.
16 class LambdaDefaultCaptureVisitor : public ExpectedLocationVisitor {
17 public:
18 bool VisitLambdaExpr(LambdaExpr *Lambda) override {
19 if (Lambda->getCaptureDefault() != LCD_None) {
20 Match("", Lambda->getCaptureDefaultLoc());
22 return true;
26 TEST(RecursiveASTVisitor, HasCaptureDefaultLoc) {
27 LambdaDefaultCaptureVisitor Visitor;
28 Visitor.ExpectMatch("", 1, 20);
29 EXPECT_TRUE(Visitor.runOver("void f() { int a; [=]{a;}; }",
30 LambdaDefaultCaptureVisitor::Lang_CXX11));
33 } // end anonymous namespace