karelklic / canal

Abstract interpreter for real-world application programs
https://github.com/karelklic/canal/wiki
Other
32 stars 2 forks source link

Include llvm headers with the same NDEBUG state as during LLVM compile-time #99

Closed karelklic closed 11 years ago

karelklic commented 11 years ago

Including llvm headers without NDEBUG defined and then linking to LLVM dynamic libraries compiled with NDEBU leads to runtime errors that are extremely difficult to analyze. Such a bug recently occurred in tool/CommandInfo.cpp when using CallGraphNode.

Build systems must detect whether NDEBUG was defined in compilation time of LLVM, and define LLVM_WITH_NDEBUG in Config.h accordingly.

All llvm includes must be guarded withh LLVM_INCLUDE_BEGIN and LLVM_INCLUDE_END, which define NDEBUG and undefine it if necessary.