Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,9 @@ ASTContext::findPointerAuthContent(QualType T) const {
if (!RD)
return PointerAuthContent::None;

if (RD->isInvalidDecl())
return PointerAuthContent::None;

if (auto Existing = RecordContainsAddressDiscriminatedPointerAuth.find(RD);
Existing != RecordContainsAddressDiscriminatedPointerAuth.end())
return Existing->second;
Expand Down Expand Up @@ -3517,7 +3520,6 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
uint16_t ASTContext::getPointerAuthTypeDiscriminator(QualType T) {
assert(!T->isDependentType() &&
"cannot compute type discriminator of a dependent type");

SmallString<256> Str;
llvm::raw_svector_ostream Out(Str);

Expand Down
46 changes: 46 additions & 0 deletions clang/test/SemaCXX/ptrauth-nested-incomplete-types.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++26 %s
// RUN: %clang_cc1 -fptrauth-intrinsics -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s
// RUN: %clang_cc1 -fsyntax-only -ferror-limit 1 -verify -std=c++03 %s

Comment on lines +1 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test without -fsyntax-only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have added, is there any difference in behavior between -fsyntax-only and not if there are errors? (i.e. do further passes running prior to the abort)

/// Force two errors so we hit the error limit leading to skip of template instantiation
# "" // expected-error {{invalid preprocessing directive}}
# ""
// expected-error@* {{too many errors emitted}}

template <typename>
struct a {};
struct test_polymorphic {
virtual ~test_polymorphic();
a<int> field;
};
static_assert(__is_trivially_relocatable(test_polymorphic));

struct test_struct {
test_struct(int) {}
void test_instantiate() {
test_struct d(0);
}
void test_type_trait_query() {
__is_trivially_relocatable(test_struct);
}
a<int> e;
};

struct test_struct2 {
test_struct member;
void test() {
test_struct2 t{.member = {0}};
}
};

struct test_subclass : test_struct {
test_subclass() : test_struct(0) {
}

void test_subclass_instantiation() {
test_subclass subclass{};
}
void test_subclass_type_trait_query() {
__is_trivially_relocatable(test_subclass);
}
};