xref: /freebsd/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/Regions.def (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
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(CXXLifetimeExtendedObjectRegion, TypedValueRegion)
73      REGION(CXXThisRegion, TypedValueRegion)
74      ABSTRACT_REGION(DeclRegion, TypedValueRegion)
75        REGION(FieldRegion, DeclRegion)
76        REGION(ObjCIvarRegion, DeclRegion)
77        ABSTRACT_REGION(VarRegion, DeclRegion)
78          REGION(NonParamVarRegion, VarRegion)
79          REGION(ParamVarRegion, VarRegion)
80        REGION_RANGE(VAR_REGIONS, NonParamVarRegionKind,
81                                  ParamVarRegionKind)
82      REGION_RANGE(DECL_REGIONS, FieldRegionKind,
83                                 ParamVarRegionKind)
84      REGION(ElementRegion, TypedValueRegion)
85      REGION(ObjCStringRegion, TypedValueRegion)
86      REGION(StringRegion, TypedValueRegion)
87      REGION_RANGE(TYPED_VALUE_REGIONS, CompoundLiteralRegionKind,
88                                        StringRegionKind)
89    REGION_RANGE(TYPED_REGIONS, BlockDataRegionKind,
90                                StringRegionKind)
91
92#undef REGION_RANGE
93#undef ABSTRACT_REGION
94#undef REGION
95