]> granicus.if.org Git - clang/commitdiff
[analyzer] Treat nullPtrType as a location type.
authorAnna Zaks <ganna@apple.com>
Fri, 12 Jul 2013 17:58:33 +0000 (17:58 +0000)
committerAnna Zaks <ganna@apple.com>
Fri, 12 Jul 2013 17:58:33 +0000 (17:58 +0000)
Fixes PR16584 (radar://14415223).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186172 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
test/Analysis/nullptr.cpp

index 326e784e83d489ab9f8441dd9d784cae9a0f980e..5a426ef00197cf47541c18ee6f5ada78c3997129 100644 (file)
@@ -290,7 +290,7 @@ public:
 
   static inline bool isLocType(QualType T) {
     return T->isAnyPointerType() || T->isBlockPointerType() || 
-           T->isReferenceType();
+           T->isReferenceType() || T->isNullPtrType();
   }
 
 private:
index 050c3f8dc56a533aeed0d54e7ec4edc0881db86a..56151dc6b65079afad24492acc8b6e08074dddbe 100644 (file)
@@ -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;
+}