Files
swift-mirror/include/swift/Basic/Compiler.h

41 lines
1.6 KiB
C++

//===--- Compiler.h - Compiler specific definitions -------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 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
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_BASIC_COMPILER_H
#define SWIFT_BASIC_COMPILER_H
#if defined(_MSC_VER) && !defined(__clang__)
#define SWIFT_COMPILER_IS_MSVC 1
#else
#define SWIFT_COMPILER_IS_MSVC 0
#endif
#if SWIFT_COMPILER_IS_MSVC
// Work around MSVC bug: attempting to reference a deleted function
// https://connect.microsoft.com/VisualStudio/feedback/details/3116505
#define SWIFT_DELETE_OPERATOR_DELETED \
{ llvm_unreachable("Delete operator should not be called."); }
// Work around MSVC bug: can't infer llvm::trailing_objects_internal,
// even though we granted friend access to it.
// https://connect.microsoft.com/VisualStudio/feedback/details/3116517
#define SWIFT_TRAILING_OBJECTS_OVERLOAD_TOKEN(TokenType) \
llvm::trailing_objects_internal::TrailingObjectsBase::OverloadToken<TokenType>
#else
#define SWIFT_DELETE_OPERATOR_DELETED = delete;
#define SWIFT_TRAILING_OBJECTS_OVERLOAD_TOKEN(TokenType) \
typename TrailingObjects::template OverloadToken<TokenType>
#endif
#endif // SWIFT_BASIC_COMPILER_H