Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Static analyzer does not recognize custom allocation or assert macros. #14819

Open Quuxplusone opened 11 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR14819
Status NEW
Importance P enhancement
Reported by li.beinan@gmail.com
Reported on 2013-01-06 15:06:24 -0800
Last modified on 2013-02-22 18:54:28 -0800
Version unspecified
Hardware Macintosh All
CC jrose@belkadan.com, li.beinan@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
We use project-specifc macros for macros such as NEW/DELETE allocators, and
asserts everywhere in our codebase.
However, static analyzer (with Xcode4.x) does not see them as their original
C/C++ runtime library equivalent. So all our valid statements such as null-
checks were ignored and thus lead to false "memory leak" alarms by the static
analyzer.

If this is a missing feature in clang, would it be possible to customize the
analyzer to recognize our macros as valid statements?
Quuxplusone commented 11 years ago

The static analyzer effectively works on preprocessed sources. Your project-specific assertions should be annotated as described in http://clang-analyzer.llvm.org/faq.html#custom_assert.

If you're still seeing issues, please attach a preprocessed file.