I noticed during the build that GCC would emit a ton of nonnull
warnings.
Example:
/usr/local/google/home/fmzakari/code/github.com/llvm/llvm-project/clang/include/clang/AST/ExternalASTSource.h:378:54: warning: ‘this’ pointer is null [-Wnonnull] 378 | Ptr = reinterpret_cast<uint64_t>((Source->*Get)(Ptr >> 1)); | ~~~~~~~~~~~~~~^~~~~~~~~~
Upon investigation there are actually valid places where we are passing
null as source such as:
return cast_or_null<FriendDecl>(NextFriend.get(nullptr)); if (!Bases.isOffset()) return Bases.get(nullptr);
There is an assertion to catch this but that is only in debug builds.
Added a new if protection branch and kept the assertion to keep the code
change very minimal.