mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 09:00:33 +03:00

Previously, the transitory state only needed and valid during generation of the LLVM IR for the function body was conflated with the general codegen metadata for the function declaration in IrFunction. There is further potential for cleanup regarding the use of gIR->func() and so on all over the code base, but this is out of scope of this commit, which is only concerned with those IrFunction members moved to FuncGenState. GitHub: Fixes #1661.
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
//===-- gen/nested.h - Nested context handling ------------------*- C++ -*-===//
|
||
//
|
||
// LDC – the LLVM D compiler
|
||
//
|
||
// This file is distributed under the BSD-style LDC license. See the LICENSE
|
||
// file for details.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
//
|
||
// Functions for creating nested contexts for nested D types/functions and
|
||
// extracting the values from them.
|
||
//
|
||
//===----------------------------------------------------------------------===//
|
||
|
||
#ifndef LDC_GEN_NESTED_H
|
||
#define LDC_GEN_NESTED_H
|
||
|
||
#include "declaration.h"
|
||
#include "mtype.h"
|
||
#include "gen/dvalue.h"
|
||
#include "gen/llvm.h"
|
||
|
||
///////////////////////////////////////////////////////////
|
||
// Nested variable and context helpers
|
||
///////////////////////////////////////////////////////////
|
||
|
||
class FuncGenState;
|
||
|
||
/// Creates the nested struct alloca for the current function (if there are any
|
||
/// nested references to its variables).
|
||
void DtoCreateNestedContext(FuncGenState &funcGen);
|
||
|
||
/// Resolves the nested context for classes and structs with arbitrary nesting.
|
||
void DtoResolveNestedContext(Loc &loc, AggregateDeclaration *decl,
|
||
LLValue *value);
|
||
|
||
/// Gets the context value for a call to a nested function or creating a nested
|
||
/// class or struct with arbitrary nesting.
|
||
llvm::Value *DtoNestedContext(Loc &loc, Dsymbol *sym);
|
||
|
||
/// Gets the DValue of a nested variable with arbitrary nesting.
|
||
DValue *DtoNestedVariable(Loc &loc, Type *astype, VarDeclaration *vd,
|
||
bool byref = false);
|
||
|
||
#endif
|