1//===-- Regions.def - Metadata about MemRegion kinds ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// The list of regions (MemRegion sub-classes) used in the Static Analyzer.
10// In order to use this information, users of this file must define one or more
11// of the three macros:
12//
13// REGION(Id, Parent) - for specific MemRegion sub-classes, reserving
14// enum value IdKind for their kind.
15//
16// ABSTRACT_REGION(Id, Parent) - for abstract region classes,
17//
18// REGION_RANGE(Id, First, Last) - for ranges of kind-enums,
19// allowing to determine abstract class of a region
20// based on the kind-enum value.
21//
22//===----------------------------------------------------------------------===//
23
24#ifndef REGION
25#define REGION(Id, Parent)
26#endif
27
28#ifndef ABSTRACT_REGION
29#define ABSTRACT_REGION(Id, Parent)
30#endif
31
32#ifndef REGION_RANGE
33#define REGION_RANGE(Id, First, Last)
34#endif
35
36ABSTRACT_REGION(MemSpaceRegion, MemRegion)
37  REGION(CodeSpaceRegion, MemSpaceRegion)
38  ABSTRACT_REGION(GlobalsSpaceRegion, MemSpaceRegion)
39    ABSTRACT_REGION(NonStaticGlobalSpaceRegion, GlobalsSpaceRegion)
40      REGION(GlobalImmutableSpaceRegion, NonStaticGlobalSpaceRegion)
41      REGION(GlobalInternalSpaceRegion, NonStaticGlobalSpaceRegion)
42      REGION(GlobalSystemSpaceRegion, NonStaticGlobalSpaceRegion)
43      REGION_RANGE(NON_STATIC_GLOBAL_MEMSPACES, GlobalImmutableSpaceRegionKind,
44                                                GlobalSystemSpaceRegionKind)
45    REGION(StaticGlobalSpaceRegion, MemSpaceRegion)
46    REGION_RANGE(GLOBAL_MEMSPACES, GlobalImmutableSpaceRegionKind,
47                                   StaticGlobalSpaceRegionKind)
48  REGION(HeapSpaceRegion, MemSpaceRegion)
49  ABSTRACT_REGION(StackSpaceRegion, MemSpaceRegion)
50    REGION(StackArgumentsSpaceRegion, StackSpaceRegion)
51    REGION(StackLocalsSpaceRegion, StackSpaceRegion)
52    REGION_RANGE(STACK_MEMSPACES, StackArgumentsSpaceRegionKind,
53                                  StackLocalsSpaceRegionKind)
54  REGION(UnknownSpaceRegion, MemSpaceRegion)
55  REGION_RANGE(MEMSPACES, CodeSpaceRegionKind,
56                          UnknownSpaceRegionKind)
57ABSTRACT_REGION(SubRegion, MemRegion)
58  REGION(AllocaRegion, SubRegion)
59  REGION(SymbolicRegion, SubRegion)
60  ABSTRACT_REGION(TypedRegion, SubRegion)
61    REGION(BlockDataRegion, TypedRegion)
62    ABSTRACT_REGION(CodeTextRegion, TypedRegion)
63      REGION(BlockCodeRegion, CodeTextRegion)
64      REGION(FunctionCodeRegion, CodeTextRegion)
65      REGION_RANGE(CODE_TEXT_REGIONS, BlockCodeRegionKind,
66                                      FunctionCodeRegionKind)
67    ABSTRACT_REGION(TypedValueRegion, TypedRegion)
68      REGION(CompoundLiteralRegion, TypedValueRegion)
69      REGION(CXXBaseObjectRegion, TypedValueRegion)
70      REGION(CXXDerivedObjectRegion, TypedValueRegion)
71      REGION(CXXTempObjectRegion, TypedValueRegion)
72      REGION(CXXThisRegion, TypedValueRegion)
73      ABSTRACT_REGION(DeclRegion, TypedValueRegion)
74        REGION(FieldRegion, DeclRegion)
75        REGION(ObjCIvarRegion, DeclRegion)
76        REGION(VarRegion, DeclRegion)
77        REGION_RANGE(DECL_REGIONS, FieldRegionKind,
78                                   VarRegionKind)
79      REGION(ElementRegion, TypedValueRegion)
80      REGION(ObjCStringRegion, TypedValueRegion)
81      REGION(StringRegion, TypedValueRegion)
82      REGION_RANGE(TYPED_VALUE_REGIONS, CompoundLiteralRegionKind,
83                                        StringRegionKind)
84    REGION_RANGE(TYPED_REGIONS, BlockDataRegionKind,
85                                StringRegionKind)
86
87#undef REGION_RANGE
88#undef ABSTRACT_REGION
89#undef REGION
90