mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
Debug info: for extern(D) functions whose order of explicit arguments gets reversed, set the calling convention to DW_CC_D_dmd.
DW_CC_D_dmd is set to the first available value according to https://gcc.gnu.org/wiki/GNUDwarfExtensions. A GDB patch to handle this calling convention is being proposed.
This commit is contained in:
parent
c4114da5da
commit
dcad25d6fd
1 changed files with 10 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
|||
#include "gen/optimizer.h"
|
||||
#include "ir/irfunction.h"
|
||||
#include "ir/irmodule.h"
|
||||
#include "ir/irfuncty.h"
|
||||
#include "ir/irtypeaggr.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
|
@ -660,6 +661,8 @@ ldc::DIType ldc::DIBuilder::CreateAArrayType(Type *type) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const unsigned DW_CC_D_dmd = 0x43; // new calling convention constant being proposed as a Dwarf extension
|
||||
|
||||
ldc::DISubroutineType ldc::DIBuilder::CreateFunctionType(Type *type) {
|
||||
assert(type->toBasetype()->ty == Tfunction);
|
||||
|
||||
|
@ -670,7 +673,13 @@ ldc::DISubroutineType ldc::DIBuilder::CreateFunctionType(Type *type) {
|
|||
LLMetadata *params = {CreateTypeDescription(retType)};
|
||||
auto paramsArray = DBuilder.getOrCreateTypeArray(params);
|
||||
|
||||
return DBuilder.createSubroutineType(paramsArray);
|
||||
// The calling convention has to be recorded to distinguish
|
||||
// extern(D) functions from extern(C++) ones.
|
||||
DtoType(t);
|
||||
assert(t->ctype);
|
||||
unsigned CC = t->ctype->getIrFuncTy().reverseParams ? DW_CC_D_dmd : 0;
|
||||
|
||||
return DBuilder.createSubroutineType(paramsArray, DIFlagZero, CC);
|
||||
}
|
||||
|
||||
ldc::DISubroutineType ldc::DIBuilder::CreateEmptyFunctionType() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue