003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/Sema
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
Sema
/
📁
..
📄
AnalysisBasedWarnings.cpp
(83.16 KB)
📄
CodeCompleteConsumer.cpp
(22.58 KB)
📄
CoroutineStmtBuilder.h
(2.34 KB)
📄
DeclSpec.cpp
(52.98 KB)
📄
DelayedDiagnostic.cpp
(2.46 KB)
📄
IdentifierResolver.cpp
(12.75 KB)
📄
JumpDiagnostics.cpp
(37.08 KB)
📄
MultiplexExternalSemaSource.cpp
(11.97 KB)
📄
OpenCLBuiltins.td
(74.48 KB)
📄
ParsedAttr.cpp
(6.91 KB)
📄
Scope.cpp
(6.24 KB)
📄
ScopeInfo.cpp
(8.02 KB)
📄
Sema.cpp
(92.56 KB)
📄
SemaAccess.cpp
(70.03 KB)
📄
SemaAttr.cpp
(39.44 KB)
📄
SemaAvailability.cpp
(35.52 KB)
📄
SemaCUDA.cpp
(32.46 KB)
📄
SemaCXXScopeSpec.cpp
(42.62 KB)
📄
SemaCast.cpp
(117.77 KB)
📄
SemaChecking.cpp
(580.53 KB)
📄
SemaCodeComplete.cpp
(357.59 KB)
📄
SemaConcept.cpp
(41.79 KB)
📄
SemaConsumer.cpp
(464 B)
📄
SemaCoroutine.cpp
(61.87 KB)
📄
SemaDecl.cpp
(711.18 KB)
📄
SemaDeclAttr.cpp
(266.6 KB)
📄
SemaDeclCXX.cpp
(674.92 KB)
📄
SemaDeclObjC.cpp
(208.27 KB)
📄
SemaExceptionSpec.cpp
(58.64 KB)
📄
SemaExpr.cpp
(744.15 KB)
📄
SemaExprCXX.cpp
(343.26 KB)
📄
SemaExprMember.cpp
(73.07 KB)
📄
SemaExprObjC.cpp
(184.87 KB)
📄
SemaFixItUtils.cpp
(7.49 KB)
📄
SemaInit.cpp
(392.01 KB)
📄
SemaLambda.cpp
(80.53 KB)
📄
SemaLookup.cpp
(202.16 KB)
📄
SemaModule.cpp
(27.05 KB)
📄
SemaObjCProperty.cpp
(119.38 KB)
📄
SemaOpenMP.cpp
(760.99 KB)
📄
SemaOverload.cpp
(596.12 KB)
📄
SemaPseudoObject.cpp
(64.4 KB)
📄
SemaSYCL.cpp
(2 KB)
📄
SemaStmt.cpp
(167.23 KB)
📄
SemaStmtAsm.cpp
(36.06 KB)
📄
SemaStmtAttr.cpp
(14.59 KB)
📄
SemaTemplate.cpp
(438.46 KB)
📄
SemaTemplateDeduction.cpp
(247.26 KB)
📄
SemaTemplateInstantiate.cpp
(150.48 KB)
📄
SemaTemplateInstantiateDecl.cpp
(240.7 KB)
📄
SemaTemplateVariadic.cpp
(44.44 KB)
📄
SemaType.cpp
(332.48 KB)
📄
TreeTransform.h
(554.25 KB)
📄
TypeLocBuilder.cpp
(5.17 KB)
📄
TypeLocBuilder.h
(4.5 KB)
📄
UsedDeclVisitor.h
(3.33 KB)
Editing: TypeLocBuilder.h
//===--- TypeLocBuilder.h - Type Source Info collector ----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines TypeLocBuilder, a class for building TypeLocs // bottom-up. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H #define LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H #include "clang/AST/ASTContext.h" #include "clang/AST/TypeLoc.h" namespace clang { class TypeLocBuilder { enum { InlineCapacity = 8 * sizeof(SourceLocation) }; /// The underlying location-data buffer. Data grows from the end /// of the buffer backwards. char *Buffer; /// The capacity of the current buffer. size_t Capacity; /// The index of the first occupied byte in the buffer. size_t Index; #ifndef NDEBUG /// The last type pushed on this builder. QualType LastTy; #endif /// The inline buffer. enum { BufferMaxAlignment = alignof(void *) }; alignas(BufferMaxAlignment) char InlineBuffer[InlineCapacity]; unsigned NumBytesAtAlign4, NumBytesAtAlign8; public: TypeLocBuilder() : Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity), NumBytesAtAlign4(0), NumBytesAtAlign8(0) {} ~TypeLocBuilder() { if (Buffer != InlineBuffer) delete[] Buffer; } /// Ensures that this buffer has at least as much capacity as described. void reserve(size_t Requested) { if (Requested > Capacity) // For now, match the request exactly. grow(Requested); } /// Pushes a copy of the given TypeLoc onto this builder. The builder /// must be empty for this to work. void pushFullCopy(TypeLoc L); /// Pushes space for a typespec TypeLoc. Invalidates any TypeLocs /// previously retrieved from this builder. TypeSpecTypeLoc pushTypeSpec(QualType T) { size_t LocalSize = TypeSpecTypeLoc::LocalDataSize; unsigned LocalAlign = TypeSpecTypeLoc::LocalDataAlignment; return pushImpl(T, LocalSize, LocalAlign).castAs<TypeSpecTypeLoc>(); } /// Resets this builder to the newly-initialized state. void clear() { #ifndef NDEBUG LastTy = QualType(); #endif Index = Capacity; NumBytesAtAlign4 = NumBytesAtAlign8 = 0; } /// Tell the TypeLocBuilder that the type it is storing has been /// modified in some safe way that doesn't affect type-location information. void TypeWasModifiedSafely(QualType T) { #ifndef NDEBUG LastTy = T; #endif } /// Pushes space for a new TypeLoc of the given type. Invalidates /// any TypeLocs previously retrieved from this builder. template <class TyLocType> TyLocType push(QualType T) { TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>(); size_t LocalSize = Loc.getLocalDataSize(); unsigned LocalAlign = Loc.getLocalDataAlignment(); return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>(); } /// Creates a TypeSourceInfo for the given type. TypeSourceInfo *getTypeSourceInfo(ASTContext& Context, QualType T) { #ifndef NDEBUG assert(T == LastTy && "type doesn't match last type pushed!"); #endif size_t FullDataSize = Capacity - Index; TypeSourceInfo *DI = Context.CreateTypeSourceInfo(T, FullDataSize); memcpy(DI->getTypeLoc().getOpaqueData(), &Buffer[Index], FullDataSize); return DI; } /// Copies the type-location information to the given AST context and /// returns a \c TypeLoc referring into the AST context. TypeLoc getTypeLocInContext(ASTContext &Context, QualType T) { #ifndef NDEBUG assert(T == LastTy && "type doesn't match last type pushed!"); #endif size_t FullDataSize = Capacity - Index; void *Mem = Context.Allocate(FullDataSize); memcpy(Mem, &Buffer[Index], FullDataSize); return TypeLoc(T, Mem); } private: TypeLoc pushImpl(QualType T, size_t LocalSize, unsigned LocalAlignment); /// Grow to the given capacity. void grow(size_t NewCapacity); /// Retrieve a temporary TypeLoc that refers into this \c TypeLocBuilder /// object. /// /// The resulting \c TypeLoc should only be used so long as the /// \c TypeLocBuilder is active and has not had more type information /// pushed into it. TypeLoc getTemporaryTypeLoc(QualType T) { #ifndef NDEBUG assert(LastTy == T && "type doesn't match last type pushed!"); #endif return TypeLoc(T, &Buffer[Index]); } }; } #endif
Upload File
Create Folder