Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] fix declaration does not match definition when enable classic flang #176

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions llvm/lib/IR/DIBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,13 +725,21 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, bool isDefined,
DIExpression *Expr, MDNode *Decl, MDTuple *TemplateParams,
DINode::DIFlags Flags, uint32_t AlignInBits, DINodeArray Annotations) {
#ifdef ENABLE_CLASSIC_FLANG
DINode::DIFlags Flags,
#endif
uint32_t AlignInBits, DINodeArray Annotations) {
checkGlobalVariableScope(Context);

auto *GV = DIGlobalVariable::getDistinct(
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
LineNumber, Ty, IsLocalToUnit, isDefined,
cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags,
cast_or_null<DIDerivedType>(Decl), TemplateParams,
#ifdef ENABLE_CLASSIC_FLANG
Flags,
#else
DINode::FlagZero,
#endif
AlignInBits, Annotations);
if (!Expr)
Expr = createExpression();
Expand All @@ -743,13 +751,22 @@ DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
unsigned LineNumber, DIType *Ty, bool IsLocalToUnit, MDNode *Decl,
MDTuple *TemplateParams, DINode::DIFlags Flags, uint32_t AlignInBits) {
MDTuple *TemplateParams,
#ifdef ENABLE_CLASSIC_FLANG
DINode::DIFlags Flags,
#endif
uint32_t AlignInBits) {
checkGlobalVariableScope(Context);

return DIGlobalVariable::getTemporary(
VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
LineNumber, Ty, IsLocalToUnit, false,
cast_or_null<DIDerivedType>(Decl), TemplateParams, Flags,
cast_or_null<DIDerivedType>(Decl), TemplateParams,
#ifdef ENABLE_CLASSIC_FLANG
Flags,
#else
DINode::FlagZero,
#endif
AlignInBits, nullptr)
.release();
}
Expand Down
11 changes: 9 additions & 2 deletions llvm/lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,11 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LinkLen},
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
true, unwrap<DIExpression>(Expr), unwrapDI<MDNode>(Decl),
nullptr, map_from_llvmDIFlags(Flags), AlignInBits));
nullptr,
#ifdef ENABLE_CLASSIC_FLANG
map_from_llvmDIFlags(Flags),
#endif
AlignInBits));
}

LLVMMetadataRef LLVMDIGlobalVariableExpressionGetVariable(LLVMMetadataRef GVE) {
Expand Down Expand Up @@ -1602,7 +1606,10 @@ LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
return wrap(unwrap(Builder)->createTempGlobalVariableFwdDecl(
unwrapDI<DIScope>(Scope), {Name, NameLen}, {Linkage, LnkLen},
unwrapDI<DIFile>(File), LineNo, unwrapDI<DIType>(Ty), LocalToUnit,
unwrapDI<MDNode>(Decl), nullptr, map_from_llvmDIFlags(Flags),
unwrapDI<MDNode>(Decl), nullptr,
#ifdef ENABLE_CLASSIC_FLANG
map_from_llvmDIFlags(Flags),
#endif
AlignInBits));
}

Expand Down
Loading