Skip to content

Commit 9fd0831

Browse files
committed
Clang-format DebugTypeInfo.h (NFC)
1 parent c44931e commit 9fd0831

File tree

1 file changed

+86
-89
lines changed

1 file changed

+86
-89
lines changed

lib/IRGen/DebugTypeInfo.h

Lines changed: 86 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -18,106 +18,103 @@
1818
#ifndef SWIFT_IRGEN_DEBUGTYPEINFO_H
1919
#define SWIFT_IRGEN_DEBUGTYPEINFO_H
2020

21-
#include "swift/AST/Types.h"
22-
#include "swift/AST/Decl.h"
2321
#include "IRGen.h"
22+
#include "swift/AST/Decl.h"
23+
#include "swift/AST/Types.h"
2424

2525
namespace llvm {
26-
class Type;
26+
class Type;
2727
}
2828

2929
namespace swift {
30-
class SILDebugScope;
31-
32-
namespace irgen {
33-
class TypeInfo;
34-
35-
/// This data structure holds everything needed to emit debug info
36-
/// for a type.
37-
class DebugTypeInfo {
38-
public:
39-
/// The Decl holds the DeclContext, location, but also allows to
40-
/// look up struct members. If there is no Decl, generic types
41-
/// mandate there be at least a DeclContext.
42-
PointerUnion<ValueDecl*, DeclContext*> DeclOrContext;
43-
/// The type we need to emit may be different from the type
44-
/// mentioned in the Decl, for example, stripped of qualifiers.
45-
TypeBase *Type;
46-
/// Needed to determine the size of basic types and to determine
47-
/// the storage type for undefined variables.
48-
llvm::Type *StorageType;
49-
Size size;
50-
Alignment align;
51-
52-
DebugTypeInfo()
53-
: Type(nullptr), StorageType(nullptr), size(0), align(1) {}
54-
DebugTypeInfo(swift::Type Ty, llvm::Type *StorageTy,
55-
uint64_t SizeInBytes, uint32_t AlignInBytes,
56-
DeclContext *DC);
57-
DebugTypeInfo(swift::Type Ty, llvm::Type *StorageTy,
58-
Size size, Alignment align, DeclContext *DC);
59-
DebugTypeInfo(swift::Type Ty, const TypeInfo &Info, DeclContext *DC);
60-
DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info);
61-
DebugTypeInfo(ValueDecl *Decl, llvm::Type *StorageType,
62-
Size size, Alignment align);
63-
DebugTypeInfo(ValueDecl *Decl, swift::Type Ty, const TypeInfo &Info);
64-
TypeBase* getType() const { return Type; }
65-
66-
ValueDecl* getDecl() const {
67-
return DeclOrContext.dyn_cast<ValueDecl*>();
68-
}
69-
70-
DeclContext *getDeclContext() const {
71-
if (ValueDecl *D = getDecl()) return D->getDeclContext();
72-
else return DeclOrContext.get<DeclContext*>();
73-
}
74-
75-
void unwrapLValueOrInOutType() {
76-
Type = Type->getLValueOrInOutObjectType().getPointer();
77-
}
78-
79-
// Determine whether this type is an Archetype itself.
80-
bool isArchetype() const {
81-
return Type->getLValueOrInOutObjectType()->getKind() ==
82-
TypeKind::Archetype;
83-
}
84-
85-
/// LValues, inout args, and Archetypes are implicitly indirect by
86-
/// virtue of their DWARF type.
87-
bool isImplicitlyIndirect() const {
88-
return Type->isLValueType() || isArchetype() ||
89-
(Type->getKind() == TypeKind::InOut);
90-
}
91-
92-
bool isNull() const { return Type == nullptr; }
93-
bool operator==(DebugTypeInfo T) const;
94-
bool operator!=(DebugTypeInfo T) const;
95-
96-
void dump() const;
97-
};
30+
class SILDebugScope;
31+
32+
namespace irgen {
33+
class TypeInfo;
34+
35+
/// This data structure holds everything needed to emit debug info
36+
/// for a type.
37+
class DebugTypeInfo {
38+
public:
39+
/// The Decl holds the DeclContext, location, but also allows to
40+
/// look up struct members. If there is no Decl, generic types
41+
/// mandate there be at least a DeclContext.
42+
PointerUnion<ValueDecl *, DeclContext *> DeclOrContext;
43+
/// The type we need to emit may be different from the type
44+
/// mentioned in the Decl, for example, stripped of qualifiers.
45+
TypeBase *Type;
46+
/// Needed to determine the size of basic types and to determine
47+
/// the storage type for undefined variables.
48+
llvm::Type *StorageType;
49+
Size size;
50+
Alignment align;
51+
52+
DebugTypeInfo() : Type(nullptr), StorageType(nullptr), size(0), align(1) {}
53+
DebugTypeInfo(swift::Type Ty, llvm::Type *StorageTy, uint64_t SizeInBytes,
54+
uint32_t AlignInBytes, DeclContext *DC);
55+
DebugTypeInfo(swift::Type Ty, llvm::Type *StorageTy, Size size,
56+
Alignment align, DeclContext *DC);
57+
DebugTypeInfo(swift::Type Ty, const TypeInfo &Info, DeclContext *DC);
58+
DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info);
59+
DebugTypeInfo(ValueDecl *Decl, llvm::Type *StorageType, Size size,
60+
Alignment align);
61+
DebugTypeInfo(ValueDecl *Decl, swift::Type Ty, const TypeInfo &Info);
62+
TypeBase *getType() const { return Type; }
63+
64+
ValueDecl *getDecl() const { return DeclOrContext.dyn_cast<ValueDecl *>(); }
65+
66+
DeclContext *getDeclContext() const {
67+
if (ValueDecl *D = getDecl())
68+
return D->getDeclContext();
69+
else
70+
return DeclOrContext.get<DeclContext *>();
71+
}
72+
73+
void unwrapLValueOrInOutType() {
74+
Type = Type->getLValueOrInOutObjectType().getPointer();
75+
}
76+
77+
// Determine whether this type is an Archetype itself.
78+
bool isArchetype() const {
79+
return Type->getLValueOrInOutObjectType()->getKind() == TypeKind::Archetype;
80+
}
81+
82+
/// LValues, inout args, and Archetypes are implicitly indirect by
83+
/// virtue of their DWARF type.
84+
bool isImplicitlyIndirect() const {
85+
return Type->isLValueType() || isArchetype() ||
86+
(Type->getKind() == TypeKind::InOut);
9887
}
88+
89+
bool isNull() const { return Type == nullptr; }
90+
bool operator==(DebugTypeInfo T) const;
91+
bool operator!=(DebugTypeInfo T) const;
92+
93+
void dump() const;
94+
};
95+
}
9996
}
10097

10198
namespace llvm {
10299

103-
// Dense map specialization.
104-
template<> struct DenseMapInfo<swift::irgen::DebugTypeInfo> {
105-
static swift::irgen::DebugTypeInfo getEmptyKey() {
106-
return swift::irgen::DebugTypeInfo();
107-
}
108-
static swift::irgen::DebugTypeInfo getTombstoneKey() {
109-
return swift::irgen::DebugTypeInfo(llvm::DenseMapInfo<swift::TypeBase*>
110-
::getTombstoneKey(), nullptr, 0, 0, 0);
111-
}
112-
static unsigned getHashValue(swift::irgen::DebugTypeInfo Val) {
113-
return DenseMapInfo<swift::CanType>::getHashValue(Val.getType());
114-
}
115-
static bool isEqual(swift::irgen::DebugTypeInfo LHS,
116-
swift::irgen::DebugTypeInfo RHS) {
117-
return LHS == RHS;
118-
}
119-
};
120-
100+
// Dense map specialization.
101+
template <> struct DenseMapInfo<swift::irgen::DebugTypeInfo> {
102+
static swift::irgen::DebugTypeInfo getEmptyKey() {
103+
return swift::irgen::DebugTypeInfo();
104+
}
105+
static swift::irgen::DebugTypeInfo getTombstoneKey() {
106+
return swift::irgen::DebugTypeInfo(
107+
llvm::DenseMapInfo<swift::TypeBase *>::getTombstoneKey(), nullptr, 0, 0,
108+
0);
109+
}
110+
static unsigned getHashValue(swift::irgen::DebugTypeInfo Val) {
111+
return DenseMapInfo<swift::CanType>::getHashValue(Val.getType());
112+
}
113+
static bool isEqual(swift::irgen::DebugTypeInfo LHS,
114+
swift::irgen::DebugTypeInfo RHS) {
115+
return LHS == RHS;
116+
}
117+
};
121118
}
122119

123120
#endif

0 commit comments

Comments
 (0)