[clang] ada22c8 - Fix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 12 13:52:19 PST 2020
Author: Simon Pilgrim
Date: 2020-01-12T21:48:00Z
New Revision: ada22c804cd956f3ee7cc9dc82e6d54ead8a4ffe
URL: https://github.com/llvm/llvm-project/commit/ada22c804cd956f3ee7cc9dc82e6d54ead8a4ffe
DIFF: https://github.com/llvm/llvm-project/commit/ada22c804cd956f3ee7cc9dc82e6d54ead8a4ffe.diff
LOG: Fix "pointer is null" static analyzer warning. NFCI.
Added:
Modified:
clang/include/clang/Basic/SourceManager.h
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index ec1b0bcf9897..d87e9ac810fa 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -831,6 +831,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter,
int LoadedID = 0, unsigned LoadedOffset = 0) {
+ assert(SourceFile && "Null source file!");
const SrcMgr::ContentCache *IR =
getOrCreateContentCache(SourceFile, isSystem(FileCharacter));
assert(IR && "getOrCreateContentCache() cannot return NULL");
More information about the cfe-commits
mailing list