]> granicus.if.org Git - clang/commitdiff
DebugInfo: Rename CreatePointerType to getOrCreateTypeDeclaration
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 24 May 2013 21:33:22 +0000 (21:33 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 24 May 2013 21:33:22 +0000 (21:33 +0000)
To make this more consistent with 'getOrCreateType' & clarify the
distinction between the two. The only thing I couldn't quite communicate
in the name is that getOrCreateTypeDeclaration may actually produce a
full definition (in -fno-limit-debug-info) but the point is to call it
whenever only a declaration is needed & the implementation can choose
whether to provide a declaration or definition.

(also, unfortunately, getOrCreateType can produce declarations too - we
should sure this up by making it not do that - any caller that can
tolerate a declaration should be calling getOrCreateTypeDeclaration
instead)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182674 91177308-0d34-0410-b5e6-96231b3b80d8

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

index e5c3a053b5007ce3378def42740ed76094d5f96e..c1d095ddd6c62fc5a0cbeecd511b688b92671317 100644 (file)
@@ -607,10 +607,10 @@ llvm::DIDescriptor CGDebugInfo::createContextChain(const Decl *Context) {
   return TheCU;
 }
 
-/// CreatePointeeType - Create Pointee type. If Pointee is a record
+/// getOrCreateTypeDeclaration - Create Pointee type. If Pointee is a record
 /// then emit record's fwd if debug info size reduction is enabled.
-llvm::DIType CGDebugInfo::CreatePointeeType(QualType PointeeTy,
-                                            llvm::DIFile Unit) {
+llvm::DIType CGDebugInfo::getOrCreateTypeDeclaration(QualType PointeeTy,
+                                                     llvm::DIFile Unit) {
   if (DebugKind > CodeGenOptions::LimitedDebugInfo)
     return getOrCreateType(PointeeTy, Unit);
 
@@ -642,8 +642,8 @@ llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag,
                                                 llvm::DIFile Unit) {
   if (Tag == llvm::dwarf::DW_TAG_reference_type ||
       Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
-    return DBuilder.createReferenceType(Tag,
-                                        CreatePointeeType(PointeeTy, Unit));
+    return DBuilder.createReferenceType(
+        Tag, getOrCreateTypeDeclaration(PointeeTy, Unit));
 
   // Bit size, align and offset of the type.
   // Size is always the size of a pointer. We can't use getTypeSize here
@@ -652,7 +652,7 @@ llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag,
   uint64_t Size = CGM.getTarget().getPointerWidth(AS);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
-  return DBuilder.createPointerType(CreatePointeeType(PointeeTy, Unit),
+  return DBuilder.createPointerType(getOrCreateTypeDeclaration(PointeeTy, Unit),
                                     Size, Align);
 }
 
@@ -733,7 +733,8 @@ llvm::DIType CGDebugInfo::CreateType(const BlockPointerType *Ty,
 llvm::DIType CGDebugInfo::CreateType(const TypedefType *Ty, llvm::DIFile Unit) {
   // Typedefs are derived from some other type.  If we have a typedef of a
   // typedef, make sure to emit the whole chain.
-  llvm::DIType Src = CreatePointeeType(Ty->getDecl()->getUnderlyingType(), Unit);
+  llvm::DIType Src =
+      getOrCreateTypeDeclaration(Ty->getDecl()->getUnderlyingType(), Unit);
   if (!Src.Verify())
     return llvm::DIType();
   // We don't set size information, but do specify where the typedef was
@@ -1727,7 +1728,7 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty,
   llvm::DIType ClassType = getOrCreateType(QualType(Ty->getClass(), 0), U);
   if (!Ty->getPointeeType()->isFunctionType())
     return DBuilder.createMemberPointerType(
-        CreatePointeeType(Ty->getPointeeType(), U), ClassType);
+        getOrCreateTypeDeclaration(Ty->getPointeeType(), U), ClassType);
   return DBuilder.createMemberPointerType(getOrCreateInstanceMethodType(
       CGM.getContext().getPointerType(
           QualType(Ty->getClass(), Ty->getPointeeType().getCVRQualifiers())),
@@ -2198,7 +2199,8 @@ llvm::DIDescriptor CGDebugInfo::getDeclarationOrDefinition(const Decl *D) {
   // in unlimited debug info)
   if (const TypeDecl *TD = dyn_cast<TypeDecl>(D)) {
     llvm::DIFile DefUnit = getOrCreateFile(TD->getLocation());
-    return CreatePointeeType(CGM.getContext().getTypeDeclType(TD), DefUnit);
+    return getOrCreateTypeDeclaration(CGM.getContext().getTypeDeclType(TD),
+                                      DefUnit);
   }
   // Otherwise fall back to a fairly rudimentary cache of existing declarations.
   // This doesn't handle providing declarations (for functions or variables) for
index 3f3d95745a30c232d99927f28c206d324a833491..cee96f6d9df25744cc77ca09ab5053f71e45aa65 100644 (file)
@@ -137,7 +137,7 @@ class CGDebugInfo {
                                                 llvm::DIFile F);
   llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
   llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
-  llvm::DIType CreatePointeeType(QualType PointeeTy, llvm::DIFile F);
+  llvm::DIType getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile F);
   llvm::DIType CreatePointerLikeType(unsigned Tag,
                                      const Type *Ty, QualType PointeeTy,
                                      llvm::DIFile F);