1 // Copyright 2021 The Tint Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include "src/sem/atomic_type.h" 16 17 #include "src/program_builder.h" 18 #include "src/sem/reference_type.h" 19 20 TINT_INSTANTIATE_TYPEINFO(tint::sem::Atomic); 21 22 namespace tint { 23 namespace sem { 24 Atomic(const sem::Type * subtype)25Atomic::Atomic(const sem::Type* subtype) : subtype_(subtype) { 26 TINT_ASSERT(AST, !subtype->Is<Reference>()); 27 } 28 type_name() const29std::string Atomic::type_name() const { 30 std::ostringstream out; 31 out << "__atomic" << subtype_->type_name(); 32 return out.str(); 33 } 34 FriendlyName(const SymbolTable & symbols) const35std::string Atomic::FriendlyName(const SymbolTable& symbols) const { 36 std::ostringstream out; 37 out << "atomic<" << subtype_->FriendlyName(symbols) << ">"; 38 return out.str(); 39 } 40 Size() const41uint32_t Atomic::Size() const { 42 return subtype_->Size(); 43 } 44 Align() const45uint32_t Atomic::Align() const { 46 return subtype_->Align(); 47 } 48 IsConstructible() const49bool Atomic::IsConstructible() const { 50 return false; 51 } 52 53 Atomic::Atomic(Atomic&&) = default; 54 55 Atomic::~Atomic() = default; 56 57 } // namespace sem 58 } // namespace tint 59