diff options
| author | Manman Ren <manman.ren@gmail.com> | 2013-08-28 21:20:28 +0000 |
|---|---|---|
| committer | Manman Ren <manman.ren@gmail.com> | 2013-08-28 21:20:28 +0000 |
| commit | 1b45702454241da5f789d1ac29dd45f0d18373b0 (patch) | |
| tree | a48cc4f610d625e6eadd5f97aa75aca53c377140 | |
| parent | 27c22edde44d1aa87458a88cb7f3e8a6ebc3739d (diff) | |
| download | bcm5719-llvm-1b45702454241da5f789d1ac29dd45f0d18373b0.tar.gz bcm5719-llvm-1b45702454241da5f789d1ac29dd45f0d18373b0.zip | |
Debug Info: update interface for CreateEnumType and getOrCreateRecordFwdDecl.
Both functions will take a Type pointer instead of a Decl pointer. This helps
with follow-up type uniquing patches, which need the Type pointer to call
CXX mangler to generate unique identifiers.
No functionality change.
llvm-svn: 189519
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 4 |
2 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index e1a9ae1a916..6b20b8fa673 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -601,8 +601,9 @@ llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty, // Creates a forward declaration for a RecordDecl in the given context. llvm::DICompositeType -CGDebugInfo::getOrCreateRecordFwdDecl(const RecordDecl *RD, +CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty, llvm::DIDescriptor Ctx) { + const RecordDecl *RD = Ty->getDecl(); if (llvm::DIType T = getTypeOrNull(CGM.getContext().getRecordType(RD))) return llvm::DICompositeType(T); llvm::DIFile DefUnit = getOrCreateFile(RD->getLocation()); @@ -1472,7 +1473,7 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty) { (CXXDecl && CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())) { llvm::DIDescriptor FDContext = getContextDescriptor(cast<Decl>(RD->getDeclContext())); - llvm::DIType RetTy = getOrCreateRecordFwdDecl(RD, FDContext); + llvm::DIType RetTy = getOrCreateRecordFwdDecl(Ty, FDContext); // FIXME: This is conservatively correct. If we return a non-forward decl // that's not a full definition (such as those created by // createContextChain) then getOrCreateType will record is as a complete @@ -1861,7 +1862,8 @@ llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty, } /// CreateEnumType - get enumeration type. -llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED) { +llvm::DIType CGDebugInfo::CreateEnumType(const EnumType* Ty) { + const EnumDecl *ED = Ty->getDecl(); uint64_t Size = 0; uint64_t Align = 0; if (!ED->getTypeForDecl()->isIncompleteType()) { @@ -2144,7 +2146,7 @@ llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty, llvm::DIFile Unit) { case Type::Record: return CreateType(cast<RecordType>(Ty)); case Type::Enum: - return CreateEnumType(cast<EnumType>(Ty)->getDecl()); + return CreateEnumType(cast<EnumType>(Ty)); case Type::FunctionProto: case Type::FunctionNoProto: return CreateType(cast<FunctionType>(Ty), Unit); @@ -2249,7 +2251,7 @@ llvm::DICompositeType CGDebugInfo::CreateLimitedType(const RecordType *Ty) { // If this is just a forward declaration, construct an appropriately // marked node and just return it. if (!RD->getDefinition()) - return getOrCreateRecordFwdDecl(RD, RDContext); + return getOrCreateRecordFwdDecl(Ty, RDContext); uint64_t Size = CGM.getContext().getTypeSize(Ty); uint64_t Align = CGM.getContext().getTypeAlign(Ty); diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index ac1a94c5449..a8ba14b8b3f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -126,7 +126,7 @@ class CGDebugInfo { llvm::DIType CreateType(const RValueReferenceType *Ty, llvm::DIFile Unit); llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F); llvm::DIType CreateType(const AtomicType *Ty, llvm::DIFile F); - llvm::DIType CreateEnumType(const EnumDecl *ED); + llvm::DIType CreateEnumType(const EnumType *Ty); llvm::DIType CreateSelfType(const QualType &QualTy, llvm::DIType Ty); llvm::DIType getTypeOrNull(const QualType); llvm::DIType getCompletedTypeOrNull(const QualType); @@ -309,7 +309,7 @@ private: llvm::DIScope getCurrentContextDescriptor(const Decl *Decl); /// \brief Create a forward decl for a RecordType in a given context. - llvm::DICompositeType getOrCreateRecordFwdDecl(const RecordDecl *, + llvm::DICompositeType getOrCreateRecordFwdDecl(const RecordType *, llvm::DIDescriptor); /// createContextChain - Create a set of decls for the context chain. |

