packages feed

glean-0.1.0.0: glean/schema/source/code.cxx.angle

# Copyright (c) Meta Platforms, Inc. and affiliates.

schema code.cxx.4 {
import cxx1

type Entity =
  {
    decl : cxx1.Declaration |
    defn : Definition |
    enumerator : cxx1.Enumerator |
    objcSelectorSlot : ObjcSelectorSlotEntity |
  }

type SymbolId = cxx1.USR

type Definition =
  {
    record_ : cxx1.RecordDefinition |
    function_ : cxx1.FunctionDefinition |
    enum_ : cxx1.EnumDefinition |
    objcMethod : cxx1.ObjcMethodDefinition |
    objcContainer : cxx1.ObjcContainerDefinition |
    variable : cxx1.VariableDeclaration |
    namespace_ : cxx1.NamespaceDefinition |
  }

type ObjcMethodEntity =
  {
    decl : cxx1.ObjcMethodDeclaration |
    defn : cxx1.ObjcMethodDefinition |
  }

type ObjcSelectorSlotEntity =
  {
    objcMethod : ObjcMethodEntity,
    index : nat,
  }

# Map from any declaration to its definition(s), either through its
# DeclFamily or directly from itself.
#
# For 'decl' of type VariableDeclaration this contains only 'def' only with
# VariableKind @GlobalVariable@ with @definition = true@ (from the 'decl' or
# its family). Thus this predicate does not contain any VariableKind of
# {field : Field} or {ivar : ObjcIVar}.
predicate DeclToDef :
  {
    decl : cxx1.Declaration,
    defn : Definition,
  }
  {Decl, Def}
  where
  cxx1.DeclFamilyOf { Decl, FamDecl };
  (
    Decl.record_?;
    FamDecl.record_? = DD;
    Def.record_?.declaration = DD;
  ) | (
    Decl.function_?;
    FamDecl.function_? = DD;
    Def.function_?.declaration = DD;
  ) | (
    Decl.enum_?;
    FamDecl.enum_? = DD;
    Def.enum_?.declaration = DD;
  ) | (
    Decl.objcMethod?;
    FamDecl.objcMethod? = DD;
    Def.objcMethod? = cxx1.ObjcMethodDefinition DD;
  ) | (
    Decl.objcContainer?;
    FamDecl.objcContainer? = DD;
    Def.objcContainer?.declaration = DD;
  ) | (
    Decl.namespace_?;
    FamDecl.namespace_? = DD;
    Def.namespace_?.declaration = DD;
  ) | (
    Decl.variable?;
    FamDecl.variable? = DD;
    Def.variable? = DD;
    DD.kind.global_?.definition = true;
  )

type Annotations =
  {
    attributes: [cxx1.Attribute] |
  }

} # end schema