Add helper methods for GCC analyzer's dynamic_cast support
Introduces helper functions to identify C++ ABI functions and recognized namespaces for improved analyzer accuracy.
This commit enhances the GCC static analyzer by adding helper methods necessary for its new dynamic_cast support. It introduces functions to identify functions within the __cxxabi namespace and helps the analyzer recognize relevant functions, improving its ability to correctly interpret C++ runtime type information and related operations.
In Details
Helper functions is_fndecl_in_toplevel_namespace_p and is_cxxabi_function_p are added to analyzer.cc and common.h. The known_function_manager::get_match is updated to recognize functions within the __cxxabiv1 namespace. These additions are crucial for the analyzer's understanding of C++ runtime library functions, particularly those involved in RTTI and dynamic_cast.
- analyzer
- Refers to the static analysis component of GCC, which detects potential bugs and vulnerabilities in code without executing it.
- __cxxabi
- The C++ Application Binary Interface specification, defining low-level details of C++ name mangling, exception handling, RTTI, and other language features.
- RTTI
- Run-Time Type Information. A C++ feature that allows a program to determine the type of an object at runtime, essential for
dynamic_castandtypeid.