diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-10-06 05:18:55 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-10-06 05:18:55 +0000 |
| commit | fd58072675941da0ca25cdaa8cfbb42db1945133 (patch) | |
| tree | 2e8e5794cbe2d85e91c5a795ca52fd32eeb6c91c /clang/lib | |
| parent | 56cfbe841f38c7363314e3328d0df39bd495ff05 (diff) | |
| download | bcm5719-llvm-fd58072675941da0ca25cdaa8cfbb42db1945133.tar.gz bcm5719-llvm-fd58072675941da0ca25cdaa8cfbb42db1945133.zip | |
DebugInfo: Don't include implicit special members in the list of class members
By leaving these members out of the member list, we avoid them being
emitted into type unit definitions - while still allowing the
definition/declaration to be injected into the compile unit as expected.
llvm-svn: 219101
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index a8838f2dd32..f5286ff79a4 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1157,24 +1157,23 @@ CollectCXXMemberFunctions(const CXXRecordDecl *RD, llvm::DIFile Unit, // have templated functions iterate over every declaration to gather // the functions. for(const auto *I : RD->decls()) { - if (const auto *Method = dyn_cast<CXXMethodDecl>(I)) { - // Reuse the existing member function declaration if it exists. - // It may be associated with the declaration of the type & should be - // reused as we're building the definition. - // - // This situation can arise in the vtable-based debug info reduction where - // implicit members are emitted in a non-vtable TU. - llvm::DenseMap<const FunctionDecl *, llvm::WeakVH>::iterator MI = - SPCache.find(Method->getCanonicalDecl()); - if (MI == SPCache.end()) { - // If the member is implicit, lazily create it when we see the - // definition, not before. (an ODR-used implicit default ctor that's - // never actually code generated should not produce debug info) - if (!Method->isImplicit()) - EltTys.push_back(CreateCXXMemberFunction(Method, Unit, RecordTy)); - } else - EltTys.push_back(MI->second); - } + const auto *Method = dyn_cast<CXXMethodDecl>(I); + // If the member is implicit, don't add it to the member list. This avoids + // the member being added to type units by LLVM, while still allowing it + // to be emitted into the type declaration/reference inside the compile + // unit. + if (!Method || Method->isImplicit()) + continue; + // Reuse the existing member function declaration if it exists. + // It may be associated with the declaration of the type & should be + // reused as we're building the definition. + // + // This situation can arise in the vtable-based debug info reduction where + // implicit members are emitted in a non-vtable TU. + auto MI = SPCache.find(Method->getCanonicalDecl()); + EltTys.push_back(MI == SPCache.end() + ? CreateCXXMemberFunction(Method, Unit, RecordTy) + : MI->second); } } |

