Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp =================================================================== --- lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -1100,6 +1100,14 @@ ->getAs() ->getSuperRegion() ->getAs(); + // At present, custom 'operator new[]' returns a symboic region when + // 'c++-allocator-inlining' sets true. + if (!Region) { + assert(!C.getSourceManager().isInSystemHeader( + NE->getOperatorNew()->getLocStart()) && + "This should be a custom 'operator new[]'"); + return State; + } } else { ElementCount = svalBuilder.makeIntVal(1, true); Region = (State->getSVal(NE, LCtx)).getAsRegion()->getAs(); Index: test/Analysis/NewDelete-custom.cpp =================================================================== --- test/Analysis/NewDelete-custom.cpp +++ test/Analysis/NewDelete-custom.cpp @@ -1,5 +1,6 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,unix.Malloc -std=c++11 -fblocks -verify %s // RUN: %clang_analyze_cc1 -analyzer-checker=core,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,unix.Malloc -std=c++11 -DLEAKS -fblocks -verify %s +// RUN: %clang_analyze_cc1 -analyzer-checker=cplusplus.NewDelete -analyzer-config c++-allocator-inlining=true -std=c++11 -fblocks -verify %s #include "Inputs/system-header-simulator-cxx.h" #ifndef LEAKS