[cfe-commits] [review request] Removing redundant implicit casts in the AST, take 2

Nicola Gigante nicola.gigante at gmail.com
Sun Jan 1 12:10:49 PST 2012


Il giorno 27/dic/2011, alle ore 00:06, Richard Smith ha scritto:
> 
> Take a look at the output of clang -Xclang -ast-dump-xml -S -o -. Testcase:
> 
> typedef unsigned size_t; size_t n = ~size_t(0);
> 
> Before:
> 
>  (CXXFunctionalCastExpr 0x5b08100 <col:38, col:46> 'size_t':'unsigned int'
> functional cast to size_t <NoOp>
>    (ImplicitCastExpr 0x5f7b0e8 <col:45> 'size_t':'unsigned int' <IntegralCast>
> 
> After:
> 
>  (CXXFunctionalCastExpr 0x58ae778 <col:44, col:46> 'size_t':'unsigned int'
> functional cast to size_t <IntegralCast>
> 
> On the one hand, the cast expression is fixed. On the other, the source range
> for this cast is now incorrect. It was:
> 
> typedef unsigned size_t; size_t n = ~size_t(0);
>                                     ~~~~~~~~~
> 
> ... and now is:
> 
> typedef unsigned size_t; size_t n = ~size_t(0);
>                                           ~~~

Ok, this new patch resolve this problem.
Another two failed tests remain, always in the Index area:

FAIL: Clang :: Index/get-cursor.cpp (2194 of 4105)
******************** TEST 'Clang :: Index/get-cursor.cpp' FAILED ********************
Script:
--
c-index-test -cursor-at=/Users/gigabytes/llvm/tools/clang/test/Index/get-cursor.cpp:14:23 /Users/gigabytes/llvm/tools/clang/test/Index/get-cursor.cpp | FileCheck -check-prefix=CHECK-VALUE-REF /Users/gigabytes/llvm/tools/clang/test/Index/get-cursor.cpp
Exit Code: 1
Command Output (stderr):
--
/Users/gigabytes/llvm/tools/clang/test/Index/get-cursor.cpp:55:21: error: expected string not found in input
// CHECK-VALUE-REF: DeclRefExpr=value:10:12
                    ^
<stdin>:1:1: note: scanning from here
CompoundStmt=
^
--

********************
FAIL: Clang :: Index/recursive-cxx-member-calls.cpp (2236 of 4105)
******************** TEST 'Clang :: Index/recursive-cxx-member-calls.cpp' FAILED ********************
Script:
--
c-index-test -test-annotate-tokens=/Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp:1:1:186:1 /Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp 2>&1 | FileCheck -check-prefix=CHECK-tokens /Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp
c-index-test -test-load-source all /Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp 2>&1 | FileCheck /Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp
--
Exit Code: 1
Command Output (stderr):
--
/Users/gigabytes/llvm/tools/clang/test/Index/recursive-cxx-member-calls.cpp:964:18: error: expected string not found in input
// CHECK-tokens: Punctuation: ")" [105:62 - 105:63] CXXFunctionalCastExpr=
                 ^
<stdin>:777:1: note: scanning from here
Punctuation: ")" [105:62 - 105:63] CallExpr=StringSwitch:87:12
^

The first is very strange. If I get the output of c-index-test -test-annotate-tokens, I correctly find the DeclRefExpr=value:10:12 line. If I try the tested command line, at offset 14:23 (which should be 14:21)
the output is CompoundStmt=. There's something I'm missing about how this check works.

Any clue? The point is always the same: I can't understand if my patch breaks something or if the tests have simply to be adapted to the new AST structure.

> 
> - Richard
> 

Thank you,
Nicola

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120101/a3a2bcc4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImplicitCastsRemoval-r147398.patch
Type: application/octet-stream
Size: 51818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120101/a3a2bcc4/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120101/a3a2bcc4/attachment-0001.html>


More information about the cfe-commits mailing list