diff options
| -rw-r--r-- | include/cps/TypeSystem.h | 8 | ||||
| -rw-r--r-- | lib/CodeGen/TypeSystem.cc | 9 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/cps/TypeSystem.h b/include/cps/TypeSystem.h index 69283bc..5f9af63 100644 --- a/include/cps/TypeSystem.h +++ b/include/cps/TypeSystem.h @@ -123,9 +123,10 @@ class TypeSystem { std::function<bool(const std::string &)> Visible; std::function<const TypeInfo *(const std::string &)> ResolveMiss; void registerBuiltins(); - const TypeInfo *registerType(const std::string &TypeName, - llvm::Type *LLVMType, - TypeKind Kind); + TypeInfo *registerType(const std::string &TypeName, + llvm::Type *LLVMType, + TypeKind Kind); + const TypeInfo *importCType(const std::string &Expression, std::string &Err); public: explicit TypeSystem(llvm::LLVMContext &Ctx); @@ -151,7 +152,6 @@ public: std::string &Err); bool defineCAlias(const std::string &Name, const std::string &Expression, std::string &Err); - const TypeInfo *importCType(const std::string &Expression, std::string &Err); bool sameType(const std::string &Left, const std::string &Right) const; const TypeInfo *promoteCScalar(const TypeInfo *Info) const; const TypeInfo *commonCScalar(const TypeInfo *Left, const TypeInfo *Right) const; diff --git a/lib/CodeGen/TypeSystem.cc b/lib/CodeGen/TypeSystem.cc index 7763d35..a84200b 100644 --- a/lib/CodeGen/TypeSystem.cc +++ b/lib/CodeGen/TypeSystem.cc @@ -111,9 +111,9 @@ const TypeInfo *TypeSystem::resolve(const std::string &TypeName) const { return &It->second; } -const TypeInfo *TypeSystem::registerType(const std::string &TypeName, - Type *LLVMType, - TypeKind Kind) { +TypeInfo *TypeSystem::registerType(const std::string &TypeName, + Type *LLVMType, + TypeKind Kind) { TypeInfo Info; Info.Name = TypeName; Info.LLVMType = LLVMType; @@ -150,8 +150,7 @@ bool TypeSystem::declareUserType(const std::string &Name, TypeKind Kind, std::st return false; } - registerType(Name, LLVMType, Kind); - Types.find(Name)->second.IsClass = IsClass; + registerType(Name, LLVMType, Kind)->IsClass = IsClass; return true; } |
