clang 8.0.0

Classes | Public Member Functions | List of all members
clang::LayoutOverrideSource Class Reference

An external AST source that overrides the layout of a specified set of record types. More...

`#include "clang/Frontend/LayoutOverrideSource.h"`

Inheritance diagram for clang::LayoutOverrideSource:
[legend]
Collaboration diagram for clang::LayoutOverrideSource:
[legend]

## Public Member Functions
| LayoutOverrideSource (StringRef Filename)
| Create a new AST source that overrides the layout of some set of record types. More...
bool | layoutRecordType (const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &BaseOffsets, llvm::DenseMap< const CXXRecordDecl *, CharUnits > &VirtualBaseOffsets) override
| If this particular record type has an overridden layout, return that layout. More...
void | dump ()
| Dump the overridden layouts. More...
Public Member Functions inherited from clang::ExternalASTSource
| ExternalASTSource ()=default
virtual | ~ExternalASTSource ()
uint32_t | getGeneration () const
| Get the current generation of this AST source. More...
virtual Decl * | GetExternalDecl (uint32_t ID)
| Resolve a declaration ID into a declaration, potentially building a new declaration. More...
virtual Selector | GetExternalSelector (uint32_t ID)
| Resolve a selector ID into a selector. More...
virtual uint32_t | GetNumExternalSelectors ()
| Returns the number of selectors known to the external AST source. More...
virtual Stmt * | GetExternalDeclStmt (uint64_t Offset)
| Resolve the offset of a statement in the decl stream into a statement. More...
virtual CXXCtorInitializer ** | GetExternalCXXCtorInitializers (uint64_t Offset)
| Resolve the offset of a set of C++ constructor initializers in the decl stream into an array of initializers. More...
virtual CXXBaseSpecifier * | GetExternalCXXBaseSpecifiers (uint64_t Offset)
| Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers. More...
virtual void | updateOutOfDateIdentifier (IdentifierInfo &II)
| Update an out-of-date identifier. More...
virtual bool | FindExternalVisibleDeclsByName (const DeclContext *DC, DeclarationName Name)
| Find all declarations with the given name in the given context, and add them to the context by calling SetExternalVisibleDeclsForName or SetNoExternalVisibleDeclsForName. More...
virtual void | completeVisibleDeclsMap (const DeclContext *DC)
| Ensures that the table of all visible declarations inside this context is up to date. More...
virtual Module * | getModule (unsigned ID)
| Retrieve the module that corresponds to the given module ID. More...
virtual bool | DeclIsFromPCHWithObjectFile (const Decl *D)
| Determine whether D comes from a PCH which was built with a corresponding object file. More...
virtual llvm::Optional< ASTSourceDescriptor > | getSourceDescriptor (unsigned ID)
| Return a descriptor for the corresponding module, if one exists. More...
virtual ExtKind | hasExternalDefinitions (const Decl *D)
virtual void | FindExternalLexicalDecls (const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl *> &Result)
| Finds all declarations lexically contained within the given DeclContext, after applying an optional filter predicate. More...
void | FindExternalLexicalDecls (const DeclContext *DC, SmallVectorImpl< Decl *> &Result)
| Finds all declarations lexically contained within the given DeclContext. More...
virtual void | FindFileRegionDecls (FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl *> &Decls)
| Get the decls that are contained in a file in the Offset/Length range. More...
virtual void | CompleteRedeclChain (const Decl *D)
| Gives the external AST source an opportunity to complete the redeclaration chain for a declaration. More...
virtual void | CompleteType (TagDecl *Tag)
| Gives the external AST source an opportunity to complete an incomplete type. More...
virtual void | CompleteType (ObjCInterfaceDecl *Class)
| Gives the external AST source an opportunity to complete an incomplete Objective-C class. More...
virtual void | ReadComments ()
| Loads comment ranges. More...
virtual void | StartedDeserializing ()
| Notify ExternalASTSource that we started deserialization of a decl or type so until FinishedDeserializing is called there may be decls that are initializing. More...
virtual void | FinishedDeserializing ()
| Notify ExternalASTSource that we finished the deserialization of a decl or type. More...
virtual void | StartTranslationUnit (ASTConsumer *Consumer)
| Function that will be invoked when we begin parsing a new translation unit involving this external AST source. More...
virtual void | PrintStats ()
| Print any statistics that have been gathered regarding the external AST source. More...
MemoryBufferSizes | getMemoryBufferSizes () const
| Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory. More...
virtual void | getMemoryBufferSizes (MemoryBufferSizes &sizes) const

## Additional Inherited Members
Public Types inherited from clang::ExternalASTSource
enum | ExtKind { EK_Always, EK_Never, EK_ReplyHazy }
Protected Member Functions inherited from clang::ExternalASTSource
uint32_t | incrementGeneration (ASTContext &C)
| Increment the current generation. More...
Static Protected Member Functions inherited from clang::ExternalASTSource
static DeclContextLookupResult | SetExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name, ArrayRef< NamedDecl *> Decls)
static DeclContextLookupResult | SetNoExternalVisibleDeclsForName (const DeclContext *DC, DeclarationName Name)

## Detailed Description

An external AST source that overrides the layout of a specified set of record types.

This class is used only for testing the ability of external AST sources to override the layout of record types. Its input is the output format of the command-line argument -fdump-record-layouts.

Definition at line 25 of file LayoutOverrideSource.h.

## Constructor & Destructor Documentation

## ◆ LayoutOverrideSource()

LayoutOverrideSource::LayoutOverrideSource | ( | StringRef | Filename | ) |
| explicit

Create a new AST source that overrides the layout of some set of record types.

The file is the result of passing -fdump-record-layouts to a file.

Definition at line 30 of file LayoutOverrideSource.cpp.

References clang::isDigit(), clang::isWhitespace(), Line, Offset, and parseName().

## Member Function Documentation

## ◆ dump()

LLVM_DUMP_METHOD void LayoutOverrideSource::dump | ( |  | ) |

Dump the overridden layouts.

Definition at line 191 of file LayoutOverrideSource.cpp.

## ◆ layoutRecordType()

bool LayoutOverrideSource::layoutRecordType | ( | const RecordDecl * | Record,
|  | uint64_t & | Size,
|  | uint64_t & | Alignment,
|  | llvm::DenseMap< const FieldDecl *, uint64_t > & | FieldOffsets,
|  | llvm::DenseMap< const CXXRecordDecl *, CharUnits > & | BaseOffsets,
|  | llvm::DenseMap< const CXXRecordDecl *, CharUnits > & | VirtualBaseOffsets
| ) |  |
| override virtual

If this particular record type has an overridden layout, return that layout.

Reimplemented from clang::ExternalASTSource.

Definition at line 156 of file LayoutOverrideSource.cpp.

References clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::NamedDecl::getIdentifier(), and clang::NamedDecl::getName().

The documentation for this class was generated from the following files:

- include/clang/Frontend/LayoutOverrideSource.h
- lib/Frontend/LayoutOverrideSource.cpp