mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 19:55:11 +00:00
Support conversion from T* to const T*. (#5971)
Also support conversion from Derived* to const Base*. --------- Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
This commit is contained in:
1 parent
ad84e71acd
commit
30b8a93fde
10 files changed
+580
-315
No files matched your search
@@ -136,6 +136,16 @@ auto GetConstType(Context& context, SemIR::TypeInstId inner_type_id)
|
||||
return GetTypeImpl<SemIR::ConstType>(context, inner_type_id);
|
||||
}
|
||||
|
||||
auto GetQualifiedType(Context& context, SemIR::TypeId type_id,
|
||||
SemIR::TypeQualifiers quals) -> SemIR::TypeId {
|
||||
if ((quals & SemIR::TypeQualifiers::Const) != SemIR::TypeQualifiers::None) {
|
||||
type_id = GetConstType(context, context.types().GetInstId(type_id));
|
||||
quals &= ~SemIR::TypeQualifiers::Const;
|
||||
}
|
||||
CARBON_CHECK(quals == SemIR::TypeQualifiers::None);
|
||||
return type_id;
|
||||
}
|
||||
|
||||
auto GetSingletonType(Context& context, SemIR::TypeInstId singleton_id)
|
||||
-> SemIR::TypeId {
|
||||
CARBON_CHECK(SemIR::IsSingletonInstId(singleton_id));
|
||||
|
||||
Reference in new issue
Block a user