r188498 - DebugInfo: Split out the implementation of getStaticDataMemberDeclaration for future use

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Aug 16 03:38:44 PDT 2013


I've reverted this in r188539 to un-break the build.

On Fri, Aug 16, 2013 at 12:40 PM, Evgeniy Stepanov
<eugeni.stepanov at gmail.com> wrote:
> Hi,
>
> this broke linux cmake bootstrap build with
> -DCMAKE_BUILD_TYPE=Release
> -DLLVM_ENABLE_ASSERTIONS=ON
> -DLLVM_ENABLE_WERROR=ON
>
> Reproducer attached.
>
> $ bin/clang -g -c 1.ii
> A static data member declaration should be available at this point
> UNREACHABLE executed at ../tools/clang/lib/CodeGen/CGDebugInfo.cpp:3018!
>
>
> On Fri, Aug 16, 2013 at 2:30 AM, David Blaikie <dblaikie at gmail.com> wrote:
>> Author: dblaikie
>> Date: Thu Aug 15 17:30:23 2013
>> New Revision: 188498
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=188498&view=rev
>> Log:
>> DebugInfo: Split out the implementation of getStaticDataMemberDeclaration for future use
>>
>> Modified:
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>     cfe/trunk/lib/CodeGen/CGDebugInfo.h
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=188498&r1=188497&r2=188498&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Aug 15 17:30:23 2013
>> @@ -2998,19 +2998,25 @@ void CGDebugInfo::EmitDeclareOfBlockLite
>>    DbgDecl->setDebugLoc(llvm::DebugLoc::get(line, column, scope));
>>  }
>>
>> -/// 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 VarDecl *D) {
>> -  if (D->isStaticDataMember()) {
>> -    llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator
>> -      MI = StaticDataMemberCache.find(D->getCanonicalDecl());
>> -    if (MI != StaticDataMemberCache.end())
>> -      // Verify the info still exists.
>> -      if (llvm::Value *V = MI->second)
>> -        return llvm::DIDerivedType(cast<llvm::MDNode>(V));
>> -  }
>> -  return llvm::DIDerivedType();
>> +/// 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::getStaticDataMemberDeclarationOrNull(const VarDecl *D) {
>> +  if (!D->isStaticDataMember())
>> +    return llvm::DIDerivedType();
>> +  return getStaticDataMemberDeclaration(D);
>> +}
>> +
>> +llvm::DIDerivedType
>> +CGDebugInfo::getStaticDataMemberDeclaration(const VarDecl *D) {
>> +  llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator
>> +    MI = StaticDataMemberCache.find(D->getCanonicalDecl());
>> +  if (MI != StaticDataMemberCache.end())
>> +    // Verify the info still exists.
>> +    if (llvm::Value *V = MI->second)
>> +      return llvm::DIDerivedType(cast<llvm::MDNode>(V));
>> +  llvm_unreachable(
>> +      "A static data member declaration should be available at this point");
>>  }
>>
>>  /// EmitGlobalVariable - Emit information about a global variable.
>> @@ -3042,11 +3048,9 @@ void CGDebugInfo::EmitGlobalVariable(llv
>>      LinkageName = StringRef();
>>    llvm::DIDescriptor DContext =
>>      getContextDescriptor(dyn_cast<Decl>(D->getDeclContext()));
>> -  llvm::DIGlobalVariable GV =
>> -      DBuilder.createStaticVariable(DContext, DeclName, LinkageName, Unit,
>> -                                    LineNo, getOrCreateType(T, Unit),
>> -                                    Var->hasInternalLinkage(), Var,
>> -                                    getStaticDataMemberDeclaration(D));
>> +  llvm::DIGlobalVariable GV = DBuilder.createStaticVariable(
>> +      DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit),
>> +      Var->hasInternalLinkage(), Var, getStaticDataMemberDeclarationOrNull(D));
>>    DeclCache.insert(std::make_pair(D->getCanonicalDecl(), llvm::WeakVH(GV)));
>>  }
>>
>> @@ -3094,7 +3098,7 @@ void CGDebugInfo::EmitGlobalVariable(con
>>      return;
>>    llvm::DIGlobalVariable GV = DBuilder.createStaticVariable(
>>        Unit, Name, Name, Unit, getLineNumber(VD->getLocation()), Ty, true, Init,
>> -      getStaticDataMemberDeclaration(cast<VarDecl>(VD)));
>> +      getStaticDataMemberDeclarationOrNull(cast<VarDecl>(VD)));
>>    DeclCache.insert(std::make_pair(VD->getCanonicalDecl(), llvm::WeakVH(GV)));
>>  }
>>
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=188498&r1=188497&r2=188498&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Aug 15 17:30:23 2013
>> @@ -357,6 +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 getStaticDataMemberDeclarationOrNull(const VarDecl *D);
>>    llvm::DIDerivedType getStaticDataMemberDeclaration(const VarDecl *D);
>>
>>    /// getFunctionName - Get function name for the given FunctionDecl. If the
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list