[cfe-commits] r132374 - in /cfe/trunk: examples/Tooling/ examples/Tooling/RemoveCStrCalls/ include/clang/Tooling/ lib/Tooling/ test/Tooling/ unittests/ unittests/Tooling/

Eli Friedman eli.friedman at gmail.com
Wed Jun 1 01:04:32 PDT 2011


On Tue, May 31, 2011 at 9:02 PM, Manuel Klimek <klimek at google.com> wrote:
> On Tue, May 31, 2011 at 8:21 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
>> On Tue, May 31, 2011 at 7:49 PM, Manuel Klimek <klimek at google.com> wrote:
>>> Author: klimek
>>> Date: Tue May 31 18:49:32 2011
>>> New Revision: 132374
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=132374&view=rev
>>> Log:
>>> This patch implements an AST matching framework that allows to write
>>> tools that match on the C++ ASTs. The main interface is in ASTMatchers.h,
>>> an example implementation of a tool that removes redundant .c_str() calls
>>> is in the example RemoveCStrCalls.cpp.
>>>
>>> Various contributions:
>>> Zhanyong Wan, Chandler Carruth, Marcin Kowalczyk, Wei Xu, James Dennett.
>>>
>>> Added:
>>>    cfe/trunk/examples/Tooling/RemoveCStrCalls/
>>>    cfe/trunk/examples/Tooling/RemoveCStrCalls/CMakeLists.txt
>>>    cfe/trunk/examples/Tooling/RemoveCStrCalls/RemoveCStrCalls.cpp
>>>    cfe/trunk/examples/Tooling/replace.py   (with props)
>>>    cfe/trunk/include/clang/Tooling/ASTMatchers.h
>>>    cfe/trunk/include/clang/Tooling/VariadicFunction.h
>>>    cfe/trunk/lib/Tooling/ASTMatchers.cpp
>>>    cfe/trunk/test/Tooling/
>>>    cfe/trunk/test/Tooling/remove-cstr-calls.cpp
>>>    cfe/trunk/unittests/Tooling/ASTMatchersTest.cpp
>>> Modified:
>>>    cfe/trunk/examples/Tooling/CMakeLists.txt
>>>    cfe/trunk/include/clang/Tooling/Tooling.h
>>>    cfe/trunk/lib/Tooling/CMakeLists.txt
>>>    cfe/trunk/lib/Tooling/Tooling.cpp
>>>    cfe/trunk/unittests/CMakeLists.txt
>>
>>
>> This is failing on Windows.. any idea?
>> here is the log:
>>
>> 1>  FAIL: Clang-Unit ::
>> ASTMatchersTest/Release/ASTMatchersTestTests.exe/Matcher.OverloadedOperatorCall
>> (3187 of 3248)
>> 1>  ******************** TEST 'Clang-Unit ::
>> ASTMatchersTest/Release/ASTMatchersTestTests.exe/Matcher.OverloadedOperatorCall'
>> FAILED ********************
>> 1>  Note: Google Test filter = Matcher.OverloadedOperatorCall
>> 1>
>> 1>  [==========] Running 1 test from 1 test case.
>> 1>
>> 1>  [----------] Global test environment set-up.
>> 1>
>> 1>  [----------] 1 test from Matcher
>> 1>
>> 1>  [ RUN      ] Matcher.OverloadedOperatorCall
>> 1>
>> 1>Tooling\ASTMatchersTest.cpp(789): error : Value of:
>> NotMatches("class Y { }; " "void *operator new(unsigned long size) {
>> return 0; } " "Y *y = new Y;", OpCall)
>> 1>
>> 1>    Actual: false (Parsing error in "class Y { }; void *operator
>> new(unsigned long size) { return 0; } Y *y = new Y;")
>> 1>
>> 1>  Expected: true
>> 1>
>> 1>  [  FAILED  ] Matcher.OverloadedOperatorCall (12 ms)
>> 1>
>> 1>  [----------] 1 test from Matcher (12 ms total)
>> 1>
>> 1>
>> 1>
>> 1>  [----------] Global test environment tear-down
>> 1>
>> 1>  [==========] 1 test from 1 test case ran. (12 ms total)
>> 1>
>> 1>  [  PASSED  ] 0 tests.
>> 1>
>> 1>  [  FAILED  ] 1 test, listed below:
>> 1>
>> 1>  [  FAILED  ] Matcher.OverloadedOperatorCall
>> 1>
>> 1>
>> 1>
>> 1>   1 FAILED TEST
>> 1>
>> 1>  input.cc:1:20: error: 'operator new' takes type size_t ('unsigned
>> int') as first parameter
>> 1>  class Y { }; void *operator new(unsigned long size) { return 0; }
>> Y *y = new Y;
>> 1>                     ^
>> 1>  1 error generated.
>
> The problem is that we actually need to include stddef.h for size_t if
> we want this test to work on all platforms, so I'm submitting a patch
> that comments out this test and adds a FIXME to resolve once we
> figured out how to find the internal include paths in the test.
>
> Thanks for reporting,
> /Manuel

"__typeof(sizeof(int))" should be equivalent to size_t if you just
want a quick hack...

-Eli




More information about the cfe-commits mailing list