r186293 - Move BlockLiteralGeneric earlier in CGDebugInfo and remove

David Blaikie dblaikie at gmail.com
Mon Jul 15 11:36:11 PDT 2013


On Sun, Jul 14, 2013 at 2:12 PM, Eric Christopher <echristo at gmail.com> wrote:
> Author: echristo
> Date: Sun Jul 14 16:12:44 2013
> New Revision: 186293
>
> URL: http://llvm.org/viewvc/llvm-project?rev=186293&view=rev
> Log:
> Move BlockLiteralGeneric earlier in CGDebugInfo and remove
> BlockLiteralGenericSet and replace with a call to isType() on the
> BlockLiteralGeneric.
>
> 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=186293&r1=186292&r2=186293&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Sun Jul 14 16:12:44 2013
> @@ -41,9 +41,8 @@ using namespace clang;
>  using namespace clang::CodeGen;
>
>  CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
> -  : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()),
> -    DBuilder(CGM.getModule()),
> -    BlockLiteralGenericSet(false) {
> +    : CGM(CGM), DebugKind(CGM.getCodeGenOpts().getDebugInfo()),
> +      DBuilder(CGM.getModule()) {
>    CreateCompileUnit();
>  }
>
> @@ -650,7 +649,7 @@ llvm::DIType CGDebugInfo::getOrCreateStr
>
>  llvm::DIType CGDebugInfo::CreateType(const BlockPointerType *Ty,
>                                       llvm::DIFile Unit) {
> -  if (BlockLiteralGenericSet)
> +  if (BlockLiteralGeneric.isType())

Couldn't this just be "if (BlockLiteralGeneric)" ? (triggers the
operator MDNode*, which is null/false when the DI* isn't initialized
with an MDNode*)

>      return BlockLiteralGeneric;
>
>    SmallVector<llvm::Value *, 8> EltTys;
> @@ -706,7 +705,6 @@ llvm::DIType CGDebugInfo::CreateType(con
>                                      Unit, LineNo, FieldOffset, 0,
>                                      Flags, llvm::DIType(), Elements);
>
> -  BlockLiteralGenericSet = true;
>    BlockLiteralGeneric = DBuilder.createPointerType(EltTy, Size);
>    return BlockLiteralGeneric;
>  }
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=186293&r1=186292&r2=186293&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Sun Jul 14 16:12:44 2013
> @@ -60,6 +60,7 @@ class CGDebugInfo {
>    llvm::DIType OCLImage2dDITy, OCLImage2dArrayDITy;
>    llvm::DIType OCLImage3dDITy;
>    llvm::DIType OCLEventDITy;
> +  llvm::DIType BlockLiteralGeneric;
>
>    /// TypeCache - Cache of previously constructed Types.
>    llvm::DenseMap<void *, llvm::WeakVH> TypeCache;
> @@ -79,9 +80,6 @@ class CGDebugInfo {
>    /// compilation.
>    std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap;
>
> -  bool BlockLiteralGenericSet;
> -  llvm::DIType BlockLiteralGeneric;
> -
>    // LexicalBlockStack - Keep track of our current nested lexical block.
>    std::vector<llvm::TrackingVH<llvm::MDNode> > LexicalBlockStack;
>    llvm::DenseMap<const Decl *, llvm::WeakVH> RegionMap;
>
>
> _______________________________________________
> 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