[PATCH] D150071: [clang-tidy] Fix bugprone-assert-side-effect to actually give warnings

Carlos Galvez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 7 10:12:26 PDT 2023


carlosgalvezp created this revision.
Herald added subscribers: PiotrZSL, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
carlosgalvezp requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Some time ago a patch was merged to disable all clang-tidy warnings
from system macros. This led to bugprone-assert-side-effect
silently no longer working, since the warnings came from a system
macro. The problem was not detected because the fake assert functions
were implemented in the same file as the test, instead of being a
system include like it's done in the real world.

Move the assert to a proper system header, and fix the code to
warn at the correct location.

This patch is breakdown from https://reviews.llvm.org/D147081
by PiotrZSL.

Fixes https://github.com/llvm/llvm-project/issues/62314


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150071

Files:
  clang-tools-extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
  clang-tools-extra/test/clang-tidy/checkers/bugprone/Inputs/assert-side-effect/assert.h
  clang-tools-extra/test/clang-tidy/checkers/bugprone/assert-side-effect.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150071.520194.patch
Type: text/x-patch
Size: 4912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230507/2774415b/attachment-0001.bin>


More information about the cfe-commits mailing list