DebugInfo: Make CGDebugInfo::getStaticDataMemberDeclaration's argument type match the semantics
Rather than having a cast immediately inside the function, push that
type requirement out to the callers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188492 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 6ba0bac..bdc60fb 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -3002,8 +3002,8 @@
/// getStaticDataMemberDeclaration - If D is an out-of-class definition of
/// a static data member of a class, find its corresponding in-class
/// declaration.
-llvm::DIDerivedType CGDebugInfo::getStaticDataMemberDeclaration(const Decl *D) {
- if (cast<VarDecl>(D)->isStaticDataMember()) {
+llvm::DIDerivedType CGDebugInfo::getStaticDataMemberDeclaration(const VarDecl *D) {
+ if (D->isStaticDataMember()) {
llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator
MI = StaticDataMemberCache.find(D->getCanonicalDecl());
if (MI != StaticDataMemberCache.end())
@@ -3093,10 +3093,9 @@
// Do not use DIGlobalVariable for enums.
if (Ty.getTag() == llvm::dwarf::DW_TAG_enumeration_type)
return;
- llvm::DIGlobalVariable GV =
- DBuilder.createStaticVariable(Unit, Name, Name, Unit,
- getLineNumber(VD->getLocation()), Ty, true,
- Init, getStaticDataMemberDeclaration(VD));
+ llvm::DIGlobalVariable GV = DBuilder.createStaticVariable(
+ Unit, Name, Name, Unit, getLineNumber(VD->getLocation()), Ty, true, Init,
+ getStaticDataMemberDeclaration(cast<VarDecl>(VD)));
DeclCache.insert(std::make_pair(VD->getCanonicalDecl(), llvm::WeakVH(GV)));
}