]> granicus.if.org Git - clang/commitdiff
DebugInfo: Make CGDebugInfo::getStaticDataMemberDeclaration's argument type match...
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 15 Aug 2013 21:42:43 +0000 (21:42 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 15 Aug 2013 21:42:43 +0000 (21:42 +0000)
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

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h

index 6ba0bac2f56a1d3ace2f5a9b73b9eee79402e586..bdc60fb4183a516b031f025ce9da29b41b3a4ac6 100644 (file)
@@ -3002,8 +3002,8 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block,
 /// 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 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
   // 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)));
 }
 
index 72d956ed3737813332a2c89ad9980828b4372231..f17d47ad37c2bafa1a8e7c5db78f01dedba6c98c 100644 (file)
@@ -357,7 +357,7 @@ private:
   /// getStaticDataMemberDeclaration - Return debug info descriptor to
   /// describe in-class static data member declaration for the given
   /// out-of-class definition.
-  llvm::DIDerivedType getStaticDataMemberDeclaration(const Decl *D);
+  llvm::DIDerivedType getStaticDataMemberDeclaration(const VarDecl *D);
 
   /// getFunctionName - Get function name for the given FunctionDecl. If the
   /// name is constructred on demand (e.g. C++ destructor) then the name