diff options
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp index 4a50d93..296aec6 100644 --- a/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp @@ -137,6 +137,10 @@ public: // Determine if the pointee and sizeof types are compatible. Here // we ignore constness of pointer types. static bool typesCompatible(ASTContext &C, QualType A, QualType B) { + // sizeof(void*) is compatible with any other pointer. + if (B->isVoidPointerType() && A->getAs<PointerType>()) + return true; + while (true) { A = A.getCanonicalType(); B = B.getCanonicalType(); |