This is an archive of the discontinued LLVM Phabricator instance.

[libclang] visit c++14 lambda capture init expressions
ClosedPublic

Authored by milianw on Apr 14 2019, 11:58 AM.

Diff Detail

Repository
rC Clang

Event Timeline

milianw created this revision.Apr 14 2019, 11:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2019, 11:58 AM
Herald added a subscriber: arphaman. · View Herald Transcript
nik added a comment.May 8 2019, 6:47 AM

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

@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
nik added a comment.May 21 2019, 1:33 AM

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.

Do you have commit rights? Can you push that for me?

This revision was not accepted when it landed; it landed in state Needs Review.May 21 2019, 2:19 AM
This revision was automatically updated to reflect the committed changes.