Previously, libclang users could visit the non-init C++11 lambda
captures, e.g. [foo]. But C++14 init-captures such as [foo=bar]
were skipped, which is fixed by this patch.
Details
Details
- Reviewers
cfe-commits hokein nik yvvan marcobubke klimek - Group Reviewers
Restricted Project - Commits
- rZORGbe29a9623011: [libclang] visit c++14 lambda capture init expressions
rGbe29a9623011: [libclang] visit c++14 lambda capture init expressions
rG2eebf4d939b6: [libclang] visit c++14 lambda capture init expressions
rL361234: [libclang] visit c++14 lambda capture init expressions
rC361234: [libclang] visit c++14 lambda capture init expressions
Diff Detail
Diff Detail
- Repository
- rC Clang
Event Timeline
Comment Actions
Tests do not pass on current trunk:
/d2/llvm/trunk/builds/DebugShared % bin/llvm-lit -a /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp llvm-lit: /d2/llvm/trunk/source/utils/lit/lit/llvm/config.py:341: note: using clang: /d2/llvm/trunk/builds/DebugShared/bin/clang -- Testing: 1 tests, single process -- FAIL: Clang :: Index/cxx14-lambdas.cpp (1 of 1) ******************** TEST 'Clang :: Index/cxx14-lambdas.cpp' FAILED ******************** Script: -- : 'RUN: at line 13'; /d2/llvm/trunk/builds/DebugShared/bin/c-index-test -test-load-source all -std=c++14 /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp | /d2/llvm/trunk/builds/DebugShared/bin/FileCheck -check-prefix=CHECK-LOAD /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp : 'RUN: at line 30'; env CINDEXTEST_INDEXLOCALSYMBOLS=1 /d2/llvm/trunk/builds/DebugShared/bin/c-index-test -index-file -std=c++14 /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp | /d2/llvm/trunk/builds/DebugShared/bin/FileCheck -check-prefix=CHECK-INDEX /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp -- Exit Code: 1 Command Output (stderr): -- /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cpp:22:16: error: CHECK-LOAD: expected string not found in input // CHECK-LOAD: cxx14-lambdas.cpp:7:27: DeclRefExpr=localA:6:9 Extent=[7:27 - 7:33] ^ <stdin>:390:1: note: scanning from here // CHECK: cxx14-lambdas.cpp:7:59: ParmDecl=x:7:59 (Definition) Extent=[7:51 - 7:60] ^ <stdin>:402:11: note: possible intended match here // CHECK: cxx14-lambdas.cpp:8:21: DeclRefExpr=copy:7:35 Extent=[8:21 - 8:25] ^ -- ******************** Testing Time: 0.13s ******************** Failing Tests (1): Clang :: Index/cxx14-lambdas.cpp Unexpected Failures: 1 zsh: exit 1 bin/llvm-lit -a /d2/llvm/trunk/source/tools/clang/test/Index/cxx14-lambdas.cp
Comment Actions
@nik odd, it works for me, I just switched to master (previously I used the 8x release branch) and applied this patch and build it all. Then I run:
$ make && ./bin/llvm-lit ~/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp makeobj[0]: Entering directory `/home/milian/projects/build/llvm-project' ninja: no work to do. makeobj[0]: Leaving directory `/home/milian/projects/build/llvm-project' llvm-lit: /home/milian/projects/src/llvm-project/llvm/utils/lit/lit/llvm/config.py:340: note: using clang: /home/milian/projects/build/llvm-project/bin/clang -- Testing: 1 tests, single process -- PASS: Clang :: Index/cxx14-lambdas.cpp (1 of 1) Testing Time: 0.09s Expected Passes : 1
Are you sure you have compiled this patch? If I comment out the visit of the InitExpr in CIndex.cpp again, then I get the same failure as you:
$ make && ./bin/llvm-lit -a ~/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp makeobj[0]: Entering directory `/home/milian/projects/build/llvm-project' ninja: no work to do. makeobj[0]: Leaving directory `/home/milian/projects/build/llvm-project' llvm-lit: /home/milian/projects/src/llvm-project/llvm/utils/lit/lit/llvm/config.py:340: note: using clang: /home/milian/projects/build/llvm-project/bin/clang -- Testing: 1 tests, single process -- FAIL: Clang :: Index/cxx14-lambdas.cpp (1 of 1) ******************** TEST 'Clang :: Index/cxx14-lambdas.cpp' FAILED ******************** Script: -- : 'RUN: at line 13'; /home/milian/projects/build/llvm-project/bin/c-index-test -test-load-source all -std=c++14 /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp | /home/milian/projects/build/llvm-project/bin/FileCheck -check-prefix=CHECK-LOAD /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp : 'RUN: at line 30'; env CINDEXTEST_INDEXLOCALSYMBOLS=1 /home/milian/projects/build/llvm-project/bin/c-index-test -index-file -std=c++14 /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp | /home/milian/projects/build/llvm-project/bin/FileCheck -check-prefix=CHECK-INDEX /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp -- Exit Code: 1 Command Output (stderr): -- /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp:22:16: error: CHECK-LOAD: expected string not found in input // CHECK-LOAD: cxx14-lambdas.cpp:7:27: DeclRefExpr=localA:6:9 Extent=[7:27 - 7:33] ^ <stdin>:390:1: note: scanning from here // CHECK: cxx14-lambdas.cpp:7:59: ParmDecl=x:7:59 (Definition) Extent=[7:51 - 7:60] ^ <stdin>:402:11: note: possible intended match here // CHECK: cxx14-lambdas.cpp:8:21: DeclRefExpr=copy:7:35 Extent=[8:21 - 8:25] ^ -- ******************** Testing Time: 0.07s ******************** Failing Tests (1): Clang :: Index/cxx14-lambdas.cpp Unexpected Failures: 1
Re-enabling the code and building again, it works fine again:
$ make && ./bin/llvm-lit -a ~/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp makeobj[0]: Entering directory `/home/milian/projects/build/llvm-project' [5/5] Linking CXX executable bin/c-index-test makeobj[0]: Leaving directory `/home/milian/projects/build/llvm-project' llvm-lit: /home/milian/projects/src/llvm-project/llvm/utils/lit/lit/llvm/config.py:340: note: using clang: /home/milian/projects/build/llvm-project/bin/clang -- Testing: 1 tests, single process -- PASS: Clang :: Index/cxx14-lambdas.cpp (1 of 1) Script: -- : 'RUN: at line 13'; /home/milian/projects/build/llvm-project/bin/c-index-test -test-load-source all -std=c++14 /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp | /home/milian/projects/build/llvm-project/bin/FileCheck -check-prefix=CHECK-LOAD /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp : 'RUN: at line 30'; env CINDEXTEST_INDEXLOCALSYMBOLS=1 /home/milian/projects/build/llvm-project/bin/c-index-test -index-file -std=c++14 /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp | /home/milian/projects/build/llvm-project/bin/FileCheck -check-prefix=CHECK-INDEX /home/milian/projects/src/llvm-project/clang/test/Index/cxx14-lambdas.cpp -- Exit Code: 0 ******************** Testing Time: 0.14s Expected Passes : 1
Comment Actions
Are you sure you have compiled this patch? If I comment out the visit of the InitExpr in CIndex.cpp again, then I get the same failure as you...
Huch, I've indeed somehow missed to compile. Sorry for that. Works fine after compilation :)
LGTM.