From: Anna Zaks Date: Fri, 12 Jul 2013 17:58:33 +0000 (+0000) Subject: [analyzer] Treat nullPtrType as a location type. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78c2ec43284537f65bbd95b0628271a140ba0ec4;p=clang [analyzer] Treat nullPtrType as a location type. Fixes PR16584 (radar://14415223). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186172 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h index 326e784e83..5a426ef001 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h @@ -290,7 +290,7 @@ public: static inline bool isLocType(QualType T) { return T->isAnyPointerType() || T->isBlockPointerType() || - T->isReferenceType(); + T->isReferenceType() || T->isNullPtrType(); } private: diff --git a/test/Analysis/nullptr.cpp b/test/Analysis/nullptr.cpp index 050c3f8dc5..56151dc6b6 100644 --- a/test/Analysis/nullptr.cpp +++ b/test/Analysis/nullptr.cpp @@ -81,3 +81,9 @@ int materializeTempExpr() { const S &s = S(*n); // expected-warning{{Dereference of null pointer}} return s.a; } + +typedef decltype(nullptr) nullptr_t; +void testMaterializeTemporaryExprWithNullPtr() { + // Create MaterializeTemporaryExpr with a nullptr inside. + const nullptr_t &r = nullptr; +}