Lower recursion limit when using asan (#2013)

This commit is contained in:
Paul Fultz II 2019-07-24 02:57:53 -05:00 committed by Daniel Marjamäki
parent 37a345c7d0
commit 4c3191e577
2 changed files with 20 additions and 1 deletions

View File

@ -284,7 +284,12 @@ void CheckLeakAutoVar::checkScope(const Token * const startToken,
std::set<int> notzero,
nonneg int recursiveCount)
{
if (++recursiveCount > 1000) // maximum number of "else if ()"
#if ASAN
static const nonneg int recursiveLimit = 300;
#else
static const nonneg int recursiveLimit = 1000;
#endif
if (++recursiveCount > recursiveLimit) // maximum number of "else if ()"
throw InternalError(startToken, "Internal limit: CheckLeakAutoVar::checkScope() Maximum recursive count of 1000 reached.", InternalError::LIMIT);
std::map<int, VarInfo::AllocInfo> &alloctype = varInfo->alloctype;

View File

@ -72,4 +72,18 @@ inline static int caseInsensitiveStringCompare(const std::string &lhs, const std
#define nonneg
#endif
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define ASAN 1
#endif
#endif
#ifndef ASAN
#ifdef __SANITIZE_ADDRESS__
#define ASAN 1
#else
#define ASAN 0
#endif
#endif
#endif