mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This replaces a number of `#include`-s like this:
```
#include "../../../stdlib/public/SwiftShims/Visibility.h"
```
with this:
```
#include "swift/shims/Visibility.h"
```
This is needed to allow SwiftCompilerSources to use C++ headers which include SwiftShims headers. Currently trying to do that results in errors:
```
swift/swift/include/swift/Demangling/../../../stdlib/public/SwiftShims/module.modulemap:1:8: error: redefinition of module 'SwiftShims'
module SwiftShims {
^
Builds.noindex/swift/swift/bootstrapping0/lib/swift/shims/module.modulemap:1:8: note: previously defined here
module SwiftShims {
^
```
This happens because the headers in both the source dir and the build dir refer to SwiftShims headers by relative path, and both the source root and the build root contain SwiftShims headers (which are equivalent, but since they are located in different dirs, Clang treats them as different modules).
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
//===--- Errors.h - Demangling library error handling -----------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2022 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file exists because not every client links to libswiftCore (the
|
|
// runtime), so calling swift::fatalError() or swift::warning() from within
|
|
// the demangler is not an option.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_DEMANGLING_ERRORS_H
|
|
#define SWIFT_DEMANGLING_ERRORS_H
|
|
|
|
#include "swift/Demangling/NamespaceMacros.h"
|
|
#include "swift/shims/Visibility.h"
|
|
#include <inttypes.h>
|
|
#include <stdarg.h>
|
|
|
|
#ifndef SWIFT_FORMAT
|
|
// SWIFT_FORMAT(fmt,first) marks a function as taking a format string argument
|
|
// at argument `fmt`, with the first argument for the format string as `first`.
|
|
#if __has_attribute(format)
|
|
#define SWIFT_FORMAT(fmt, first) __attribute__((format(printf, fmt, first)))
|
|
#else
|
|
#define SWIFT_FORMAT(fmt, first)
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef SWIFT_VFORMAT
|
|
// SWIFT_VFORMAT(fmt) marks a function as taking a format string argument at
|
|
// argument `fmt`, with the arguments in a `va_list`.
|
|
#if __has_attribute(format)
|
|
#define SWIFT_VFORMAT(fmt) __attribute__((format(printf, fmt, 0)))
|
|
#else
|
|
#define SWIFT_VFORMAT(fmt)
|
|
#endif
|
|
#endif
|
|
|
|
namespace swift {
|
|
namespace Demangle {
|
|
SWIFT_BEGIN_INLINE_NAMESPACE
|
|
|
|
SWIFT_NORETURN SWIFT_FORMAT(2, 3) void fatal(uint32_t flags, const char *format,
|
|
...);
|
|
SWIFT_FORMAT(2, 3) void warn(uint32_t flags, const char *format, ...);
|
|
|
|
SWIFT_NORETURN SWIFT_VFORMAT(2) void fatalv(uint32_t flags, const char *format,
|
|
va_list val);
|
|
SWIFT_VFORMAT(2) void warnv(uint32_t flags, const char *format, va_list val);
|
|
|
|
SWIFT_END_INLINE_NAMESPACE
|
|
} // end namespace Demangle
|
|
} // end namespace swift
|
|
|
|
#endif // SWIFT_DEMANGLING_DEMANGLE_H
|