llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.99k stars 11.95k forks source link

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

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 14819
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @belkadan

Extended Description

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?

belkadan 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.

llvmbot commented 11 years ago

assigned to @tkremenek