1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | #ifndef LLVM_CLANG_AST_ASTCONTEXT_H |
15 | #define LLVM_CLANG_AST_ASTCONTEXT_H |
16 | |
17 | #include "clang/AST/ASTContextAllocate.h" |
18 | #include "clang/AST/ASTTypeTraits.h" |
19 | #include "clang/AST/CanonicalType.h" |
20 | #include "clang/AST/CommentCommandTraits.h" |
21 | #include "clang/AST/ComparisonCategories.h" |
22 | #include "clang/AST/Decl.h" |
23 | #include "clang/AST/DeclBase.h" |
24 | #include "clang/AST/DeclarationName.h" |
25 | #include "clang/AST/Expr.h" |
26 | #include "clang/AST/ExternalASTSource.h" |
27 | #include "clang/AST/NestedNameSpecifier.h" |
28 | #include "clang/AST/PrettyPrinter.h" |
29 | #include "clang/AST/RawCommentList.h" |
30 | #include "clang/AST/TemplateBase.h" |
31 | #include "clang/AST/TemplateName.h" |
32 | #include "clang/AST/Type.h" |
33 | #include "clang/Basic/AddressSpaces.h" |
34 | #include "clang/Basic/AttrKinds.h" |
35 | #include "clang/Basic/IdentifierTable.h" |
36 | #include "clang/Basic/LLVM.h" |
37 | #include "clang/Basic/LangOptions.h" |
38 | #include "clang/Basic/Linkage.h" |
39 | #include "clang/Basic/OperatorKinds.h" |
40 | #include "clang/Basic/PartialDiagnostic.h" |
41 | #include "clang/Basic/SanitizerBlacklist.h" |
42 | #include "clang/Basic/SourceLocation.h" |
43 | #include "clang/Basic/Specifiers.h" |
44 | #include "clang/Basic/TargetInfo.h" |
45 | #include "clang/Basic/XRayLists.h" |
46 | #include "llvm/ADT/APSInt.h" |
47 | #include "llvm/ADT/ArrayRef.h" |
48 | #include "llvm/ADT/DenseMap.h" |
49 | #include "llvm/ADT/FoldingSet.h" |
50 | #include "llvm/ADT/IntrusiveRefCntPtr.h" |
51 | #include "llvm/ADT/MapVector.h" |
52 | #include "llvm/ADT/None.h" |
53 | #include "llvm/ADT/Optional.h" |
54 | #include "llvm/ADT/PointerIntPair.h" |
55 | #include "llvm/ADT/PointerUnion.h" |
56 | #include "llvm/ADT/SmallVector.h" |
57 | #include "llvm/ADT/StringMap.h" |
58 | #include "llvm/ADT/StringRef.h" |
59 | #include "llvm/ADT/TinyPtrVector.h" |
60 | #include "llvm/ADT/Triple.h" |
61 | #include "llvm/ADT/iterator_range.h" |
62 | #include "llvm/Support/AlignOf.h" |
63 | #include "llvm/Support/Allocator.h" |
64 | #include "llvm/Support/Casting.h" |
65 | #include "llvm/Support/Compiler.h" |
66 | #include <cassert> |
67 | #include <cstddef> |
68 | #include <cstdint> |
69 | #include <iterator> |
70 | #include <memory> |
71 | #include <string> |
72 | #include <type_traits> |
73 | #include <utility> |
74 | #include <vector> |
75 | |
76 | namespace llvm { |
77 | |
78 | struct fltSemantics; |
79 | |
80 | } |
81 | |
82 | namespace clang { |
83 | |
84 | class APFixedPoint; |
85 | class APValue; |
86 | class ASTMutationListener; |
87 | class ASTRecordLayout; |
88 | class AtomicExpr; |
89 | class BlockExpr; |
90 | class BuiltinTemplateDecl; |
91 | class CharUnits; |
92 | class CXXABI; |
93 | class CXXConstructorDecl; |
94 | class CXXMethodDecl; |
95 | class CXXRecordDecl; |
96 | class DiagnosticsEngine; |
97 | class Expr; |
98 | class FixedPointSemantics; |
99 | class MangleContext; |
100 | class MangleNumberingContext; |
101 | class MaterializeTemporaryExpr; |
102 | class MemberSpecializationInfo; |
103 | class Module; |
104 | class ObjCCategoryDecl; |
105 | class ObjCCategoryImplDecl; |
106 | class ObjCContainerDecl; |
107 | class ObjCImplDecl; |
108 | class ObjCImplementationDecl; |
109 | class ObjCInterfaceDecl; |
110 | class ObjCIvarDecl; |
111 | class ObjCMethodDecl; |
112 | class ObjCPropertyDecl; |
113 | class ObjCPropertyImplDecl; |
114 | class ObjCProtocolDecl; |
115 | class ObjCTypeParamDecl; |
116 | class Preprocessor; |
117 | class Stmt; |
118 | class StoredDeclsMap; |
119 | class TemplateDecl; |
120 | class TemplateParameterList; |
121 | class TemplateTemplateParmDecl; |
122 | class TemplateTypeParmDecl; |
123 | class UnresolvedSetIterator; |
124 | class UsingShadowDecl; |
125 | class VarTemplateDecl; |
126 | class VTableContextBase; |
127 | |
128 | namespace Builtin { |
129 | |
130 | class Context; |
131 | |
132 | } |
133 | |
134 | enum BuiltinTemplateKind : int; |
135 | |
136 | namespace comments { |
137 | |
138 | class ; |
139 | |
140 | } |
141 | |
142 | struct TypeInfo { |
143 | uint64_t Width = 0; |
144 | unsigned Align = 0; |
145 | bool AlignIsRequired : 1; |
146 | |
147 | TypeInfo() : AlignIsRequired(false) {} |
148 | TypeInfo(uint64_t Width, unsigned Align, bool AlignIsRequired) |
149 | : Width(Width), Align(Align), AlignIsRequired(AlignIsRequired) {} |
150 | }; |
151 | |
152 | |
153 | |
154 | class ASTContext : public RefCountedBase<ASTContext> { |
155 | public: |
156 | |
157 | |
158 | struct BlockVarCopyInit { |
159 | BlockVarCopyInit() = default; |
160 | BlockVarCopyInit(Expr *CopyExpr, bool CanThrow) |
161 | : ExprAndFlag(CopyExpr, CanThrow) {} |
162 | void setExprAndFlag(Expr *CopyExpr, bool CanThrow) { |
163 | ExprAndFlag.setPointerAndInt(CopyExpr, CanThrow); |
164 | } |
165 | Expr *getCopyExpr() const { return ExprAndFlag.getPointer(); } |
166 | bool canThrow() const { return ExprAndFlag.getInt(); } |
167 | llvm::PointerIntPair<Expr *, 1, bool> ExprAndFlag; |
168 | }; |
169 | |
170 | private: |
171 | friend class NestedNameSpecifier; |
172 | |
173 | mutable SmallVector<Type *, 0> Types; |
174 | mutable llvm::FoldingSet<ExtQuals> ExtQualNodes; |
175 | mutable llvm::FoldingSet<ComplexType> ComplexTypes; |
176 | mutable llvm::FoldingSet<PointerType> PointerTypes; |
177 | mutable llvm::FoldingSet<AdjustedType> AdjustedTypes; |
178 | mutable llvm::FoldingSet<BlockPointerType> BlockPointerTypes; |
179 | mutable llvm::FoldingSet<LValueReferenceType> LValueReferenceTypes; |
180 | mutable llvm::FoldingSet<RValueReferenceType> RValueReferenceTypes; |
181 | mutable llvm::FoldingSet<MemberPointerType> MemberPointerTypes; |
182 | mutable llvm::FoldingSet<ConstantArrayType> ConstantArrayTypes; |
183 | mutable llvm::FoldingSet<IncompleteArrayType> IncompleteArrayTypes; |
184 | mutable std::vector<VariableArrayType*> VariableArrayTypes; |
185 | mutable llvm::FoldingSet<DependentSizedArrayType> DependentSizedArrayTypes; |
186 | mutable llvm::FoldingSet<DependentSizedExtVectorType> |
187 | DependentSizedExtVectorTypes; |
188 | mutable llvm::FoldingSet<DependentAddressSpaceType> |
189 | DependentAddressSpaceTypes; |
190 | mutable llvm::FoldingSet<VectorType> VectorTypes; |
191 | mutable llvm::FoldingSet<DependentVectorType> DependentVectorTypes; |
192 | mutable llvm::FoldingSet<FunctionNoProtoType> FunctionNoProtoTypes; |
193 | mutable llvm::ContextualFoldingSet<FunctionProtoType, ASTContext&> |
194 | FunctionProtoTypes; |
195 | mutable llvm::FoldingSet<DependentTypeOfExprType> DependentTypeOfExprTypes; |
196 | mutable llvm::FoldingSet<DependentDecltypeType> DependentDecltypeTypes; |
197 | mutable llvm::FoldingSet<TemplateTypeParmType> TemplateTypeParmTypes; |
198 | mutable llvm::FoldingSet<ObjCTypeParamType> ObjCTypeParamTypes; |
199 | mutable llvm::FoldingSet<SubstTemplateTypeParmType> |
200 | SubstTemplateTypeParmTypes; |
201 | mutable llvm::FoldingSet<SubstTemplateTypeParmPackType> |
202 | SubstTemplateTypeParmPackTypes; |
203 | mutable llvm::ContextualFoldingSet<TemplateSpecializationType, ASTContext&> |
204 | TemplateSpecializationTypes; |
205 | mutable llvm::FoldingSet<ParenType> ParenTypes; |
206 | mutable llvm::FoldingSet<ElaboratedType> ElaboratedTypes; |
207 | mutable llvm::FoldingSet<DependentNameType> DependentNameTypes; |
208 | mutable llvm::ContextualFoldingSet<DependentTemplateSpecializationType, |
209 | ASTContext&> |
210 | DependentTemplateSpecializationTypes; |
211 | llvm::FoldingSet<PackExpansionType> PackExpansionTypes; |
212 | mutable llvm::FoldingSet<ObjCObjectTypeImpl> ObjCObjectTypes; |
213 | mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes; |
214 | mutable llvm::FoldingSet<DependentUnaryTransformType> |
215 | DependentUnaryTransformTypes; |
216 | mutable llvm::FoldingSet<AutoType> AutoTypes; |
217 | mutable llvm::FoldingSet<DeducedTemplateSpecializationType> |
218 | DeducedTemplateSpecializationTypes; |
219 | mutable llvm::FoldingSet<AtomicType> AtomicTypes; |
220 | llvm::FoldingSet<AttributedType> AttributedTypes; |
221 | mutable llvm::FoldingSet<PipeType> PipeTypes; |
222 | |
223 | mutable llvm::FoldingSet<QualifiedTemplateName> QualifiedTemplateNames; |
224 | mutable llvm::FoldingSet<DependentTemplateName> DependentTemplateNames; |
225 | mutable llvm::FoldingSet<SubstTemplateTemplateParmStorage> |
226 | SubstTemplateTemplateParms; |
227 | mutable llvm::ContextualFoldingSet<SubstTemplateTemplateParmPackStorage, |
228 | ASTContext&> |
229 | SubstTemplateTemplateParmPacks; |
230 | |
231 | |
232 | |
233 | |
234 | mutable llvm::FoldingSet<NestedNameSpecifier> NestedNameSpecifiers; |
235 | mutable NestedNameSpecifier *GlobalNestedNameSpecifier = nullptr; |
236 | |
237 | |
238 | |
239 | |
240 | mutable llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*> |
241 | ASTRecordLayouts; |
242 | mutable llvm::DenseMap<const ObjCContainerDecl*, const ASTRecordLayout*> |
243 | ObjCLayouts; |
244 | |
245 | |
246 | using TypeInfoMap = llvm::DenseMap<const Type *, struct TypeInfo>; |
247 | mutable TypeInfoMap MemoizedTypeInfo; |
248 | |
249 | |
250 | |
251 | |
252 | using UnadjustedAlignMap = llvm::DenseMap<const Type *, unsigned>; |
253 | mutable UnadjustedAlignMap MemoizedUnadjustedAlign; |
254 | |
255 | |
256 | llvm::DenseMap<const CXXRecordDecl*, LazyDeclPtr> KeyFunctions; |
257 | |
258 | |
259 | llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*> ObjCImpls; |
260 | |
261 | |
262 | |
263 | llvm::DenseMap<const ObjCMethodDecl*,const ObjCMethodDecl*> ObjCMethodRedecls; |
264 | |
265 | |
266 | llvm::DenseMap<const VarDecl *, BlockVarCopyInit> BlockVarCopyInits; |
267 | |
268 | |
269 | |
270 | llvm::DenseMap<const FunctionDecl*, FunctionDecl*> |
271 | ClassScopeSpecializationPattern; |
272 | |
273 | |
274 | |
275 | |
276 | llvm::DenseMap<const MaterializeTemporaryExpr *, APValue *> |
277 | MaterializedTemporaryValues; |
278 | |
279 | |
280 | |
281 | class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode { |
282 | TemplateTemplateParmDecl *Parm; |
283 | |
284 | public: |
285 | CanonicalTemplateTemplateParm(TemplateTemplateParmDecl *Parm) |
286 | : Parm(Parm) {} |
287 | |
288 | TemplateTemplateParmDecl *getParam() const { return Parm; } |
289 | |
290 | void Profile(llvm::FoldingSetNodeID &ID) { Profile(ID, Parm); } |
291 | |
292 | static void Profile(llvm::FoldingSetNodeID &ID, |
293 | TemplateTemplateParmDecl *Parm); |
294 | }; |
295 | mutable llvm::FoldingSet<CanonicalTemplateTemplateParm> |
296 | CanonTemplateTemplateParms; |
297 | |
298 | TemplateTemplateParmDecl * |
299 | getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const; |
300 | |
301 | |
302 | mutable TypedefDecl *Int128Decl = nullptr; |
303 | |
304 | |
305 | mutable TypedefDecl *UInt128Decl = nullptr; |
306 | |
307 | |
308 | |
309 | mutable TypedefDecl *BuiltinVaListDecl = nullptr; |
310 | |
311 | |
312 | mutable TypedefDecl *BuiltinMSVaListDecl = nullptr; |
313 | |
314 | |
315 | mutable TypedefDecl *ObjCIdDecl = nullptr; |
316 | |
317 | |
318 | mutable TypedefDecl *ObjCSelDecl = nullptr; |
319 | |
320 | |
321 | mutable TypedefDecl *ObjCClassDecl = nullptr; |
322 | |
323 | |
324 | mutable ObjCInterfaceDecl *ObjCProtocolClassDecl = nullptr; |
325 | |
326 | |
327 | mutable TypedefDecl *BOOLDecl = nullptr; |
328 | |
329 | |
330 | |
331 | QualType ObjCIdRedefinitionType; |
332 | QualType ObjCClassRedefinitionType; |
333 | QualType ObjCSelRedefinitionType; |
334 | |
335 | |
336 | mutable IdentifierInfo *BoolName = nullptr; |
337 | |
338 | |
339 | mutable IdentifierInfo *NSObjectName = nullptr; |
340 | |
341 | |
342 | IdentifierInfo *NSCopyingName = nullptr; |
343 | |
344 | |
345 | mutable IdentifierInfo *MakeIntegerSeqName = nullptr; |
346 | |
347 | |
348 | mutable IdentifierInfo *TypePackElementName = nullptr; |
349 | |
350 | QualType ObjCConstantStringType; |
351 | mutable RecordDecl *CFConstantStringTagDecl = nullptr; |
352 | mutable TypedefDecl *CFConstantStringTypeDecl = nullptr; |
353 | |
354 | mutable QualType ObjCSuperType; |
355 | |
356 | QualType ObjCNSStringType; |
357 | |
358 | |
359 | TypedefDecl *ObjCInstanceTypeDecl = nullptr; |
360 | |
361 | |
362 | TypeDecl *FILEDecl = nullptr; |
363 | |
364 | |
365 | TypeDecl *jmp_bufDecl = nullptr; |
366 | |
367 | |
368 | TypeDecl *sigjmp_bufDecl = nullptr; |
369 | |
370 | |
371 | TypeDecl *ucontext_tDecl = nullptr; |
372 | |
373 | |
374 | |
375 | |
376 | |
377 | mutable RecordDecl *BlockDescriptorType = nullptr; |
378 | |
379 | |
380 | |
381 | |
382 | |
383 | mutable RecordDecl *BlockDescriptorExtendedType = nullptr; |
384 | |
385 | |
386 | FunctionDecl *cudaConfigureCallDecl = nullptr; |
387 | |
388 | |
389 | |
390 | |
391 | |
392 | llvm::DenseMap<const Decl*, AttrVec*> DeclAttrs; |
393 | |
394 | |
395 | |
396 | |
397 | llvm::DenseMap<Decl*, Decl*> MergedDecls; |
398 | |
399 | |
400 | |
401 | |
402 | llvm::DenseMap<NamedDecl*, llvm::TinyPtrVector<Module*>> MergedDefModules; |
403 | |
404 | |
405 | |
406 | |
407 | |
408 | struct PerModuleInitializers { |
409 | llvm::SmallVector<Decl*, 4> Initializers; |
410 | llvm::SmallVector<uint32_t, 4> LazyInitializers; |
411 | |
412 | void resolve(ASTContext &Ctx); |
413 | }; |
414 | llvm::DenseMap<Module*, PerModuleInitializers*> ModuleInitializers; |
415 | |
416 | ASTContext &this_() { return *this; } |
417 | |
418 | public: |
419 | |
420 | using TemplateOrSpecializationInfo = |
421 | llvm::PointerUnion<VarTemplateDecl *, MemberSpecializationInfo *>; |
422 | |
423 | private: |
424 | friend class ASTDeclReader; |
425 | friend class ASTReader; |
426 | friend class ASTWriter; |
427 | friend class CXXRecordDecl; |
428 | |
429 | |
430 | |
431 | |
432 | |
433 | |
434 | |
435 | |
436 | |
437 | |
438 | |
439 | |
440 | |
441 | |
442 | |
443 | |
444 | |
445 | |
446 | |
447 | |
448 | |
449 | |
450 | |
451 | |
452 | |
453 | |
454 | |
455 | |
456 | |
457 | |
458 | |
459 | llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo> |
460 | TemplateOrInstantiation; |
461 | |
462 | |
463 | |
464 | |
465 | |
466 | |
467 | |
468 | |
469 | |
470 | |
471 | |
472 | |
473 | |
474 | |
475 | |
476 | |
477 | |
478 | |
479 | |
480 | |
481 | |
482 | |
483 | |
484 | |
485 | llvm::DenseMap<NamedDecl *, NamedDecl *> InstantiatedFromUsingDecl; |
486 | |
487 | llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*> |
488 | InstantiatedFromUsingShadowDecl; |
489 | |
490 | llvm::DenseMap<FieldDecl *, FieldDecl *> InstantiatedFromUnnamedFieldDecl; |
491 | |
492 | |
493 | |
494 | |
495 | |
496 | |
497 | |
498 | using CXXMethodVector = llvm::TinyPtrVector<const CXXMethodDecl *>; |
499 | llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector> OverriddenMethods; |
500 | |
501 | |
502 | |
503 | |
504 | llvm::DenseMap<const DeclContext *, std::unique_ptr<MangleNumberingContext>> |
505 | MangleNumberingContexts; |
506 | |
507 | |
508 | |
509 | llvm::MapVector<const NamedDecl *, unsigned> MangleNumbers; |
510 | llvm::MapVector<const VarDecl *, unsigned> StaticLocalNumbers; |
511 | |
512 | |
513 | |
514 | using ParameterIndexTable = llvm::DenseMap<const VarDecl *, unsigned>; |
515 | ParameterIndexTable ParamIndices; |
516 | |
517 | ImportDecl *FirstLocalImport = nullptr; |
518 | ImportDecl *LastLocalImport = nullptr; |
519 | |
520 | TranslationUnitDecl *TUDecl; |
521 | mutable ExternCContextDecl *ExternCContext = nullptr; |
522 | mutable BuiltinTemplateDecl *MakeIntegerSeqDecl = nullptr; |
523 | mutable BuiltinTemplateDecl *TypePackElementDecl = nullptr; |
524 | |
525 | |
526 | SourceManager &SourceMgr; |
527 | |
528 | |
529 | |
530 | LangOptions &LangOpts; |
531 | |
532 | |
533 | |
534 | std::unique_ptr<SanitizerBlacklist> SanitizerBL; |
535 | |
536 | |
537 | |
538 | std::unique_ptr<XRayFunctionFilter> XRayFilter; |
539 | |
540 | |
541 | |
542 | |
543 | |
544 | mutable llvm::BumpPtrAllocator BumpAlloc; |
545 | |
546 | |
547 | PartialDiagnostic::StorageAllocator DiagAllocator; |
548 | |
549 | |
550 | std::unique_ptr<CXXABI> ABI; |
551 | CXXABI *createCXXABI(const TargetInfo &T); |
552 | |
553 | |
554 | const LangASMap *AddrSpaceMap = nullptr; |
555 | |
556 | |
557 | |
558 | bool AddrSpaceMapMangling; |
559 | |
560 | const TargetInfo *Target = nullptr; |
561 | const TargetInfo *AuxTarget = nullptr; |
562 | clang::PrintingPolicy PrintingPolicy; |
563 | |
564 | public: |
565 | IdentifierTable &Idents; |
566 | SelectorTable &Selectors; |
567 | Builtin::Context &BuiltinInfo; |
568 | mutable DeclarationNameTable DeclarationNames; |
569 | IntrusiveRefCntPtr<ExternalASTSource> ExternalSource; |
570 | ASTMutationListener *Listener = nullptr; |
571 | |
572 | |
573 | |
574 | class DynTypedNodeList { |
575 | using DynTypedNode = ast_type_traits::DynTypedNode; |
576 | |
577 | llvm::AlignedCharArrayUnion<ast_type_traits::DynTypedNode, |
578 | ArrayRef<DynTypedNode>> Storage; |
579 | bool IsSingleNode; |
580 | |
581 | public: |
582 | DynTypedNodeList(const DynTypedNode &N) : IsSingleNode(true) { |
583 | new (Storage.buffer) DynTypedNode(N); |
584 | } |
585 | |
586 | DynTypedNodeList(ArrayRef<DynTypedNode> A) : IsSingleNode(false) { |
587 | new (Storage.buffer) ArrayRef<DynTypedNode>(A); |
588 | } |
589 | |
590 | const ast_type_traits::DynTypedNode *begin() const { |
591 | if (!IsSingleNode) |
592 | return reinterpret_cast<const ArrayRef<DynTypedNode> *>(Storage.buffer) |
593 | ->begin(); |
594 | return reinterpret_cast<const DynTypedNode *>(Storage.buffer); |
595 | } |
596 | |
597 | const ast_type_traits::DynTypedNode *end() const { |
598 | if (!IsSingleNode) |
599 | return reinterpret_cast<const ArrayRef<DynTypedNode> *>(Storage.buffer) |
600 | ->end(); |
601 | return reinterpret_cast<const DynTypedNode *>(Storage.buffer) + 1; |
602 | } |
603 | |
604 | size_t size() const { return end() - begin(); } |
605 | bool empty() const { return begin() == end(); } |
606 | |
607 | const DynTypedNode &operator[](size_t N) const { |
608 | (0) . __assert_fail ("N < size() && \"Out of bounds!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 608, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(N < size() && "Out of bounds!"); |
609 | return *(begin() + N); |
610 | } |
611 | }; |
612 | |
613 | |
614 | |
615 | |
616 | |
617 | |
618 | |
619 | |
620 | std::vector<Decl *> getTraversalScope() const { return TraversalScope; } |
621 | void setTraversalScope(const std::vector<Decl *> &); |
622 | |
623 | |
624 | |
625 | |
626 | |
627 | |
628 | |
629 | |
630 | |
631 | |
632 | |
633 | |
634 | |
635 | |
636 | |
637 | |
638 | |
639 | |
640 | |
641 | |
642 | |
643 | |
644 | |
645 | |
646 | |
647 | template <typename NodeT> DynTypedNodeList getParents(const NodeT &Node) { |
648 | return getParents(ast_type_traits::DynTypedNode::create(Node)); |
649 | } |
650 | |
651 | DynTypedNodeList getParents(const ast_type_traits::DynTypedNode &Node); |
652 | |
653 | const clang::PrintingPolicy &getPrintingPolicy() const { |
654 | return PrintingPolicy; |
655 | } |
656 | |
657 | void setPrintingPolicy(const clang::PrintingPolicy &Policy) { |
658 | PrintingPolicy = Policy; |
659 | } |
660 | |
661 | SourceManager& getSourceManager() { return SourceMgr; } |
662 | const SourceManager& getSourceManager() const { return SourceMgr; } |
663 | |
664 | llvm::BumpPtrAllocator &getAllocator() const { |
665 | return BumpAlloc; |
666 | } |
667 | |
668 | void *Allocate(size_t Size, unsigned Align = 8) const { |
669 | return BumpAlloc.Allocate(Size, Align); |
670 | } |
671 | template <typename T> T *Allocate(size_t Num = 1) const { |
672 | return static_cast<T *>(Allocate(Num * sizeof(T), alignof(T))); |
673 | } |
674 | void Deallocate(void *Ptr) const {} |
675 | |
676 | |
677 | |
678 | size_t getASTAllocatedMemory() const { |
679 | return BumpAlloc.getTotalMemory(); |
680 | } |
681 | |
682 | |
683 | size_t getSideTableAllocatedMemory() const; |
684 | |
685 | PartialDiagnostic::StorageAllocator &getDiagAllocator() { |
686 | return DiagAllocator; |
687 | } |
688 | |
689 | const TargetInfo &getTargetInfo() const { return *Target; } |
690 | const TargetInfo *getAuxTargetInfo() const { return AuxTarget; } |
691 | |
692 | |
693 | |
694 | |
695 | |
696 | QualType getIntTypeForBitwidth(unsigned DestWidth, |
697 | unsigned Signed) const; |
698 | |
699 | |
700 | |
701 | |
702 | QualType getRealTypeForBitwidth(unsigned DestWidth) const; |
703 | |
704 | bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const; |
705 | |
706 | const LangOptions& getLangOpts() const { return LangOpts; } |
707 | |
708 | const SanitizerBlacklist &getSanitizerBlacklist() const { |
709 | return *SanitizerBL; |
710 | } |
711 | |
712 | const XRayFunctionFilter &getXRayFilter() const { |
713 | return *XRayFilter; |
714 | } |
715 | |
716 | DiagnosticsEngine &getDiagnostics() const; |
717 | |
718 | FullSourceLoc getFullLoc(SourceLocation Loc) const { |
719 | return FullSourceLoc(Loc,SourceMgr); |
720 | } |
721 | |
722 | |
723 | RawCommentList ; |
724 | |
725 | |
726 | mutable bool = false; |
727 | |
728 | class RawCommentAndCacheFlags { |
729 | public: |
730 | enum Kind { |
731 | |
732 | |
733 | |
734 | |
735 | NoCommentInDecl = 0, |
736 | |
737 | |
738 | |
739 | |
740 | FromDecl, |
741 | |
742 | |
743 | |
744 | |
745 | |
746 | |
747 | |
748 | |
749 | |
750 | FromRedecl |
751 | }; |
752 | |
753 | Kind getKind() const LLVM_READONLY { |
754 | return Data.getInt(); |
755 | } |
756 | |
757 | void setKind(Kind K) { |
758 | Data.setInt(K); |
759 | } |
760 | |
761 | const RawComment *getRaw() const LLVM_READONLY { |
762 | return Data.getPointer(); |
763 | } |
764 | |
765 | void setRaw(const RawComment *RC) { |
766 | Data.setPointer(RC); |
767 | } |
768 | |
769 | const Decl *getOriginalDecl() const LLVM_READONLY { |
770 | return OriginalDecl; |
771 | } |
772 | |
773 | void setOriginalDecl(const Decl *Orig) { |
774 | OriginalDecl = Orig; |
775 | } |
776 | |
777 | private: |
778 | llvm::PointerIntPair<const RawComment *, 2, Kind> Data; |
779 | const Decl *OriginalDecl; |
780 | }; |
781 | |
782 | |
783 | |
784 | |
785 | |
786 | |
787 | mutable llvm::DenseMap<const Decl *, RawCommentAndCacheFlags> ; |
788 | |
789 | |
790 | |
791 | mutable llvm::DenseMap<const Decl *, comments::FullComment *> ; |
792 | |
793 | |
794 | |
795 | RawComment *(const Decl *D) const; |
796 | |
797 | public: |
798 | RawCommentList &() { |
799 | return Comments; |
800 | } |
801 | |
802 | void (const RawComment &RC) { |
803 | assert(LangOpts.RetainCommentsFromSystemHeaders || |
804 | !SourceMgr.isInSystemHeader(RC.getSourceRange().getBegin())); |
805 | Comments.addComment(RC, LangOpts.CommentOpts, BumpAlloc); |
806 | } |
807 | |
808 | |
809 | |
810 | |
811 | |
812 | |
813 | const RawComment * |
814 | (const Decl *D, |
815 | const Decl **OriginalDecl = nullptr) const; |
816 | |
817 | |
818 | |
819 | |
820 | |
821 | |
822 | comments::FullComment *(const Decl *D, |
823 | const Preprocessor *PP) const; |
824 | |
825 | |
826 | |
827 | |
828 | comments::FullComment *(const Decl *D) const; |
829 | |
830 | comments::FullComment *(comments::FullComment *FC, |
831 | const Decl *D) const; |
832 | |
833 | private: |
834 | mutable comments::CommandTraits CommentCommandTraits; |
835 | |
836 | |
837 | class import_iterator { |
838 | ImportDecl *Import = nullptr; |
839 | |
840 | public: |
841 | using value_type = ImportDecl *; |
842 | using reference = ImportDecl *; |
843 | using pointer = ImportDecl *; |
844 | using difference_type = int; |
845 | using iterator_category = std::forward_iterator_tag; |
846 | |
847 | import_iterator() = default; |
848 | explicit import_iterator(ImportDecl *Import) : Import(Import) {} |
849 | |
850 | reference operator*() const { return Import; } |
851 | pointer operator->() const { return Import; } |
852 | |
853 | import_iterator &operator++() { |
854 | Import = ASTContext::getNextLocalImport(Import); |
855 | return *this; |
856 | } |
857 | |
858 | import_iterator operator++(int) { |
859 | import_iterator Other(*this); |
860 | ++(*this); |
861 | return Other; |
862 | } |
863 | |
864 | friend bool operator==(import_iterator X, import_iterator Y) { |
865 | return X.Import == Y.Import; |
866 | } |
867 | |
868 | friend bool operator!=(import_iterator X, import_iterator Y) { |
869 | return X.Import != Y.Import; |
870 | } |
871 | }; |
872 | |
873 | public: |
874 | comments::CommandTraits &getCommentCommandTraits() const { |
875 | return CommentCommandTraits; |
876 | } |
877 | |
878 | |
879 | AttrVec& getDeclAttrs(const Decl *D); |
880 | |
881 | |
882 | void eraseDeclAttrs(const Decl *D); |
883 | |
884 | |
885 | |
886 | |
887 | |
888 | MemberSpecializationInfo *getInstantiatedFromStaticDataMember( |
889 | const VarDecl *Var); |
890 | |
891 | TemplateOrSpecializationInfo |
892 | getTemplateOrSpecializationInfo(const VarDecl *Var); |
893 | |
894 | FunctionDecl *getClassScopeSpecializationPattern(const FunctionDecl *FD); |
895 | |
896 | void setClassScopeSpecializationPattern(FunctionDecl *FD, |
897 | FunctionDecl *Pattern); |
898 | |
899 | |
900 | |
901 | void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, |
902 | TemplateSpecializationKind TSK, |
903 | SourceLocation PointOfInstantiation = SourceLocation()); |
904 | |
905 | void setTemplateOrSpecializationInfo(VarDecl *Inst, |
906 | TemplateOrSpecializationInfo TSI); |
907 | |
908 | |
909 | |
910 | |
911 | NamedDecl *getInstantiatedFromUsingDecl(NamedDecl *Inst); |
912 | |
913 | |
914 | |
915 | void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern); |
916 | |
917 | void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, |
918 | UsingShadowDecl *Pattern); |
919 | UsingShadowDecl *getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst); |
920 | |
921 | FieldDecl *getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field); |
922 | |
923 | void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl); |
924 | |
925 | |
926 | using overridden_cxx_method_iterator = CXXMethodVector::const_iterator; |
927 | overridden_cxx_method_iterator |
928 | overridden_methods_begin(const CXXMethodDecl *Method) const; |
929 | |
930 | overridden_cxx_method_iterator |
931 | overridden_methods_end(const CXXMethodDecl *Method) const; |
932 | |
933 | unsigned overridden_methods_size(const CXXMethodDecl *Method) const; |
934 | |
935 | using overridden_method_range = |
936 | llvm::iterator_range<overridden_cxx_method_iterator>; |
937 | |
938 | overridden_method_range overridden_methods(const CXXMethodDecl *Method) const; |
939 | |
940 | |
941 | |
942 | void addOverriddenMethod(const CXXMethodDecl *Method, |
943 | const CXXMethodDecl *Overridden); |
944 | |
945 | |
946 | |
947 | |
948 | |
949 | |
950 | |
951 | |
952 | void getOverriddenMethods( |
953 | const NamedDecl *Method, |
954 | SmallVectorImpl<const NamedDecl *> &Overridden) const; |
955 | |
956 | |
957 | |
958 | void addedLocalImportDecl(ImportDecl *Import); |
959 | |
960 | static ImportDecl *getNextLocalImport(ImportDecl *Import) { |
961 | return Import->NextLocalImport; |
962 | } |
963 | |
964 | using import_range = llvm::iterator_range<import_iterator>; |
965 | |
966 | import_range local_imports() const { |
967 | return import_range(import_iterator(FirstLocalImport), import_iterator()); |
968 | } |
969 | |
970 | Decl *getPrimaryMergedDecl(Decl *D) { |
971 | Decl *Result = MergedDecls.lookup(D); |
972 | return Result ? Result : D; |
973 | } |
974 | void setPrimaryMergedDecl(Decl *D, Decl *Primary) { |
975 | MergedDecls[D] = Primary; |
976 | } |
977 | |
978 | |
979 | |
980 | void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, |
981 | bool NotifyListeners = true); |
982 | |
983 | |
984 | |
985 | void deduplicateMergedDefinitonsFor(NamedDecl *ND); |
986 | |
987 | |
988 | |
989 | ArrayRef<Module*> getModulesWithMergedDefinition(const NamedDecl *Def) { |
990 | auto MergedIt = |
991 | MergedDefModules.find(cast<NamedDecl>(Def->getCanonicalDecl())); |
992 | if (MergedIt == MergedDefModules.end()) |
993 | return None; |
994 | return MergedIt->second; |
995 | } |
996 | |
997 | |
998 | |
999 | |
1000 | |
1001 | void addModuleInitializer(Module *M, Decl *Init); |
1002 | |
1003 | void addLazyModuleInitializers(Module *M, ArrayRef<uint32_t> IDs); |
1004 | |
1005 | |
1006 | ArrayRef<Decl*> getModuleInitializers(Module *M); |
1007 | |
1008 | TranslationUnitDecl *getTranslationUnitDecl() const { return TUDecl; } |
1009 | |
1010 | ExternCContextDecl *getExternCContextDecl() const; |
1011 | BuiltinTemplateDecl *getMakeIntegerSeqDecl() const; |
1012 | BuiltinTemplateDecl *getTypePackElementDecl() const; |
1013 | |
1014 | |
1015 | CanQualType VoidTy; |
1016 | CanQualType BoolTy; |
1017 | CanQualType CharTy; |
1018 | CanQualType WCharTy; |
1019 | CanQualType WideCharTy; |
1020 | CanQualType WIntTy; |
1021 | CanQualType Char8Ty; |
1022 | CanQualType Char16Ty; |
1023 | CanQualType Char32Ty; |
1024 | CanQualType SignedCharTy, ShortTy, IntTy, LongTy, LongLongTy, Int128Ty; |
1025 | CanQualType UnsignedCharTy, UnsignedShortTy, UnsignedIntTy, UnsignedLongTy; |
1026 | CanQualType UnsignedLongLongTy, UnsignedInt128Ty; |
1027 | CanQualType FloatTy, DoubleTy, LongDoubleTy, Float128Ty; |
1028 | CanQualType ShortAccumTy, AccumTy, |
1029 | LongAccumTy; |
1030 | CanQualType UnsignedShortAccumTy, UnsignedAccumTy, UnsignedLongAccumTy; |
1031 | CanQualType ShortFractTy, FractTy, LongFractTy; |
1032 | CanQualType UnsignedShortFractTy, UnsignedFractTy, UnsignedLongFractTy; |
1033 | CanQualType SatShortAccumTy, SatAccumTy, SatLongAccumTy; |
1034 | CanQualType SatUnsignedShortAccumTy, SatUnsignedAccumTy, |
1035 | SatUnsignedLongAccumTy; |
1036 | CanQualType SatShortFractTy, SatFractTy, SatLongFractTy; |
1037 | CanQualType SatUnsignedShortFractTy, SatUnsignedFractTy, |
1038 | SatUnsignedLongFractTy; |
1039 | CanQualType HalfTy; |
1040 | CanQualType Float16Ty; |
1041 | CanQualType FloatComplexTy, DoubleComplexTy, LongDoubleComplexTy; |
1042 | CanQualType Float128ComplexTy; |
1043 | CanQualType VoidPtrTy, NullPtrTy; |
1044 | CanQualType DependentTy, OverloadTy, BoundMemberTy, UnknownAnyTy; |
1045 | CanQualType BuiltinFnTy; |
1046 | CanQualType PseudoObjectTy, ARCUnbridgedCastTy; |
1047 | CanQualType ObjCBuiltinIdTy, ObjCBuiltinClassTy, ObjCBuiltinSelTy; |
1048 | CanQualType ObjCBuiltinBoolTy; |
1049 | #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ |
1050 | CanQualType SingletonId; |
1051 | #include "clang/Basic/OpenCLImageTypes.def" |
1052 | CanQualType OCLSamplerTy, OCLEventTy, OCLClkEventTy; |
1053 | CanQualType OCLQueueTy, OCLReserveIDTy; |
1054 | CanQualType OMPArraySectionTy; |
1055 | #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ |
1056 | CanQualType Id##Ty; |
1057 | #include "clang/Basic/OpenCLExtensionTypes.def" |
1058 | |
1059 | |
1060 | mutable QualType AutoDeductTy; |
1061 | mutable QualType AutoRRefDeductTy; |
1062 | |
1063 | |
1064 | |
1065 | mutable Decl *VaListTagDecl; |
1066 | |
1067 | ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, |
1068 | SelectorTable &sels, Builtin::Context &builtins); |
1069 | ASTContext(const ASTContext &) = delete; |
1070 | ASTContext &operator=(const ASTContext &) = delete; |
1071 | ~ASTContext(); |
1072 | |
1073 | |
1074 | |
1075 | |
1076 | |
1077 | |
1078 | void setExternalSource(IntrusiveRefCntPtr<ExternalASTSource> Source); |
1079 | |
1080 | |
1081 | |
1082 | ExternalASTSource *getExternalSource() const { |
1083 | return ExternalSource.get(); |
1084 | } |
1085 | |
1086 | |
1087 | |
1088 | |
1089 | |
1090 | |
1091 | void setASTMutationListener(ASTMutationListener *Listener) { |
1092 | this->Listener = Listener; |
1093 | } |
1094 | |
1095 | |
1096 | |
1097 | ASTMutationListener *getASTMutationListener() const { return Listener; } |
1098 | |
1099 | void PrintStats() const; |
1100 | const SmallVectorImpl<Type *>& getTypes() const { return Types; } |
1101 | |
1102 | BuiltinTemplateDecl *buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, |
1103 | const IdentifierInfo *II) const; |
1104 | |
1105 | |
1106 | |
1107 | RecordDecl *buildImplicitRecord(StringRef Name, |
1108 | RecordDecl::TagKind TK = TTK_Struct) const; |
1109 | |
1110 | |
1111 | TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const; |
1112 | |
1113 | |
1114 | TypedefDecl *getInt128Decl() const; |
1115 | |
1116 | |
1117 | TypedefDecl *getUInt128Decl() const; |
1118 | |
1119 | |
1120 | |
1121 | |
1122 | |
1123 | private: |
1124 | |
1125 | QualType getExtQualType(const Type *Base, Qualifiers Quals) const; |
1126 | |
1127 | QualType getTypeDeclTypeSlow(const TypeDecl *Decl) const; |
1128 | |
1129 | QualType getPipeType(QualType T, bool ReadOnly) const; |
1130 | |
1131 | public: |
1132 | |
1133 | |
1134 | |
1135 | |
1136 | |
1137 | |
1138 | QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const; |
1139 | |
1140 | |
1141 | |
1142 | |
1143 | |
1144 | |
1145 | QualType removeAddrSpaceQualType(QualType T) const; |
1146 | |
1147 | |
1148 | |
1149 | |
1150 | |
1151 | QualType applyObjCProtocolQualifiers(QualType type, |
1152 | ArrayRef<ObjCProtocolDecl *> protocols, bool &hasError, |
1153 | bool allowOnPointerType = false) const; |
1154 | |
1155 | |
1156 | |
1157 | |
1158 | |
1159 | |
1160 | QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const; |
1161 | |
1162 | |
1163 | |
1164 | |
1165 | |
1166 | |
1167 | QualType getRestrictType(QualType T) const { |
1168 | return T.withFastQualifiers(Qualifiers::Restrict); |
1169 | } |
1170 | |
1171 | |
1172 | |
1173 | |
1174 | |
1175 | |
1176 | QualType getVolatileType(QualType T) const { |
1177 | return T.withFastQualifiers(Qualifiers::Volatile); |
1178 | } |
1179 | |
1180 | |
1181 | |
1182 | |
1183 | |
1184 | |
1185 | |
1186 | |
1187 | QualType getConstType(QualType T) const { return T.withConst(); } |
1188 | |
1189 | |
1190 | const FunctionType *adjustFunctionType(const FunctionType *Fn, |
1191 | FunctionType::ExtInfo EInfo); |
1192 | |
1193 | |
1194 | CanQualType getCanonicalFunctionResultType(QualType ResultType) const; |
1195 | |
1196 | |
1197 | void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType); |
1198 | |
1199 | |
1200 | |
1201 | |
1202 | |
1203 | QualType getFunctionTypeWithExceptionSpec( |
1204 | QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI); |
1205 | |
1206 | |
1207 | |
1208 | bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U); |
1209 | |
1210 | |
1211 | |
1212 | void adjustExceptionSpec(FunctionDecl *FD, |
1213 | const FunctionProtoType::ExceptionSpecInfo &ESI, |
1214 | bool AsWritten = false); |
1215 | |
1216 | |
1217 | |
1218 | QualType getComplexType(QualType T) const; |
1219 | CanQualType getComplexType(CanQualType T) const { |
1220 | return CanQualType::CreateUnsafe(getComplexType((QualType) T)); |
1221 | } |
1222 | |
1223 | |
1224 | |
1225 | QualType getPointerType(QualType T) const; |
1226 | CanQualType getPointerType(CanQualType T) const { |
1227 | return CanQualType::CreateUnsafe(getPointerType((QualType) T)); |
1228 | } |
1229 | |
1230 | |
1231 | |
1232 | QualType getAdjustedType(QualType Orig, QualType New) const; |
1233 | CanQualType getAdjustedType(CanQualType Orig, CanQualType New) const { |
1234 | return CanQualType::CreateUnsafe( |
1235 | getAdjustedType((QualType)Orig, (QualType)New)); |
1236 | } |
1237 | |
1238 | |
1239 | |
1240 | |
1241 | QualType getDecayedType(QualType T) const; |
1242 | CanQualType getDecayedType(CanQualType T) const { |
1243 | return CanQualType::CreateUnsafe(getDecayedType((QualType) T)); |
1244 | } |
1245 | |
1246 | |
1247 | |
1248 | QualType getAtomicType(QualType T) const; |
1249 | |
1250 | |
1251 | |
1252 | QualType getBlockPointerType(QualType T) const; |
1253 | |
1254 | |
1255 | |
1256 | QualType getBlockDescriptorType() const; |
1257 | |
1258 | |
1259 | QualType getReadPipeType(QualType T) const; |
1260 | |
1261 | |
1262 | QualType getWritePipeType(QualType T) const; |
1263 | |
1264 | |
1265 | |
1266 | QualType getBlockDescriptorExtendedType() const; |
1267 | |
1268 | |
1269 | TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *T) const; |
1270 | |
1271 | |
1272 | LangAS getOpenCLTypeAddrSpace(const Type *T) const; |
1273 | |
1274 | void setcudaConfigureCallDecl(FunctionDecl *FD) { |
1275 | cudaConfigureCallDecl = FD; |
1276 | } |
1277 | |
1278 | FunctionDecl *getcudaConfigureCallDecl() { |
1279 | return cudaConfigureCallDecl; |
1280 | } |
1281 | |
1282 | |
1283 | bool BlockRequiresCopying(QualType Ty, const VarDecl *D); |
1284 | |
1285 | |
1286 | |
1287 | |
1288 | bool getByrefLifetime(QualType Ty, |
1289 | Qualifiers::ObjCLifetime &Lifetime, |
1290 | bool &HasByrefExtendedLayout) const; |
1291 | |
1292 | |
1293 | |
1294 | QualType getLValueReferenceType(QualType T, bool SpelledAsLValue = true) |
1295 | const; |
1296 | |
1297 | |
1298 | |
1299 | QualType getRValueReferenceType(QualType T) const; |
1300 | |
1301 | |
1302 | |
1303 | |
1304 | |
1305 | QualType getMemberPointerType(QualType T, const Type *Cls) const; |
1306 | |
1307 | |
1308 | |
1309 | QualType getVariableArrayType(QualType EltTy, Expr *NumElts, |
1310 | ArrayType::ArraySizeModifier ASM, |
1311 | unsigned IndexTypeQuals, |
1312 | SourceRange Brackets) const; |
1313 | |
1314 | |
1315 | |
1316 | |
1317 | |
1318 | |
1319 | QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, |
1320 | ArrayType::ArraySizeModifier ASM, |
1321 | unsigned IndexTypeQuals, |
1322 | SourceRange Brackets) const; |
1323 | |
1324 | |
1325 | |
1326 | QualType getIncompleteArrayType(QualType EltTy, |
1327 | ArrayType::ArraySizeModifier ASM, |
1328 | unsigned IndexTypeQuals) const; |
1329 | |
1330 | |
1331 | |
1332 | QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, |
1333 | ArrayType::ArraySizeModifier ASM, |
1334 | unsigned IndexTypeQuals) const; |
1335 | |
1336 | |
1337 | QualType getVariableArrayDecayedType(QualType Ty) const; |
1338 | |
1339 | |
1340 | |
1341 | |
1342 | |
1343 | QualType getVectorType(QualType VectorType, unsigned NumElts, |
1344 | VectorType::VectorKind VecKind) const; |
1345 | |
1346 | |
1347 | QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, |
1348 | SourceLocation AttrLoc, |
1349 | VectorType::VectorKind VecKind) const; |
1350 | |
1351 | |
1352 | |
1353 | |
1354 | |
1355 | QualType getExtVectorType(QualType VectorType, unsigned NumElts) const; |
1356 | |
1357 | |
1358 | |
1359 | |
1360 | |
1361 | |
1362 | QualType getDependentSizedExtVectorType(QualType VectorType, |
1363 | Expr *SizeExpr, |
1364 | SourceLocation AttrLoc) const; |
1365 | |
1366 | QualType getDependentAddressSpaceType(QualType PointeeType, |
1367 | Expr *AddrSpaceExpr, |
1368 | SourceLocation AttrLoc) const; |
1369 | |
1370 | |
1371 | QualType getFunctionNoProtoType(QualType ResultTy, |
1372 | const FunctionType::ExtInfo &Info) const; |
1373 | |
1374 | QualType getFunctionNoProtoType(QualType ResultTy) const { |
1375 | return getFunctionNoProtoType(ResultTy, FunctionType::ExtInfo()); |
1376 | } |
1377 | |
1378 | |
1379 | QualType getFunctionType(QualType ResultTy, ArrayRef<QualType> Args, |
1380 | const FunctionProtoType::ExtProtoInfo &EPI) const { |
1381 | return getFunctionTypeInternal(ResultTy, Args, EPI, false); |
1382 | } |
1383 | |
1384 | QualType adjustStringLiteralBaseType(QualType StrLTy) const; |
1385 | |
1386 | private: |
1387 | |
1388 | QualType getFunctionTypeInternal(QualType ResultTy, ArrayRef<QualType> Args, |
1389 | const FunctionProtoType::ExtProtoInfo &EPI, |
1390 | bool OnlyWantCanonical) const; |
1391 | |
1392 | public: |
1393 | |
1394 | |
1395 | QualType getTypeDeclType(const TypeDecl *Decl, |
1396 | const TypeDecl *PrevDecl = nullptr) const { |
1397 | (0) . __assert_fail ("Decl && \"Passed null for Decl param\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1397, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Decl && "Passed null for Decl param"); |
1398 | if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0); |
1399 | |
1400 | if (PrevDecl) { |
1401 | (0) . __assert_fail ("PrevDecl->TypeForDecl && \"previous decl has no TypeForDecl\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1401, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl"); |
1402 | Decl->TypeForDecl = PrevDecl->TypeForDecl; |
1403 | return QualType(PrevDecl->TypeForDecl, 0); |
1404 | } |
1405 | |
1406 | return getTypeDeclTypeSlow(Decl); |
1407 | } |
1408 | |
1409 | |
1410 | |
1411 | QualType getTypedefType(const TypedefNameDecl *Decl, |
1412 | QualType Canon = QualType()) const; |
1413 | |
1414 | QualType getRecordType(const RecordDecl *Decl) const; |
1415 | |
1416 | QualType getEnumType(const EnumDecl *Decl) const; |
1417 | |
1418 | QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const; |
1419 | |
1420 | QualType getAttributedType(attr::Kind attrKind, |
1421 | QualType modifiedType, |
1422 | QualType equivalentType); |
1423 | |
1424 | QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, |
1425 | QualType Replacement) const; |
1426 | QualType getSubstTemplateTypeParmPackType( |
1427 | const TemplateTypeParmType *Replaced, |
1428 | const TemplateArgument &ArgPack); |
1429 | |
1430 | QualType |
1431 | getTemplateTypeParmType(unsigned Depth, unsigned Index, |
1432 | bool ParameterPack, |
1433 | TemplateTypeParmDecl *ParmDecl = nullptr) const; |
1434 | |
1435 | QualType getTemplateSpecializationType(TemplateName T, |
1436 | ArrayRef<TemplateArgument> Args, |
1437 | QualType Canon = QualType()) const; |
1438 | |
1439 | QualType |
1440 | getCanonicalTemplateSpecializationType(TemplateName T, |
1441 | ArrayRef<TemplateArgument> Args) const; |
1442 | |
1443 | QualType getTemplateSpecializationType(TemplateName T, |
1444 | const TemplateArgumentListInfo &Args, |
1445 | QualType Canon = QualType()) const; |
1446 | |
1447 | TypeSourceInfo * |
1448 | getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, |
1449 | const TemplateArgumentListInfo &Args, |
1450 | QualType Canon = QualType()) const; |
1451 | |
1452 | QualType getParenType(QualType NamedType) const; |
1453 | |
1454 | QualType getElaboratedType(ElaboratedTypeKeyword Keyword, |
1455 | NestedNameSpecifier *NNS, QualType NamedType, |
1456 | TagDecl *OwnedTagDecl = nullptr) const; |
1457 | QualType getDependentNameType(ElaboratedTypeKeyword Keyword, |
1458 | NestedNameSpecifier *NNS, |
1459 | const IdentifierInfo *Name, |
1460 | QualType Canon = QualType()) const; |
1461 | |
1462 | QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, |
1463 | NestedNameSpecifier *NNS, |
1464 | const IdentifierInfo *Name, |
1465 | const TemplateArgumentListInfo &Args) const; |
1466 | QualType getDependentTemplateSpecializationType( |
1467 | ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, |
1468 | const IdentifierInfo *Name, ArrayRef<TemplateArgument> Args) const; |
1469 | |
1470 | TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl); |
1471 | |
1472 | |
1473 | |
1474 | |
1475 | void getInjectedTemplateArgs(const TemplateParameterList *Params, |
1476 | SmallVectorImpl<TemplateArgument> &Args); |
1477 | |
1478 | QualType getPackExpansionType(QualType Pattern, |
1479 | Optional<unsigned> NumExpansions); |
1480 | |
1481 | QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, |
1482 | ObjCInterfaceDecl *PrevDecl = nullptr) const; |
1483 | |
1484 | |
1485 | QualType getObjCObjectType(QualType Base, |
1486 | ObjCProtocolDecl * const *Protocols, |
1487 | unsigned NumProtocols) const; |
1488 | |
1489 | QualType getObjCObjectType(QualType Base, |
1490 | ArrayRef<QualType> typeArgs, |
1491 | ArrayRef<ObjCProtocolDecl *> protocols, |
1492 | bool isKindOf) const; |
1493 | |
1494 | QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, |
1495 | ArrayRef<ObjCProtocolDecl *> protocols, |
1496 | QualType Canonical = QualType()) const; |
1497 | |
1498 | bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl); |
1499 | |
1500 | |
1501 | |
1502 | |
1503 | bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, |
1504 | ObjCInterfaceDecl *IDecl); |
1505 | |
1506 | |
1507 | QualType getObjCObjectPointerType(QualType OIT) const; |
1508 | |
1509 | |
1510 | QualType getTypeOfExprType(Expr *e) const; |
1511 | QualType getTypeOfType(QualType t) const; |
1512 | |
1513 | |
1514 | QualType getDecltypeType(Expr *e, QualType UnderlyingType) const; |
1515 | |
1516 | |
1517 | QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, |
1518 | UnaryTransformType::UTTKind UKind) const; |
1519 | |
1520 | |
1521 | QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, |
1522 | bool IsDependent) const; |
1523 | |
1524 | |
1525 | QualType getAutoDeductType() const; |
1526 | |
1527 | |
1528 | QualType getAutoRRefDeductType() const; |
1529 | |
1530 | |
1531 | QualType getDeducedTemplateSpecializationType(TemplateName Template, |
1532 | QualType DeducedType, |
1533 | bool IsDependent) const; |
1534 | |
1535 | |
1536 | |
1537 | QualType getTagDeclType(const TagDecl *Decl) const; |
1538 | |
1539 | |
1540 | |
1541 | |
1542 | |
1543 | CanQualType getSizeType() const; |
1544 | |
1545 | |
1546 | |
1547 | CanQualType getSignedSizeType() const; |
1548 | |
1549 | |
1550 | |
1551 | CanQualType getIntMaxType() const; |
1552 | |
1553 | |
1554 | |
1555 | CanQualType getUIntMaxType() const; |
1556 | |
1557 | |
1558 | |
1559 | QualType getWCharType() const { return WCharTy; } |
1560 | |
1561 | |
1562 | |
1563 | |
1564 | QualType getWideCharType() const { return WideCharTy; } |
1565 | |
1566 | |
1567 | |
1568 | |
1569 | QualType getSignedWCharType() const; |
1570 | |
1571 | |
1572 | |
1573 | |
1574 | QualType getUnsignedWCharType() const; |
1575 | |
1576 | |
1577 | |
1578 | QualType getWIntType() const { return WIntTy; } |
1579 | |
1580 | |
1581 | |
1582 | QualType getIntPtrType() const; |
1583 | |
1584 | |
1585 | |
1586 | QualType getUIntPtrType() const; |
1587 | |
1588 | |
1589 | |
1590 | QualType getPointerDiffType() const; |
1591 | |
1592 | |
1593 | |
1594 | |
1595 | QualType getUnsignedPointerDiffType() const; |
1596 | |
1597 | |
1598 | |
1599 | QualType getProcessIDType() const; |
1600 | |
1601 | |
1602 | QualType getCFConstantStringType() const; |
1603 | |
1604 | |
1605 | QualType getObjCSuperType() const; |
1606 | void setObjCSuperType(QualType ST) { ObjCSuperType = ST; } |
1607 | |
1608 | |
1609 | |
1610 | QualType getRawCFConstantStringType() const { |
1611 | if (CFConstantStringTypeDecl) |
1612 | return getTypedefType(CFConstantStringTypeDecl); |
1613 | return QualType(); |
1614 | } |
1615 | void setCFConstantStringType(QualType T); |
1616 | TypedefDecl *getCFConstantStringDecl() const; |
1617 | RecordDecl *getCFConstantStringTagDecl() const; |
1618 | |
1619 | |
1620 | void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl); |
1621 | QualType getObjCConstantStringInterface() const { |
1622 | return ObjCConstantStringType; |
1623 | } |
1624 | |
1625 | QualType getObjCNSStringType() const { |
1626 | return ObjCNSStringType; |
1627 | } |
1628 | |
1629 | void setObjCNSStringType(QualType T) { |
1630 | ObjCNSStringType = T; |
1631 | } |
1632 | |
1633 | |
1634 | |
1635 | QualType getObjCIdRedefinitionType() const { |
1636 | if (ObjCIdRedefinitionType.isNull()) |
1637 | return getObjCIdType(); |
1638 | return ObjCIdRedefinitionType; |
1639 | } |
1640 | |
1641 | |
1642 | void setObjCIdRedefinitionType(QualType RedefType) { |
1643 | ObjCIdRedefinitionType = RedefType; |
1644 | } |
1645 | |
1646 | |
1647 | |
1648 | QualType getObjCClassRedefinitionType() const { |
1649 | if (ObjCClassRedefinitionType.isNull()) |
1650 | return getObjCClassType(); |
1651 | return ObjCClassRedefinitionType; |
1652 | } |
1653 | |
1654 | |
1655 | void setObjCClassRedefinitionType(QualType RedefType) { |
1656 | ObjCClassRedefinitionType = RedefType; |
1657 | } |
1658 | |
1659 | |
1660 | |
1661 | QualType getObjCSelRedefinitionType() const { |
1662 | if (ObjCSelRedefinitionType.isNull()) |
1663 | return getObjCSelType(); |
1664 | return ObjCSelRedefinitionType; |
1665 | } |
1666 | |
1667 | |
1668 | void setObjCSelRedefinitionType(QualType RedefType) { |
1669 | ObjCSelRedefinitionType = RedefType; |
1670 | } |
1671 | |
1672 | |
1673 | IdentifierInfo *getNSObjectName() const { |
1674 | if (!NSObjectName) { |
1675 | NSObjectName = &Idents.get("NSObject"); |
1676 | } |
1677 | |
1678 | return NSObjectName; |
1679 | } |
1680 | |
1681 | |
1682 | IdentifierInfo *getNSCopyingName() { |
1683 | if (!NSCopyingName) { |
1684 | NSCopyingName = &Idents.get("NSCopying"); |
1685 | } |
1686 | |
1687 | return NSCopyingName; |
1688 | } |
1689 | |
1690 | CanQualType getNSUIntegerType() const { |
1691 | (0) . __assert_fail ("Target && \"Expected target to be initialized\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1691, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Target && "Expected target to be initialized"); |
1692 | const llvm::Triple &T = Target->getTriple(); |
1693 | |
1694 | if (T.isOSWindows() && T.isArch64Bit()) |
1695 | return UnsignedLongLongTy; |
1696 | return UnsignedLongTy; |
1697 | } |
1698 | |
1699 | CanQualType getNSIntegerType() const { |
1700 | (0) . __assert_fail ("Target && \"Expected target to be initialized\"", "/home/seafit/code_projects/clang_source/clang/include/clang/AST/ASTContext.h", 1700, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(Target && "Expected target to be initialized"); |
1701 | const llvm::Triple &T = Target->getTriple(); |
1702 | |
1703 | if (T.isOSWindows() && T.isArch64Bit()) |
1704 | return LongLongTy; |
1705 | return LongTy; |
1706 | } |
1707 | |
1708 | |
1709 | IdentifierInfo *getBoolName() const { |
1710 | if (!BoolName) |
1711 | BoolName = &Idents.get("bool"); |
1712 | return BoolName; |
1713 | } |
1714 | |
1715 | IdentifierInfo *getMakeIntegerSeqName() const { |
1716 | if (!MakeIntegerSeqName) |
1717 | MakeIntegerSeqName = &Idents.get("__make_integer_seq"); |
1718 | return MakeIntegerSeqName; |
1719 | } |
1720 | |
1721 | IdentifierInfo *getTypePackElementName() const { |
1722 | if (!TypePackElementName) |
1723 | TypePackElementName = &Idents.get("__type_pack_element"); |
1724 | return TypePackElementName; |
1725 | } |
1726 | |
1727 | |
1728 | |
1729 | QualType getObjCInstanceType() { |
1730 | return getTypeDeclType(getObjCInstanceTypeDecl()); |
1731 | } |
1732 | |
1733 | |
1734 | |
1735 | TypedefDecl *getObjCInstanceTypeDecl(); |
1736 | |
1737 | |
1738 | void setFILEDecl(TypeDecl *FILEDecl) { this->FILEDecl = FILEDecl; } |
1739 | |
1740 | |
1741 | QualType getFILEType() const { |
1742 | if (FILEDecl) |
1743 | return getTypeDeclType(FILEDecl); |
1744 | return QualType(); |
1745 | } |
1746 | |
1747 | |
1748 | void setjmp_bufDecl(TypeDecl *jmp_bufDecl) { |
1749 | this->jmp_bufDecl = jmp_bufDecl; |
1750 | } |
1751 | |
1752 | |
1753 | QualType getjmp_bufType() const { |
1754 | if (jmp_bufDecl) |
1755 | return getTypeDeclType(jmp_bufDecl); |
1756 | return QualType(); |
1757 | } |
1758 | |
1759 | |
1760 | void setsigjmp_bufDecl(TypeDecl *sigjmp_bufDecl) { |
1761 | this->sigjmp_bufDecl = sigjmp_bufDecl; |
1762 | } |
1763 | |
1764 | |
1765 | QualType getsigjmp_bufType() const { |
1766 | if (sigjmp_bufDecl) |
1767 | return getTypeDeclType(sigjmp_bufDecl); |
1768 | return QualType(); |
1769 | } |
1770 | |
1771 | |
1772 | void setucontext_tDecl(TypeDecl *ucontext_tDecl) { |
1773 | this->ucontext_tDecl = ucontext_tDecl; |
1774 | } |
1775 | |
1776 | |
1777 | QualType getucontext_tType() const { |
1778 | if (ucontext_tDecl) |
1779 | return getTypeDeclType(ucontext_tDecl); |
1780 | return QualType(); |
1781 | } |
1782 | |
1783 | |
1784 | QualType getLogicalOperationType() const { |
1785 | return getLangOpts().CPlusPlus ? BoolTy : IntTy; |
1786 | } |
1787 | |
1788 | |
1789 | |
1790 | |
1791 | |
1792 | void getObjCEncodingForType(QualType T, std::string &S, |
1793 | const FieldDecl *Field=nullptr, |
1794 | QualType *NotEncodedT=nullptr) const; |
1795 | |
1796 | |
1797 | |
1798 | void getObjCEncodingForPropertyType(QualType T, std::string &S) const; |
1799 | |
1800 | void getLegacyIntegralTypeEncoding(QualType &t) const; |
1801 | |
1802 | |
1803 | void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, |
1804 | std::string &S) const; |
1805 | |
1806 | |
1807 | |
1808 | |
1809 | |
1810 | |
1811 | |
1812 | std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const; |
1813 | |
1814 | |
1815 | |
1816 | std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, |
1817 | bool Extended = false) const; |
1818 | |
1819 | |
1820 | std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const; |
1821 | |
1822 | |
1823 | |
1824 | |
1825 | |
1826 | std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, |
1827 | const Decl *Container) const; |
1828 | |
1829 | bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, |
1830 | ObjCProtocolDecl *rProto) const; |
1831 | |
1832 | ObjCPropertyImplDecl *getObjCPropertyImplDeclForPropertyDecl( |
1833 | const ObjCPropertyDecl *PD, |
1834 | const Decl *Container) const; |
1835 | |
1836 | |
1837 | |
1838 | CharUnits getObjCEncodingTypeSize(QualType T) const; |
1839 | |
1840 | |
1841 | |
1842 | TypedefDecl *getObjCIdDecl() const; |
1843 | |
1844 | |
1845 | |
1846 | |
1847 | |
1848 | QualType getObjCIdType() const { |
1849 | return getTypeDeclType(getObjCIdDecl()); |
1850 | } |
1851 | |
1852 | |
1853 | |
1854 | TypedefDecl *getObjCSelDecl() const; |
1855 | |
1856 | |
1857 | |
1858 | QualType getObjCSelType() const { |
1859 | return getTypeDeclType(getObjCSelDecl()); |
1860 | } |
1861 | |
1862 | |
1863 | |
1864 | TypedefDecl *getObjCClassDecl() const; |
1865 | |
1866 | |
1867 | |
1868 | |
1869 | |
1870 | QualType getObjCClassType() const { |
1871 | return getTypeDeclType(getObjCClassDecl()); |
1872 | } |
1873 | |
1874 | |
1875 | |
1876 | ObjCInterfaceDecl *getObjCProtocolDecl() const; |
1877 | |
1878 | |
1879 | TypedefDecl *getBOOLDecl() const { |
1880 | return BOOLDecl; |
1881 | } |
1882 | |
1883 | |
1884 | void setBOOLDecl(TypedefDecl *TD) { |
1885 | BOOLDecl = TD; |
1886 | } |
1887 | |
1888 | |
1889 | QualType getBOOLType() const { |
1890 | return getTypeDeclType(getBOOLDecl()); |
1891 | } |
1892 | |
1893 | |
1894 | QualType getObjCProtoType() const { |
1895 | return getObjCInterfaceType(getObjCProtocolDecl()); |
1896 | } |
1897 | |
1898 | |
1899 | |
1900 | TypedefDecl *getBuiltinVaListDecl() const; |
1901 | |
1902 | |
1903 | QualType getBuiltinVaListType() const { |
1904 | return getTypeDeclType(getBuiltinVaListDecl()); |
1905 | } |
1906 | |
1907 | |
1908 | |
1909 | |
1910 | Decl *getVaListTagDecl() const; |
1911 | |
1912 | |
1913 | |
1914 | TypedefDecl *getBuiltinMSVaListDecl() const; |
1915 | |
1916 | |
1917 | QualType getBuiltinMSVaListType() const { |
1918 | return getTypeDeclType(getBuiltinMSVaListDecl()); |
1919 | } |
1920 | |
1921 | |
1922 | |
1923 | bool canBuiltinBeRedeclared(const FunctionDecl *) const; |
1924 | |
1925 | |
1926 | |
1927 | QualType getCVRQualifiedType(QualType T, unsigned CVR) const { |
1928 | return getQualifiedType(T, Qualifiers::fromCVRMask(CVR)); |
1929 | } |
1930 | |
1931 | |
1932 | QualType getQualifiedType(SplitQualType split) const { |
1933 | return getQualifiedType(split.Ty, split.Quals); |
1934 | } |
1935 | |
1936 | |
1937 | QualType getQualifiedType(QualType T, Qualifiers Qs) const { |
1938 | if (!Qs.hasNonFastQualifiers()) |
1939 | return T.withFastQualifiers(Qs.getFastQualifiers()); |
1940 | QualifierCollector Qc(Qs); |
1941 | const Type *Ptr = Qc.strip(T); |
1942 | return getExtQualType(Ptr, Qc); |
1943 | } |
1944 | |
1945 | |
1946 | QualType getQualifiedType(const Type *T, Qualifiers Qs) const { |
1947 | if (!Qs.hasNonFastQualifiers()) |
1948 | return QualType(T, Qs.getFastQualifiers()); |
1949 | return getExtQualType(T, Qs); |
1950 | } |
1951 | |
1952 | |
1953 | |
1954 | |
1955 | QualType getLifetimeQualifiedType(QualType type, |
1956 | Qualifiers::ObjCLifetime lifetime) { |
1957 | assert(type.getObjCLifetime() == Qualifiers::OCL_None); |
1958 | assert(lifetime != Qualifiers::OCL_None); |
1959 | |
1960 | Qualifiers qs; |
1961 | qs.addObjCLifetime(lifetime); |
1962 | return getQualifiedType(type, qs); |
1963 | } |
1964 | |
1965 | |
1966 | |
1967 | QualType getUnqualifiedObjCPointerType(QualType type) const { |
1968 | if (!type.getTypePtr()->isObjCObjectPointerType() || |
1969 | !type.getQualifiers().hasObjCLifetime()) |
1970 | return type; |
1971 | Qualifiers Qs = type.getQualifiers(); |
1972 | Qs.removeObjCLifetime(); |
1973 | return getQualifiedType(type.getUnqualifiedType(), Qs); |
1974 | } |
1975 | |
1976 | unsigned char getFixedPointScale(QualType Ty) const; |
1977 | unsigned char getFixedPointIBits(QualType Ty) const; |
1978 | FixedPointSemantics getFixedPointSemantics(QualType Ty) const; |
1979 | APFixedPoint getFixedPointMax(QualType Ty) const; |
1980 | APFixedPoint getFixedPointMin(QualType Ty) const; |
1981 | |
1982 | DeclarationNameInfo getNameForTemplate(TemplateName Name, |
1983 | SourceLocation NameLoc) const; |
1984 | |
1985 | TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, |
1986 | UnresolvedSetIterator End) const; |
1987 | |
1988 | TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, |
1989 | bool TemplateKeyword, |
1990 | TemplateDecl *Template) const; |
1991 | |
1992 | TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, |
1993 | const IdentifierInfo *Name) const; |
1994 | TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, |
1995 | OverloadedOperatorKind Operator) const; |
1996 | TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, |
1997 | TemplateName replacement) const; |
1998 | TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, |
1999 | const TemplateArgument &ArgPack) const; |
2000 | |
2001 | enum GetBuiltinTypeError { |
2002 | |
2003 | GE_None, |
2004 | |
2005 | |
2006 | GE_Missing_type, |
2007 | |
2008 | |
2009 | GE_Missing_stdio, |
2010 | |
2011 | |
2012 | GE_Missing_setjmp, |
2013 | |
2014 | |
2015 | GE_Missing_ucontext |
2016 | }; |
2017 | |
2018 | |
2019 | |
2020 | |
2021 | |
2022 | |
2023 | QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, |
2024 | unsigned *IntegerConstantArgs = nullptr) const; |
2025 | |
2026 | |
2027 | |
2028 | ComparisonCategories CompCategories; |
2029 | |
2030 | private: |
2031 | CanQualType getFromTargetType(unsigned Type) const; |
2032 | TypeInfo getTypeInfoImpl(const Type *T) const; |
2033 | |
2034 | |
2035 | |
2036 | |
2037 | |
2038 | public: |
2039 | |
2040 | |
2041 | Qualifiers::GC getObjCGCAttrKind(QualType Ty) const; |
2042 | |
2043 | |
2044 | |
2045 | |
2046 | |
2047 | |
2048 | bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec); |
2049 | |
2050 | |
2051 | |
2052 | static bool isObjCNSObjectType(QualType Ty) { |
2053 | return Ty->isObjCNSObjectType(); |
2054 | } |
2055 | |
2056 | |
2057 | |
2058 | |
2059 | |
2060 | |
2061 | |
2062 | const llvm::fltSemantics &getFloatTypeSemantics(QualType T) const; |
2063 | |
2064 | |
2065 | TypeInfo getTypeInfo(const Type *T) const; |
2066 | TypeInfo getTypeInfo(QualType T) const { return getTypeInfo(T.getTypePtr()); } |
2067 | |
2068 | |
2069 | unsigned getOpenMPDefaultSimdAlign(QualType T) const; |
2070 | |
2071 | |
2072 | uint64_t getTypeSize(QualType T) const { return getTypeInfo(T).Width; } |
2073 | uint64_t getTypeSize(const Type *T) const { return getTypeInfo(T).Width; } |
2074 | |
2075 | |
2076 | uint64_t getCharWidth() const { |
2077 | return getTypeSize(CharTy); |
2078 | } |
2079 | |
2080 | |
2081 | CharUnits toCharUnitsFromBits(int64_t BitSize) const; |
2082 | |
2083 | |
2084 | int64_t toBits(CharUnits CharSize) const; |
2085 | |
2086 | |
2087 | |
2088 | CharUnits getTypeSizeInChars(QualType T) const; |
2089 | CharUnits getTypeSizeInChars(const Type *T) const; |
2090 | |
2091 | Optional<CharUnits> getTypeSizeInCharsIfKnown(QualType Ty) const { |
2092 | if (Ty->isIncompleteType() || Ty->isDependentType()) |
2093 | return None; |
2094 | return getTypeSizeInChars(Ty); |
2095 | } |
2096 | |
2097 | Optional<CharUnits> getTypeSizeInCharsIfKnown(const Type *Ty) const { |
2098 | return getTypeSizeInCharsIfKnown(QualType(Ty, 0)); |
2099 | } |
2100 | |
2101 | |
2102 | |
2103 | unsigned getTypeAlign(QualType T) const { return getTypeInfo(T).Align; } |
2104 | unsigned getTypeAlign(const Type *T) const { return getTypeInfo(T).Align; } |
2105 | |
2106 | |
2107 | |
2108 | |
2109 | |
2110 | |
2111 | unsigned getTypeUnadjustedAlign(QualType T) const { |
2112 | return getTypeUnadjustedAlign(T.getTypePtr()); |
2113 | } |
2114 | unsigned getTypeUnadjustedAlign(const Type *T) const; |
2115 | |
2116 | |
2117 | |
2118 | |
2119 | unsigned getTypeAlignIfKnown(QualType T) const; |
2120 | |
2121 | |
2122 | |
2123 | CharUnits getTypeAlignInChars(QualType T) const; |
2124 | CharUnits getTypeAlignInChars(const Type *T) const; |
2125 | |
2126 | |
2127 | |
2128 | |
2129 | CharUnits getTypeUnadjustedAlignInChars(QualType T) const; |
2130 | CharUnits getTypeUnadjustedAlignInChars(const Type *T) const; |
2131 | |
2132 | |
2133 | |
2134 | std::pair<CharUnits, CharUnits> getTypeInfoDataSizeInChars(QualType T) const; |
2135 | |
2136 | std::pair<CharUnits, CharUnits> getTypeInfoInChars(const Type *T) const; |
2137 | std::pair<CharUnits, CharUnits> getTypeInfoInChars(QualType T) const; |
2138 | |
2139 | |
2140 | |
2141 | bool isAlignmentRequired(const Type *T) const; |
2142 | bool isAlignmentRequired(QualType T) const; |
2143 | |
2144 | |
2145 | |
2146 | |
2147 | |
2148 | |
2149 | unsigned getPreferredTypeAlign(const Type *T) const; |
2150 | |
2151 | |
2152 | |
2153 | unsigned getTargetDefaultAlignForAttributeAligned() const; |
2154 | |
2155 | |
2156 | |
2157 | unsigned getAlignOfGlobalVar(QualType T) const; |
2158 | |
2159 | |
2160 | |
2161 | CharUnits getAlignOfGlobalVarInChars(QualType T) const; |
2162 | |
2163 | |
2164 | |
2165 | |
2166 | |
2167 | |
2168 | |
2169 | |
2170 | |
2171 | |
2172 | |
2173 | CharUnits getDeclAlign(const Decl *D, bool ForAlignof = false) const; |
2174 | |
2175 | |
2176 | |
2177 | |
2178 | const ASTRecordLayout &getASTRecordLayout(const RecordDecl *D) const; |
2179 | |
2180 | |
2181 | |
2182 | const ASTRecordLayout &getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) |
2183 | const; |
2184 | |
2185 | void DumpRecordLayout(const RecordDecl *RD, raw_ostream &OS, |
2186 | bool Simple = false) const; |
2187 | |
2188 | |
2189 | |
2190 | |
2191 | |
2192 | const ASTRecordLayout & |
2193 | getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const; |
2194 | |
2195 | |
2196 | |
2197 | |
2198 | |
2199 | |
2200 | |
2201 | |
2202 | |
2203 | |
2204 | |
2205 | const CXXMethodDecl *getCurrentKeyFunction(const CXXRecordDecl *RD); |
2206 | |
2207 | |
2208 | |
2209 | |
2210 | |
2211 | |
2212 | |
2213 | |
2214 | |
2215 | void setNonKeyFunction(const CXXMethodDecl *method); |
2216 | |
2217 | |
2218 | |
2219 | |
2220 | |
2221 | |
2222 | |
2223 | |
2224 | |
2225 | |
2226 | CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const; |
2227 | |
2228 | |
2229 | uint64_t getFieldOffset(const ValueDecl *FD) const; |
2230 | |
2231 | |
2232 | uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, |
2233 | const ObjCImplementationDecl *ID, |
2234 | const ObjCIvarDecl *Ivar) const; |
2235 | |
2236 | bool isNearlyEmpty(const CXXRecordDecl *RD) const; |
2237 | |
2238 | VTableContextBase *getVTableContext(); |
2239 | |
2240 | |
2241 | MangleContext *createMangleContext(const TargetInfo *T = nullptr); |
2242 | |
2243 | void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, |
2244 | SmallVectorImpl<const ObjCIvarDecl*> &Ivars) const; |
2245 | |
2246 | unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const; |
2247 | void CollectInheritedProtocols(const Decl *CDecl, |
2248 | llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols); |
2249 | |
2250 | |
2251 | |
2252 | bool hasUniqueObjectRepresentations(QualType Ty) const; |
2253 | |
2254 | |
2255 | |
2256 | |
2257 | |
2258 | |
2259 | |
2260 | |
2261 | |
2262 | |
2263 | |
2264 | |
2265 | |
2266 | CanQualType getCanonicalType(QualType T) const { |
2267 | return CanQualType::CreateUnsafe(T.getCanonicalType()); |
2268 | } |
2269 | |
2270 | const Type *getCanonicalType(const Type *T) const { |
2271 | return T->getCanonicalTypeInternal().getTypePtr(); |
2272 | } |
2273 | |
2274 | |
2275 | |
2276 | |
2277 | |
2278 | |
2279 | CanQualType getCanonicalParamType(QualType T) const; |
2280 | |
2281 | |
2282 | bool hasSameType(QualType T1, QualType T2) const { |
2283 | return getCanonicalType(T1) == getCanonicalType(T2); |
2284 | } |
2285 | bool hasSameType(const Type *T1, const Type *T2) const { |
2286 | return getCanonicalType(T1) == getCanonicalType(T2); |
2287 | } |
2288 | |
2289 | |
2290 | |
2291 | |
2292 | |
2293 | |
2294 | |
2295 | |
2296 | |
2297 | |
2298 | |
2299 | |
2300 | |
2301 | |
2302 | QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals); |
2303 | |
2304 | |
2305 | |
2306 | bool hasSameUnqualifiedType(QualType T1, QualType T2) const { |
2307 | return getCanonicalType(T1).getTypePtr() == |
2308 | getCanonicalType(T2).getTypePtr(); |
2309 | } |
2310 | |
2311 | bool (QualType SubT, QualType SuperT, |
2312 | bool IsParam) const { |
2313 | auto SubTnullability = SubT->getNullability(*this); |
2314 | auto SuperTnullability = SuperT->getNullability(*this); |
2315 | if (SubTnullability.hasValue() == SuperTnullability.hasValue()) { |
2316 | |
2317 | if (!SubTnullability) |
2318 | return true; |
2319 | |
2320 | if (*SubTnullability == *SuperTnullability || |
2321 | *SubTnullability == NullabilityKind::Unspecified || |
2322 | *SuperTnullability == NullabilityKind::Unspecified) |
2323 | return true; |
2324 | |
2325 | if (IsParam) { |
2326 | |
2327 | |
2328 | return (*SuperTnullability == NullabilityKind::NonNull && |
2329 | *SubTnullability == NullabilityKind::Nullable); |
2330 | } |
2331 | else { |
2332 | |
2333 | |
2334 | return (*SuperTnullability == NullabilityKind::Nullable && |
2335 | *SubTnullability == NullabilityKind::NonNull); |
2336 | } |
2337 | } |
2338 | return true; |
2339 | } |
2340 | |
2341 | bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, |
2342 | const ObjCMethodDecl *MethodImp); |
2343 | |
2344 | bool UnwrapSimilarTypes(QualType &T1, QualType &T2); |
2345 | bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2); |
2346 | |
2347 | |
2348 | |
2349 | |
2350 | |
2351 | |
2352 | |
2353 | |
2354 | bool hasSimilarType(QualType T1, QualType T2); |
2355 | |
2356 | |
2357 | bool hasCvrSimilarType(QualType T1, QualType T2); |
2358 | |
2359 | |
2360 | |
2361 | |
2362 | |
2363 | |
2364 | |
2365 | |
2366 | |
2367 | |
2368 | |
2369 | |
2370 | |
2371 | |
2372 | |
2373 | |
2374 | |
2375 | |
2376 | |
2377 | |
2378 | |
2379 | |
2380 | |
2381 | |
2382 | NestedNameSpecifier * |
2383 | getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const; |
2384 | |
2385 | |
2386 | CallingConv getDefaultCallingConvention(bool IsVariadic, |
2387 | bool IsCXXMethod) const; |
2388 | |
2389 | |
2390 | |
2391 | |
2392 | |
2393 | |
2394 | |
2395 | |
2396 | |
2397 | |
2398 | |
2399 | |
2400 | |
2401 | |
2402 | |
2403 | |
2404 | |
2405 | |
2406 | |
2407 | TemplateName getCanonicalTemplateName(TemplateName Name) const; |
2408 | |
2409 | |
2410 | |
2411 | bool hasSameTemplateName(TemplateName X, TemplateName Y); |
2412 | |
2413 | |
2414 | |
2415 | |
2416 | |
2417 | |
2418 | TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) |
2419 | const; |
2420 | |
2421 | |
2422 | |
2423 | |
2424 | |
2425 | const ArrayType *getAsArrayType(QualType T) const; |
2426 | const ConstantArrayType *getAsConstantArrayType(QualType T) const { |
2427 | return dyn_cast_or_null<ConstantArrayType>(getAsArrayType(T)); |
2428 | } |
2429 | const VariableArrayType *getAsVariableArrayType(QualType T) const { |
2430 | return dyn_cast_or_null<VariableArrayType>(getAsArrayType(T)); |
2431 | } |
2432 | const IncompleteArrayType *getAsIncompleteArrayType(QualType T) const { |
2433 | return dyn_cast_or_null<IncompleteArrayType>(getAsArrayType(T)); |
2434 | } |
2435 | const DependentSizedArrayType *getAsDependentSizedArrayType(QualType T) |
2436 | const { |
2437 | return dyn_cast_or_null<DependentSizedArrayType>(getAsArrayType(T)); |
2438 | } |
2439 | |
2440 | |
2441 | |
2442 | |
2443 | QualType getBaseElementType(const ArrayType *VAT) const; |
2444 | |
2445 | |
2446 | |
2447 | QualType getBaseElementType(QualType QT) const; |
2448 | |
2449 | |
2450 | uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const; |
2451 | |
2452 | |
2453 | |
2454 | |
2455 | |
2456 | |
2457 | QualType getAdjustedParameterType(QualType T) const; |
2458 | |
2459 | |
2460 | |
2461 | |
2462 | QualType getSignatureParameterType(QualType T) const; |
2463 | |
2464 | QualType getExceptionObjectType(QualType T) const; |
2465 | |
2466 | |
2467 | |
2468 | |
2469 | |
2470 | |
2471 | |
2472 | |
2473 | |
2474 | QualType getArrayDecayedType(QualType T) const; |
2475 | |
2476 | |
2477 | |
2478 | QualType getPromotedIntegerType(QualType PromotableType) const; |
2479 | |
2480 | |
2481 | |
2482 | Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const; |
2483 | |
2484 | |
2485 | |
2486 | |
2487 | |
2488 | |
2489 | QualType isPromotableBitField(Expr *E) const; |
2490 | |
2491 | |
2492 | |
2493 | |
2494 | |
2495 | int getIntegerTypeOrder(QualType LHS, QualType RHS) const; |
2496 | |
2497 | |
2498 | |
2499 | |
2500 | |
2501 | |
2502 | int getFloatingTypeOrder(QualType LHS, QualType RHS) const; |
2503 | |
2504 | |
2505 | |
2506 | |
2507 | int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const; |
2508 | |
2509 | |
2510 | |
2511 | |
2512 | |
2513 | |
2514 | QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, |
2515 | QualType typeDomain) const; |
2516 | |
2517 | unsigned getTargetAddressSpace(QualType T) const { |
2518 | return getTargetAddressSpace(T.getQualifiers()); |
2519 | } |
2520 | |
2521 | unsigned getTargetAddressSpace(Qualifiers Q) const { |
2522 | return getTargetAddressSpace(Q.getAddressSpace()); |
2523 | } |
2524 | |
2525 | unsigned getTargetAddressSpace(LangAS AS) const; |
2526 | |
2527 | LangAS getLangASForBuiltinAddressSpace(unsigned AS) const; |
2528 | |
2529 | |
2530 | |
2531 | uint64_t getTargetNullPointerValue(QualType QT) const; |
2532 | |
2533 | bool addressSpaceMapManglingFor(LangAS AS) const { |
2534 | return AddrSpaceMapMangling || isTargetAddressSpace(AS); |
2535 | } |
2536 | |
2537 | private: |
2538 | |
2539 | unsigned getIntegerRank(const Type *T) const; |
2540 | |
2541 | public: |
2542 | |
2543 | |
2544 | |
2545 | |
2546 | |
2547 | bool typesAreCompatible(QualType T1, QualType T2, |
2548 | bool CompareUnqualified = false); |
2549 | |
2550 | bool propertyTypesAreCompatible(QualType, QualType); |
2551 | bool typesAreBlockPointerCompatible(QualType, QualType); |
2552 | |
2553 | bool isObjCIdType(QualType T) const { |
2554 | return T == getObjCIdType(); |
2555 | } |
2556 | |
2557 | bool isObjCClassType(QualType T) const { |
2558 | return T == getObjCClassType(); |
2559 | } |
2560 | |
2561 | bool isObjCSelType(QualType T) const { |
2562 | return T == getObjCSelType(); |
2563 | } |
2564 | |
2565 | bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, |
2566 | bool ForCompare); |
2567 | |
2568 | bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS); |
2569 | |
2570 | |
2571 | bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, |
2572 | const ObjCObjectPointerType *RHSOPT); |
2573 | bool canAssignObjCInterfaces(const ObjCObjectType *LHS, |
2574 | const ObjCObjectType *RHS); |
2575 | bool canAssignObjCInterfacesInBlockPointer( |
2576 | const ObjCObjectPointerType *LHSOPT, |
2577 | const ObjCObjectPointerType *RHSOPT, |
2578 | bool BlockReturnType); |
2579 | bool areComparableObjCPointerTypes(QualType LHS, QualType RHS); |
2580 | QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, |
2581 | const ObjCObjectPointerType *RHSOPT); |
2582 | bool canBindObjCObjectType(QualType To, QualType From); |
2583 | |
2584 | |
2585 | QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, |
2586 | bool Unqualified = false, bool BlockReturnType = false); |
2587 | QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, |
2588 | bool Unqualified = false); |
2589 | QualType mergeFunctionParameterTypes(QualType, QualType, |
2590 | bool OfBlockPointer = false, |
2591 | bool Unqualified = false); |
2592 | QualType mergeTransparentUnionType(QualType, QualType, |
2593 | bool OfBlockPointer=false, |
2594 | bool Unqualified = false); |
2595 | |
2596 | QualType mergeObjCGCQualifiers(QualType, QualType); |
2597 | |
2598 | |
2599 | |
2600 | |
2601 | |
2602 | |
2603 | |
2604 | |
2605 | |
2606 | |
2607 | |
2608 | |
2609 | |
2610 | |
2611 | |
2612 | |
2613 | |
2614 | |
2615 | |
2616 | |
2617 | bool mergeExtParameterInfo( |
2618 | const FunctionProtoType *FirstFnType, |
2619 | const FunctionProtoType *SecondFnType, |
2620 | bool &CanUseFirst, bool &CanUseSecond, |
2621 | SmallVectorImpl<FunctionProtoType::ExtParameterInfo> &NewParamInfos); |
2622 | |
2623 | void ResetObjCLayout(const ObjCContainerDecl *CD); |
2624 | |
2625 | |
2626 | |
2627 | |
2628 | |
2629 | |
2630 | |
2631 | unsigned getIntWidth(QualType T) const; |
2632 | |
2633 | |
2634 | |
2635 | |
2636 | |
2637 | |
2638 | |
2639 | QualType getCorrespondingUnsignedType(QualType T) const; |
2640 | |
2641 | |
2642 | |
2643 | QualType getCorrespondingSaturatedType(QualType Ty) const; |
2644 | |
2645 | |
2646 | |
2647 | |
2648 | |
2649 | QualType getCorrespondingSignedFixedPointType(QualType Ty) const; |
2650 | |
2651 | |
2652 | |
2653 | |
2654 | |
2655 | |
2656 | |
2657 | llvm::APSInt MakeIntValue(uint64_t Value, QualType Type) const { |
2658 | |
2659 | |
2660 | llvm::APSInt Res(64, !Type->isSignedIntegerOrEnumerationType()); |
2661 | Res = Value; |
2662 | unsigned Width = getIntWidth(Type); |
2663 | if (Width != Res.getBitWidth()) |
2664 | return Res.extOrTrunc(Width); |
2665 | return Res; |
2666 | } |
2667 | |
2668 | bool isSentinelNullExpr(const Expr *E); |
2669 | |
2670 | |
2671 | |
2672 | ObjCImplementationDecl *getObjCImplementation(ObjCInterfaceDecl *D); |
2673 | |
2674 | |
2675 | |
2676 | ObjCCategoryImplDecl *getObjCImplementation(ObjCCategoryDecl *D); |
2677 | |
2678 | |
2679 | bool AnyObjCImplementation() { |
2680 | return !ObjCImpls.empty(); |
2681 | } |
2682 | |
2683 | |
2684 | void setObjCImplementation(ObjCInterfaceDecl *IFaceD, |
2685 | ObjCImplementationDecl *ImplD); |
2686 | |
2687 | |
2688 | void setObjCImplementation(ObjCCategoryDecl *CatD, |
2689 | ObjCCategoryImplDecl *ImplD); |
2690 | |
2691 | |
2692 | |
2693 | const ObjCMethodDecl * |
2694 | getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const; |
2695 | |
2696 | void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, |
2697 | const ObjCMethodDecl *Redecl); |
2698 | |
2699 | |
2700 | |
2701 | |
2702 | const ObjCInterfaceDecl *getObjContainingInterface(const NamedDecl *ND) const; |
2703 | |
2704 | |
2705 | |
2706 | void setBlockVarCopyInit(const VarDecl* VD, Expr *CopyExpr, bool CanThrow); |
2707 | |
2708 | |
2709 | |
2710 | BlockVarCopyInit getBlockVarCopyInit(const VarDecl* VD) const; |
2711 | |
2712 | |
2713 | |
2714 | |
2715 | |
2716 | |
2717 | |
2718 | |
2719 | |
2720 | |
2721 | |
2722 | |
2723 | TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const; |
2724 | |
2725 | |
2726 | |
2727 | |
2728 | TypeSourceInfo * |
2729 | getTrivialTypeSourceInfo(QualType T, |
2730 | SourceLocation Loc = SourceLocation()) const; |
2731 | |
2732 | |
2733 | |
2734 | |
2735 | |
2736 | |
2737 | |
2738 | |
2739 | void AddDeallocation(void (*Callback)(void*), void *Data); |
2740 | |
2741 | |
2742 | |
2743 | template <typename T> |
2744 | void addDestruction(T *Ptr) { |
2745 | if (!std::is_trivially_destructible<T>::value) { |
2746 | auto DestroyPtr = [](void *V) { static_cast<T *>(V)->~T(); }; |
2747 | AddDeallocation(DestroyPtr, Ptr); |
2748 | } |
2749 | } |
2750 | |
2751 | GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const; |
2752 | GVALinkage GetGVALinkageForVariable(const VarDecl *VD); |
2753 | |
2754 | |
2755 | |
2756 | |
2757 | |
2758 | |
2759 | |
2760 | bool DeclMustBeEmitted(const Decl *D); |
2761 | |
2762 | |
2763 | |
2764 | void forEachMultiversionedFunctionVersion( |
2765 | const FunctionDecl *FD, |
2766 | llvm::function_ref<void(FunctionDecl *)> Pred) const; |
2767 | |
2768 | const CXXConstructorDecl * |
2769 | getCopyConstructorForExceptionObject(CXXRecordDecl *RD); |
2770 | |
2771 | void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, |
2772 | CXXConstructorDecl *CD); |
2773 | |
2774 | void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND); |
2775 | |
2776 | TypedefNameDecl *getTypedefNameForUnnamedTagDecl(const TagDecl *TD); |
2777 | |
2778 | void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD); |
2779 | |
2780 | DeclaratorDecl *getDeclaratorForUnnamedTagDecl(const TagDecl *TD); |
2781 | |
2782 | void setManglingNumber(const NamedDecl *ND, unsigned Number); |
2783 | unsigned getManglingNumber(const NamedDecl *ND) const; |
2784 | |
2785 | void setStaticLocalNumber(const VarDecl *VD, unsigned Number); |
2786 | unsigned getStaticLocalNumber(const VarDecl *VD) const; |
2787 | |
2788 | |
2789 | |
2790 | MangleNumberingContext &getManglingNumberContext(const DeclContext *DC); |
2791 | |
2792 | std::unique_ptr<MangleNumberingContext> createMangleNumberingContext() const; |
2793 | |
2794 | |
2795 | |
2796 | void setParameterIndex(const ParmVarDecl *D, unsigned index); |
2797 | |
2798 | |
2799 | |
2800 | unsigned getParameterIndex(const ParmVarDecl *D) const; |
2801 | |
2802 | |
2803 | |
2804 | APValue *getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, |
2805 | bool MayCreate); |
2806 | |
2807 | |
2808 | |
2809 | |
2810 | |
2811 | |
2812 | unsigned NumImplicitDefaultConstructors = 0; |
2813 | |
2814 | |
2815 | |
2816 | unsigned NumImplicitDefaultConstructorsDeclared = 0; |
2817 | |
2818 | |
2819 | unsigned NumImplicitCopyConstructors = 0; |
2820 | |
2821 | |
2822 | |
2823 | unsigned NumImplicitCopyConstructorsDeclared = 0; |
2824 | |
2825 | |
2826 | unsigned NumImplicitMoveConstructors = 0; |
2827 | |
2828 | |
2829 | |
2830 | unsigned NumImplicitMoveConstructorsDeclared = 0; |
2831 | |
2832 | |
2833 | unsigned NumImplicitCopyAssignmentOperators = 0; |
2834 | |
2835 | |
2836 | |
2837 | unsigned NumImplicitCopyAssignmentOperatorsDeclared = 0; |
2838 | |
2839 | |
2840 | unsigned NumImplicitMoveAssignmentOperators = 0; |
2841 | |
2842 | |
2843 | |
2844 | unsigned NumImplicitMoveAssignmentOperatorsDeclared = 0; |
2845 | |
2846 | |
2847 | unsigned NumImplicitDestructors = 0; |
2848 | |
2849 | |
2850 | |
2851 | unsigned NumImplicitDestructorsDeclared = 0; |
2852 | |
2853 | public: |
2854 | |
2855 | |
2856 | |
2857 | |
2858 | |
2859 | |
2860 | void InitBuiltinTypes(const TargetInfo &Target, |
2861 | const TargetInfo *AuxTarget = nullptr); |
2862 | |
2863 | private: |
2864 | void InitBuiltinType(CanQualType &R, BuiltinType::Kind K); |
2865 | |
2866 | |
2867 | void getObjCEncodingForTypeImpl(QualType t, std::string &S, |
2868 | bool ExpandPointedToStructures, |
2869 | bool ExpandStructures, |
2870 | const FieldDecl *Field, |
2871 | bool OutermostType = false, |
2872 | bool EncodingProperty = false, |
2873 | bool StructField = false, |
2874 | bool EncodeBlockParameters = false, |
2875 | bool EncodeClassNames = false, |
2876 | bool EncodePointerToObjCTypedef = false, |
2877 | QualType *NotEncodedT=nullptr) const; |
2878 | |
2879 | |
2880 | void getObjCEncodingForStructureImpl(RecordDecl *RD, std::string &S, |
2881 | const FieldDecl *Field, |
2882 | bool includeVBases = true, |
2883 | QualType *NotEncodedT=nullptr) const; |
2884 | |
2885 | public: |
2886 | |
2887 | void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, |
2888 | QualType T, std::string& S, |
2889 | bool Extended) const; |
2890 | |
2891 | |
2892 | |
2893 | bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const; |
2894 | |
2895 | enum class InlineVariableDefinitionKind { |
2896 | |
2897 | None, |
2898 | |
2899 | |
2900 | Weak, |
2901 | |
2902 | |
2903 | WeakUnknown, |
2904 | |
2905 | |
2906 | Strong |
2907 | }; |
2908 | |
2909 | |
2910 | |
2911 | |
2912 | |
2913 | |
2914 | InlineVariableDefinitionKind |
2915 | getInlineVariableDefinitionKind(const VarDecl *VD) const; |
2916 | |
2917 | private: |
2918 | friend class DeclarationNameTable; |
2919 | friend class DeclContext; |
2920 | |
2921 | const ASTRecordLayout & |
2922 | getObjCLayout(const ObjCInterfaceDecl *D, |
2923 | const ObjCImplementationDecl *Impl) const; |
2924 | |
2925 | |
2926 | |
2927 | |
2928 | |
2929 | |
2930 | |
2931 | |
2932 | |
2933 | using DeallocationFunctionsAndArguments = |
2934 | llvm::SmallVector<std::pair<void (*)(void *), void *>, 16>; |
2935 | DeallocationFunctionsAndArguments Deallocations; |
2936 | |
2937 | |
2938 | |
2939 | |
2940 | llvm::PointerIntPair<StoredDeclsMap *, 1> LastSDM; |
2941 | |
2942 | std::vector<Decl *> TraversalScope; |
2943 | class ParentMap; |
2944 | std::unique_ptr<ParentMap> Parents; |
2945 | |
2946 | std::unique_ptr<VTableContextBase> VTContext; |
2947 | |
2948 | void ReleaseDeclContextMaps(); |
2949 | |
2950 | public: |
2951 | enum PragmaSectionFlag : unsigned { |
2952 | PSF_None = 0, |
2953 | PSF_Read = 0x1, |
2954 | PSF_Write = 0x2, |
2955 | PSF_Execute = 0x4, |
2956 | PSF_Implicit = 0x8, |
2957 | PSF_Invalid = 0x80000000U, |
2958 | }; |
2959 | |
2960 | struct SectionInfo { |
2961 | DeclaratorDecl *Decl; |
2962 | SourceLocation PragmaSectionLocation; |
2963 | int SectionFlags; |
2964 | |
2965 | SectionInfo() = default; |
2966 | SectionInfo(DeclaratorDecl *Decl, |
2967 | SourceLocation PragmaSectionLocation, |
2968 | int SectionFlags) |
2969 | : Decl(Decl), PragmaSectionLocation(PragmaSectionLocation), |
2970 | SectionFlags(SectionFlags) {} |
2971 | }; |
2972 | |
2973 | llvm::StringMap<SectionInfo> SectionInfos; |
2974 | }; |
2975 | |
2976 | |
2977 | inline Selector GetNullarySelector(StringRef name, ASTContext &Ctx) { |
2978 | IdentifierInfo* II = &Ctx.Idents.get(name); |
2979 | return Ctx.Selectors.getSelector(0, &II); |
2980 | } |
2981 | |
2982 | |
2983 | inline Selector GetUnarySelector(StringRef name, ASTContext &Ctx) { |
2984 | IdentifierInfo* II = &Ctx.Idents.get(name); |
2985 | return Ctx.Selectors.getSelector(1, &II); |
2986 | } |
2987 | |
2988 | } |
2989 | |
2990 | |
2991 | |
2992 | |
2993 | |
2994 | |
2995 | |
2996 | |
2997 | |
2998 | |
2999 | |
3000 | |
3001 | |
3002 | |
3003 | |
3004 | |
3005 | |
3006 | |
3007 | |
3008 | |
3009 | |
3010 | |
3011 | |
3012 | |
3013 | |
3014 | |
3015 | |
3016 | |
3017 | |
3018 | |
3019 | |
3020 | inline void *operator new(size_t Bytes, const clang::ASTContext &C, |
3021 | size_t Alignment ) { |
3022 | return C.Allocate(Bytes, Alignment); |
3023 | } |
3024 | |
3025 | |
3026 | |
3027 | |
3028 | |
3029 | |
3030 | |
3031 | inline void operator delete(void *Ptr, const clang::ASTContext &C, size_t) { |
3032 | C.Deallocate(Ptr); |
3033 | } |
3034 | |
3035 | |
3036 | |
3037 | |
3038 | |
3039 | |
3040 | |
3041 | |
3042 | |
3043 | |
3044 | |
3045 | |
3046 | |
3047 | |
3048 | |
3049 | |
3050 | |
3051 | |
3052 | |
3053 | |
3054 | |
3055 | |
3056 | |
3057 | |
3058 | inline void *operator new[](size_t Bytes, const clang::ASTContext& C, |
3059 | size_t Alignment ) { |
3060 | return C.Allocate(Bytes, Alignment); |
3061 | } |
3062 | |
3063 | |
3064 | |
3065 | |
3066 | |
3067 | |
3068 | |
3069 | inline void operator delete[](void *Ptr, const clang::ASTContext &C, size_t) { |
3070 | C.Deallocate(Ptr); |
3071 | } |
3072 | |
3073 | |
3074 | template <typename Owner, typename T, |
3075 | void (clang::ExternalASTSource::*Update)(Owner)> |
3076 | typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType |
3077 | clang::LazyGenerationalUpdatePtr<Owner, T, Update>::makeValue( |
3078 | const clang::ASTContext &Ctx, T Value) { |
3079 | |
3080 | |
3081 | |
3082 | if (auto *Source = Ctx.getExternalSource()) |
3083 | return new (Ctx) LazyData(Source, Value); |
3084 | return Value; |
3085 | } |
3086 | |
3087 | #endif |
3088 | |