[clang-tools-extra] [include-cleaner] Add handling for new/delete expressions (PR #104033)

via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 16 09:08:26 PDT 2024


zmodem wrote:

We hit a test failure on Windows too: (from https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8739447000055620209/+/u/package_clang/stdout)

Note that `long` is 32 bits on Windows, but this is a 64-bit build, so size_t should be 64 bits.

... and now I see there's fix in 14d57e21e1cc76de554314015e11a9d6e9b797f5, that should work for us too.

```
FAIL: clangIncludeCleaner Unit Tests :: ./ClangIncludeCleanerTests.exe/43/44 (78503 of 81604)
 ******************** TEST 'clangIncludeCleaner Unit Tests :: ./ClangIncludeCleanerTests.exe/43/44' FAILED ********************
 Script(shard):
 --
 GTEST_OUTPUT=json:C:\b\s\w\ir\cache\builder\src\third_party\llvm-build\Release+Asserts\tools\clang\tools\extra\include-cleaner\unittests\.\ClangIncludeCleanerTests.exe-clangIncludeCleaner Unit Tests-9820-43-44.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=44 GTEST_SHARD_INDEX=43 C:\b\s\w\ir\cache\builder\src\third_party\llvm-build\Release+Asserts\tools\clang\tools\extra\include-cleaner\unittests\.\ClangIncludeCleanerTests.exe
 --
 
 Script:
 --
 C:\b\s\w\ir\cache\builder\src\third_party\llvm-build\Release+Asserts\tools\clang\tools\extra\include-cleaner\unittests\.\ClangIncludeCleanerTests.exe --gtest_filter=WalkAST.OperatorNewDelete
 --
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang\lib\Testing\TestAST.cpp(49): error: Failed
 In file included from <built-in>:465:
 .\target.h:1:7: error: 'operator new' takes type size_t ('unsigned long long') as first parameter
     1 | void* operator new(unsigned long, void*);
       |       ^
 
 
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang\lib\Testing\TestAST.cpp(49): error: Failed
 input.mm:1:34: error: no matching 'operator new' function for non-allocating placement new expression; include <new>
     1 | struct Bar { void foo() { Bar b; new (&b) Bar; } };
       |                                  ^   ~~~~
 
 
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang-tools-extra\include-cleaner\unittests\WalkASTTest.cpp(109): error: Failed
 .\target.h:1:7: location not marked used with type explicit
     1 | void* operator new(unsigned long, void*);
       |       ^
 
 from code:
 struct Bar { void foo() { Bar b; ^new (&b) Bar; } };
 
 
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang\lib\Testing\TestAST.cpp:49
 Failed
 In file included from <built-in>:465:
 .\target.h:1:7: error: 'operator new' takes type size_t ('unsigned long long') as first parameter
     1 | void* operator new(unsigned long, void*);
       |       ^
 
 
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang\lib\Testing\TestAST.cpp:49
 Failed
 input.mm:1:34: error: no matching 'operator new' function for non-allocating placement new expression; include <new>
     1 | struct Bar { void foo() { Bar b; new (&b) Bar; } };
       |                                  ^   ~~~~
 
 
 C:\b\s\w\ir\cache\builder\src\third_party\llvm\clang-tools-extra\include-cleaner\unittests\WalkASTTest.cpp:109
 Failed
 .\target.h:1:7: location not marked used with type explicit
     1 | void* operator new(unsigned long, void*);
       |       ^
 
 from code:
 struct Bar { void foo() { Bar b; ^new (&b) Bar; } };
 
 
 
 ********************
 
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
 ********************
 Failed Tests (1):
   clangIncludeCleaner Unit Tests :: ./ClangIncludeCleanerTests.exe/WalkAST/OperatorNewDelete
```

https://github.com/llvm/llvm-project/pull/104033


More information about the cfe-commits mailing list