[SERVER-79409] Enable bugprone-sizeof-expression clang-tidy check Created: 27/Jul/23  Updated: 27/Aug/23  Resolved: 15/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Alex Neben Assignee: Zack Winter
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Development Platform
Participants:

 Description   

PB: https://spruce.mongodb.com/task/mongodb_mongo_master_amazon_linux2_arm64_compile_clang_tidy_patch_a1732172ed5d66d98582ea1059c0ede9d8cd5065_64c1e98ee3c331bef5124ebc_23_07_27_03_50_56/files?execution=0&sortBy=STATUS&sortDir=ASC



 Comments   
Comment by Zack Winter [ 15/Aug/23 ]

Currently this linter rule has too many false positives. Specifically, it throws a warning on sizeof(pointer) to try to prevent sizeof on aggregate types. Using sizeof this way is valid in many cases. It also throws this warning on generics that call sizeof on pointers, which is very annoying since a new instantiation of a generic may trigger a false positive in the generic itself.

Revisit when we can disable WarnOnSizeOfPointerToAggregate in a future LLVM version.

See https://github.com/10gen/mongo/pull/14772 for more information

Generated at Thu Feb 08 06:40:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.