llvm.org GIT mirror llvm / d4031aa
[CodeView] Use None instead of Void if there is no subprogram git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271566 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 4 years ago
3 changed file(s) with 29 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
102102 uint32_t getIndex() const { return Index; }
103103 bool isSimple() const { return Index < FirstNonSimpleIndex; }
104104
105 bool isNoType() const { return Index == 0; }
105 bool isNoneType() const { return *this == None(); }
106106
107107 SimpleTypeKind getSimpleKind() const {
108108 assert(isSimple());
114114 return static_cast(Index & SimpleModeMask);
115115 }
116116
117 static TypeIndex None() { return TypeIndex(SimpleTypeKind::None); }
117118 static TypeIndex Void() { return TypeIndex(SimpleTypeKind::Void); }
118119 static TypeIndex VoidPointer32() {
119120 return TypeIndex(SimpleTypeKind::Void, SimpleTypeMode::NearPointer32);
156157 static TypeIndex Float32() { return TypeIndex(SimpleTypeKind::Float32); }
157158 static TypeIndex Float64() { return TypeIndex(SimpleTypeKind::Float64); }
158159
160 friend inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
161 return A.getIndex() == B.getIndex();
162 }
163
164 friend inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
165 return A.getIndex() != B.getIndex();
166 }
167
168 friend inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
169 return A.getIndex() < B.getIndex();
170 }
171
172 friend inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
173 return A.getIndex() <= B.getIndex();
174 }
175
176 friend inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
177 return A.getIndex() > B.getIndex();
178 }
179
180 friend inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
181 return A.getIndex() >= B.getIndex();
182 }
183
159184 private:
160185 support::ulittle32_t Index;
161186 };
162187
163 inline bool operator==(const TypeIndex &A, const TypeIndex &B) {
164 return A.getIndex() == B.getIndex();
165 }
166
167 inline bool operator!=(const TypeIndex &A, const TypeIndex &B) {
168 return A.getIndex() != B.getIndex();
169 }
170
171 inline bool operator<(const TypeIndex &A, const TypeIndex &B) {
172 return A.getIndex() < B.getIndex();
173 }
174
175 inline bool operator<=(const TypeIndex &A, const TypeIndex &B) {
176 return A.getIndex() <= B.getIndex();
177 }
178
179 inline bool operator>(const TypeIndex &A, const TypeIndex &B) {
180 return A.getIndex() > B.getIndex();
181 }
182
183 inline bool operator>=(const TypeIndex &A, const TypeIndex &B) {
184 return A.getIndex() >= B.getIndex();
185 }
186188 }
187189 }
188190
125125 // It's possible to ask for the FuncId of a function which doesn't have a
126126 // subprogram: inlining a function with debug info into a function with none.
127127 if (!SP)
128 return TypeIndex::Void();
128 return TypeIndex::None();
129129
130130 // Check if we've already translated this subprogram.
131131 auto I = TypeIndices.find(SP);
640640 }
641641
642642 StringRef CVTypeDumper::getTypeName(TypeIndex TI) {
643 if (TI.isNoType())
643 if (TI.isNoneType())
644644 return "";
645645
646646 if (TI.isSimple()) {
668668
669669 void CVTypeDumper::printTypeIndex(StringRef FieldName, TypeIndex TI) {
670670 StringRef TypeName;
671 if (!TI.isNoType())
671 if (!TI.isNoneType())
672672 TypeName = getTypeName(TI);
673673 if (!TypeName.empty())
674674 W->printHex(FieldName, TypeName, TI.getIndex());