Revert "more code cleanup." Accidentally committed too much.

This reverts commit 4e476a57689da4acf3e3dd5d5e385b18b57d571c.

Swift SVN r8117
This commit is contained in:
Adrian Prantl
2013-09-11 22:57:50 +00:00
parent b287c3417e
commit b9ac293046
3 changed files with 5 additions and 8 deletions

View File

@@ -24,13 +24,11 @@ using namespace irgen;
DebugTypeInfo::DebugTypeInfo(Type Ty, uint64_t Size, uint64_t Align) DebugTypeInfo::DebugTypeInfo(Type Ty, uint64_t Size, uint64_t Align)
: DeclOrType(Ty.getPointer()), SizeInBytes(Size), AlignInBytes(Align) { : DeclOrType(Ty.getPointer()), SizeInBytes(Size), AlignInBytes(Align) {
assert(AlignInBytes != 0);
} }
DebugTypeInfo::DebugTypeInfo(Type Ty, Size Size, Alignment Align) DebugTypeInfo::DebugTypeInfo(Type Ty, Size Size, Alignment Align)
: DeclOrType(Ty.getPointer()), : DeclOrType(Ty.getPointer()),
SizeInBytes(Size.getValue()), AlignInBytes(Align.getValue()) { SizeInBytes(Size.getValue()), AlignInBytes(Align.getValue()) {
assert(AlignInBytes != 0);
} }
DebugTypeInfo::DebugTypeInfo(Type Ty, const TypeInfo &Info) DebugTypeInfo::DebugTypeInfo(Type Ty, const TypeInfo &Info)
@@ -40,7 +38,6 @@ DebugTypeInfo::DebugTypeInfo(Type Ty, const TypeInfo &Info)
SizeInBytes = FixTy.getFixedSize().getValue(); SizeInBytes = FixTy.getFixedSize().getValue();
AlignInBytes = FixTy.getBestKnownAlignment().getValue(); AlignInBytes = FixTy.getBestKnownAlignment().getValue();
} }
assert(AlignInBytes != 0);
} }
DebugTypeInfo::DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info) DebugTypeInfo::DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info)
@@ -51,14 +48,12 @@ DebugTypeInfo::DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info)
SizeInBytes = FixTy.getFixedSize().getValue(); SizeInBytes = FixTy.getFixedSize().getValue();
AlignInBytes = FixTy.getBestKnownAlignment().getValue(); AlignInBytes = FixTy.getBestKnownAlignment().getValue();
} }
assert(AlignInBytes != 0);
} }
DebugTypeInfo::DebugTypeInfo(ValueDecl *Decl, Size Size, Alignment Align) DebugTypeInfo::DebugTypeInfo(ValueDecl *Decl, Size Size, Alignment Align)
: DeclOrType(Decl), : DeclOrType(Decl),
SizeInBytes(Size.getValue()), SizeInBytes(Size.getValue()),
AlignInBytes(Align.getValue()) { AlignInBytes(Align.getValue()) {
assert(AlignInBytes != 0);
} }
static bool typesEqual(Type A, Type B) { static bool typesEqual(Type A, Type B) {

View File

@@ -38,18 +38,19 @@ namespace swift {
public: public:
/// Every Decl also has a type, but is otherwise preferred. /// Every Decl also has a type, but is otherwise preferred.
PointerUnion<ValueDecl*, TypeBase*> DeclOrType; PointerUnion<ValueDecl*, TypeBase*> DeclOrType;
//DeclContext *DeclContext;
uint64_t SizeInBytes; uint64_t SizeInBytes;
uint64_t AlignInBytes; uint64_t AlignInBytes;
DebugTypeInfo() DebugTypeInfo()
: SizeInBytes(0), AlignInBytes(1) { : SizeInBytes(0), AlignInBytes(0) {
} }
DebugTypeInfo(Type Ty, uint64_t Size, uint64_t Align); DebugTypeInfo(Type Ty, uint64_t Size, uint64_t Align);
DebugTypeInfo(Type Ty, Size Size, Alignment Align); DebugTypeInfo(Type Ty, Size Size, Alignment Align);
DebugTypeInfo(Type Ty, const TypeInfo &Info); DebugTypeInfo(Type Ty, const TypeInfo &Info);
DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info); DebugTypeInfo(ValueDecl *Decl, const TypeInfo &Info);
DebugTypeInfo(ValueDecl *Decl, Size Size, Alignment Align); DebugTypeInfo(ValueDecl *Decl, Size Size, Alignment Align);
inline TypeBase* getHash() const { return getType(); } inline TypeBase* getHash() const { return getType(); } //Ty.getPointer(); }
inline TypeBase* getType() const { inline TypeBase* getType() const {
if (DeclOrType.isNull()) if (DeclOrType.isNull())
return nullptr; return nullptr;

View File

@@ -46,7 +46,8 @@ void SILFunction::setDeclContext(Decl *D) {
} }
void SILFunction::setDeclContext(Expr *E) { void SILFunction::setDeclContext(Expr *E) {
DeclCtx = dyn_cast_or_null<CapturingExpr>(E); if (!E) return;
DeclCtx = dyn_cast<CapturingExpr>(E);
} }
ASTContext &SILFunction::getASTContext() const { ASTContext &SILFunction::getASTContext() const {