aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorChih-Ping Chen <chih-ping.chen@intel.com>2021-11-03 16:44:00 -0400
committerChih-Ping Chen <chih-ping.chen@intel.com>2021-11-09 13:18:07 -0500
commitcf0e32d197d3fe6c7294b95eab5c7519ccdad164 (patch)
tree82f4dcceea3f17a845cc4d0d8cea701c204285c2 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parenta4ba780510518150cc11b330bbd2beb447e1f50e (diff)
downloadllvm-cf0e32d197d3fe6c7294b95eab5c7519ccdad164.zip
llvm-cf0e32d197d3fe6c7294b95eab5c7519ccdad164.tar.gz
llvm-cf0e32d197d3fe6c7294b95eab5c7519ccdad164.tar.bz2
[CodeView] Properly handle a DISubprogram in getScopeIndex.
Differential Revision: https://reviews.llvm.org/D113142
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index f997dc8..85ff844 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -341,7 +341,16 @@ std::string CodeViewDebug::getFullyQualifiedName(const DIScope *Ty) {
TypeIndex CodeViewDebug::getScopeIndex(const DIScope *Scope) {
// No scope means global scope and that uses the zero index.
- if (!Scope || isa<DIFile>(Scope))
+ //
+ // We also use zero index when the scope is a DISubprogram
+ // to suppress the emission of LF_STRING_ID for the function,
+ // which can trigger a link-time error with the linker in
+ // VS2019 version 16.11.2 or newer.
+ // Note, however, skipping the debug info emission for the DISubprogram
+ // is a temporary fix. The root issue here is that we need to figure out
+ // the proper way to encode a function nested in another function
+ // (as introduced by the Fortran 'contains' keyword) in CodeView.
+ if (!Scope || isa<DIFile>(Scope) || isa<DISubprogram>(Scope))
return TypeIndex();
assert(!isa<DIType>(Scope) && "shouldn't make a namespace scope for a type");