Skip to content

Commit 266fa2a

Browse files
committed
[Debug Info] Sink type alias check into DbgTy.isForwardDecl (NFC)
1 parent ed71c20 commit 266fa2a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/IRGen/DebugTypeInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ TypeDecl *DebugTypeInfo::getDecl() const {
193193
return nullptr;
194194
}
195195

196+
bool DebugTypeInfo::isForwardDecl() const {
197+
return isNull() || (!FragmentStorageType && !isa<TypeAliasType>(getType()));
198+
}
199+
196200
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
197201
LLVM_DUMP_METHOD void DebugTypeInfo::dump() const {
198202
llvm::errs() << "[";
@@ -203,7 +207,8 @@ LLVM_DUMP_METHOD void DebugTypeInfo::dump() const {
203207
if (FragmentStorageType) {
204208
llvm::errs() << "FragmentStorageType=";
205209
FragmentStorageType->dump();
206-
} else
210+
}
211+
if (isForwardDecl())
207212
llvm::errs() << "forward-declared\n";
208213
}
209214
#endif

lib/IRGen/DebugTypeInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class DebugTypeInfo {
102102

103103
llvm::Type *getFragmentStorageType() const { return FragmentStorageType; }
104104
Alignment getAlignment() const { return Align; }
105-
bool isNull() const { return Type == nullptr; }
106-
bool isForwardDecl() const { return FragmentStorageType == nullptr; }
105+
bool isNull() const { return !Type; }
106+
bool isForwardDecl() const;
107107
bool isMetadataType() const { return IsMetadataType; }
108108
bool hasDefaultAlignment() const { return DefaultAlignment; }
109109
bool isFixedBuffer() const { return IsFixedBuffer; }

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,7 +2511,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
25112511

25122512
// If this is a forward decl, create one for this mangled name and don't
25132513
// cache it.
2514-
if (DbgTy.isForwardDecl() && !isa<TypeAliasType>(DbgTy.getType())) {
2514+
if (DbgTy.isForwardDecl()) {
25152515
// In LTO type uniquing is performed based on the UID. Forward
25162516
// declarations may not have a unique ID to avoid a forward declaration
25172517
// winning over a full definition.

0 commit comments

Comments
 (0)