Skip to content

[clang] Describe builtin templates instead of crashing - #315

Open
Cfretz244 wants to merge 1 commit into
bloomberg:p2996from
Cfretz244:reflect-description-of-builtin-templates
Open

[clang] Describe builtin templates instead of crashing#315
Cfretz244 wants to merge 1 commit into
bloomberg:p2996from
Cfretz244:reflect-description-of-builtin-templates

Conversation

@Cfretz244

Copy link
Copy Markdown

Fixes #311.

DescriptionOf's ReflectionKind::Template switch had no arm for BuiltinTemplateDecl: a metafunction error path describing one (the global namespace enumerates __make_integer_seq et al., reachable from any namespace-scope scan) hit llvm_unreachable("unhandled template kind") while building the diagnostic. Add BuiltinTemplateDecl/TemplateTemplateParmDecl arms and a generic fallback — a description helper feeding diagnostics must degrade, never crash.

Includes a verify-style regression test asserting the clean diagnostic (including the new "a builtin template" wording) on the exact field shape.

Validation (Apple Silicon, Release+assertions, base 837da39):

  • the repro ICEs at pristine base and produces the clean diagnostic with this change (verified both directions by reverting just this file);
  • clang/test/Reflection at parity with base;
  • downstream, this unblocked binding-generation for an entire global-namespace C++ library (Box2D) whose every translation unit previously crashed.

DescriptionOf's ReflectionKind::Template switch had no arm for
BuiltinTemplateDecl: a metafunction error path describing one (the global
namespace enumerates __make_integer_seq et al., reachable from any
namespace-scope scan) hit llvm_unreachable("unhandled template kind")
while BUILDING the diagnostic. Add BuiltinTemplateDecl /
TemplateTemplateParmDecl arms and a generic fallback -- a description
helper feeding diagnostics must degrade, never crash.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant