diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 02:33:00 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-30 02:33:00 +0800 |
| commit | 63d2a1c552b0d190a0131c2db2045d154b9ec138 (patch) | |
| tree | 9cd8addea1f49355ec2ecb7669daf12dd4ee61a2 /TypeManager.cc | |
| parent | 56d68765016fc7aa68fe7b522de5e84c7a12123a (diff) | |
support for break, continue and void type
Diffstat (limited to 'TypeManager.cc')
| -rw-r--r-- | TypeManager.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/TypeManager.cc b/TypeManager.cc index 3ce68a1..c4c9c10 100644 --- a/TypeManager.cc +++ b/TypeManager.cc @@ -11,6 +11,12 @@ TypeManager::TypeManager() PointerIndexType_ = GetBuiltinType(BuiltinType::INTEGER); builtins_.push_back( GetPointerType(GetBuiltinType(BuiltinType::CHAR), "string")); + // llvm doesn't have void* type, we use char* instead + PointerTypes_.emplace( + GetBuiltinType(BuiltinType::VOID), + std::make_shared<PointerType>(GetBuiltinType(BuiltinType::CHAR), + PointerDifferenceType_, PointerIndexType_, + "^void")); } std::shared_ptr<Type> TypeManager::GetBuiltinType(BuiltinType type) { @@ -90,7 +96,7 @@ std::pair<std::shared_ptr<Type>, Value> std::shared_ptr<Type> CommonType; if (op == BinaryOperator::REAL_DIV) { // we can only set the CommonType to real for REAL_DIV on builtin types, - // for other types, REAL_DIV and DIV are unavaliable. + // for other types, REAL_DIV and DIV are unavailable. CommonType = builtins_[ToUnderlying(BuiltinType::REAL)]; op = BinaryOperator::DIV; } else if (LeftType != RightType) { |
