aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-01 11:36:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-02-01 11:36:24 +0000
commitd947d00aae5712d3bad65084c8703165b89a51d9 (patch)
treea85f0aebda6323f25951bba64272fccba9821150
parent78b86231ff61e09eb8423a49c3db6a5b465175fe (diff)
parentaa54a93c69ee5941d15b3ac9f37cc8ce81bb9452 (diff)
downloadslang-d947d00aae5712d3bad65084c8703165b89a51d9.tar.gz
Merge "Snap for 9550355 from e8c3da7688405059c6988b78d0bda1fb774c2515 to sdk-release" into sdk-releaseplatform-tools-34.0.1platform-tools-34.0.0platform-tools-33.0.4
-rw-r--r--slang_rs_export_type.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/slang_rs_export_type.cpp b/slang_rs_export_type.cpp
index afeb6c5..ffe8ffc 100644
--- a/slang_rs_export_type.cpp
+++ b/slang_rs_export_type.cpp
@@ -333,6 +333,8 @@ static const clang::Type *TypeExportableHelper(
//
// TODO(zonr/srhines): allow bit fields of size 8, 16, 32
if (FD->isBitField()) {
+ // Context can be null from NormalizeType?
+ slangAssert(Context);
Context->ReportError(
FD->getLocation(),
"bit fields are not able to be exported: '%0.%1'")
@@ -415,6 +417,8 @@ static const clang::Type *TypeExportableHelper(
case clang::Type::Enum: {
// FIXME: We currently convert enums to integers, rather than reflecting
// a more complete (and nicer type-safe Java version).
+ // Context can be null from NormalizeType?
+ slangAssert(Context);
return Context->getASTContext().IntTy.getTypePtr();
}
default: {
@@ -797,6 +801,8 @@ llvm::StringRef RSExportType::GetTypeName(const clang::Type* T) {
const clang::PointerType *P = static_cast<const clang::PointerType*>(CTI);
const clang::Type *PT = GetPointeeType(P);
llvm::StringRef PointeeName;
+ // Passing nullptr as Context to NormalizeType can cause TypeExportableHelper
+ // to dereference a null Context?
if (NormalizeType(PT, PointeeName, nullptr, nullptr,
NotLegacyKernelArgument)) {
char *Name = new char[ 1 /* * */ + PointeeName.size() + 1 ];