Files
carbon-lang/executable_semantics/common/ptr.h
T
Jon Meow ff319d311a Switch Ptr to a C++ pointer using the nonnull attribute (#831)
The advantage is a C++ pointer is special, and this approach eliminates the Ptr class type that was causing problems in conversions. Attribute suggestion was courtesy of chandlerc. We're sticking with the Ptr name because it's shorter than Nonnull, and we're likely to keep this in lots of places.
2021-09-16 13:05:25 -07:00

17 lines
507 B
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef EXECUTABLE_SEMANTICS_COMMON_PTR_H_
#define EXECUTABLE_SEMANTICS_COMMON_PTR_H_
namespace Carbon {
// A non-nullable pointer. Written as `Ptr<T>` instead of `T*`.
template <typename T>
using Ptr = T* _Nonnull __attribute__((nonnull));
} // namespace Carbon
#endif // EXECUTABLE_SEMANTICS_COMMON_PTR_H_