Skip to content

[BoundsSafety][NFC] Introduce LateParsedAttrType AST placeholder type #13000

Description

@rapidsna

Part of: #12758 (T9)
Depends on: #12835 (T8)
Type: Cherry-pick from upstream

Description

Introduce LateParsedAttrType as a new AST type node. This is a transient sugar type that wraps another type and holds an opaque pointer to a LateParsedTypeAttribute. Nothing creates or consumes this type yet — this only registers the type node across all visitors, printers, and serialization stubs.

Cherry-pick from llvm#179612.

Key files

  • TypeBase.h — LateParsedAttrType class definition
  • TypeLoc.h — LateParsedAttrTypeLoc with AttrNameLoc
  • TypeNodes.td — register as NeverCanonical
  • ASTContext.h/cpp — getLateParsedAttrType factory
  • RecursiveASTVisitor.h — traverse stubs
  • TreeTransform.h — TransformLateParsedAttrType
  • TypePrinter.cpp, ASTImporter.cpp, ASTStructuralEquivalence.cpp — desugar/print as wrapped type
  • ItaniumMangle.cpp, CodeGen, Serialization — unreachable/no-op stubs
  • clang/tools/libclang/CIndex.cpp — VisitLateParsedAttrTypeLoc

Why

The new late parsing approach creates LateParsedAttrType placeholders during type construction (processLateTypeAttrs). When late parsing completes, TreeTransform replaces the placeholder with a concrete type (e.g., CountAttributedType).

Validation

All existing lit tests must pass: llvm-lit --filter='counted-by|bounds-safety|sized-by' clang/test and llvm-lit clang/test/BoundsSafety

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

clang:bounds-safetyIssue relating to the experimental -fbounds-safety feature in Clang

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions