mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Since libDemangling is included in the Swift standard library, ODR violations can occur on platforms that allow statically linking stdlib if Swift code is linked with other compiler libraries that also transitively pull in libDemangling, and if the stdlib version and compiler version do not match exactly (even down to commit drift between releases). This lets the runtime conditionally segregate its copies of the libDemangling symbols from those in the compiler using an inline namespace without affecting usage throughout source.
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
//===--- NamespaceMacros.h - Macros for inline namespaces -------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Macros that conditionally define an inline namespace so that symbols used in
|
|
// multiple places (such as in the compiler and in the runtime library) can be
|
|
// given distinct mangled names in different contexts without affecting client
|
|
// usage in source.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_DEMANGLING_NAMESPACE_MACROS_H
|
|
#define SWIFT_DEMANGLING_NAMESPACE_MACROS_H
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#if defined(SWIFT_INLINE_NAMESPACE)
|
|
#define SWIFT_BEGIN_INLINE_NAMESPACE inline namespace SWIFT_INLINE_NAMESPACE {
|
|
#define SWIFT_END_INLINE_NAMESPACE }
|
|
#else
|
|
#define SWIFT_BEGIN_INLINE_NAMESPACE
|
|
#define SWIFT_END_INLINE_NAMESPACE
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif // SWIFT_DEMANGLING_NAMESPACE_MACROS_H
|