r181393 - Debug Info: Using declarations/DW_TAG_imported_declaration of variables, types, and functions.

David Blaikie dblaikie at gmail.com
Sun May 12 11:07:31 PDT 2013


On Wed, May 8, 2013 at 1:07 PM, Eric Christopher <echristo at gmail.com> wrote:
>> +llvm::DIDescriptor CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
>> +  if (const TypeDecl *RD = dyn_cast<TypeDecl>(D))
>> +    return CreatePointeeType(QualType(RD->getTypeForDecl(), 0), llvm::DIFile());
>
> CreatePointeeType?

Hopefully I've explained that in comments:

  // We only need a declaration (not a definition) of the type - so use whatever
  // we would otherwise do to get a type for a pointee. (forward declarations in
  // limited debug info, full definitions (if the type definition is available)
  // in unlimited debug info)

>
>> +  llvm::DenseMap<const Decl *, llvm::WeakVH>::iterator I =
>> +      DeclCache.find(D->getCanonicalDecl());
>> +  if (I == DeclCache.end())
>> +    return llvm::DIDescriptor();
>> +  llvm::Value *V = I->second;
>> +  return llvm::DIDescriptor(dyn_cast_or_null<llvm::MDNode>(V));
>
> This block could use a comment, actually if you could comment the decl
> cache stuff in general that would be better.

Not sure how much/wehre more generally you wanted to comment this, but
I've added some comments in r181672.



More information about the cfe-commits mailing list