mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is a punt. They'll be unique, and they'll be per-context, but they'll be lazy and therefore not stable.
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
//===--- MacroDiscriminatorContext.h - Macro Discriminators -----*- 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_AST_MACRO_DISCRIMINATOR_CONTEXT_H
|
|
#define SWIFT_AST_MACRO_DISCRIMINATOR_CONTEXT_H
|
|
|
|
#include "swift/AST/Decl.h"
|
|
#include "swift/AST/Expr.h"
|
|
#include "llvm/ADT/PointerUnion.h"
|
|
|
|
namespace swift {
|
|
|
|
/// Describes the context of a macro expansion for the purpose of
|
|
/// computing macro expansion discriminators.
|
|
struct MacroDiscriminatorContext
|
|
: public llvm::PointerUnion<DeclContext *, MacroExpansionExpr *,
|
|
MacroExpansionDecl *> {
|
|
using PointerUnion::PointerUnion;
|
|
|
|
static MacroDiscriminatorContext getParentOf(MacroExpansionExpr *expansion);
|
|
static MacroDiscriminatorContext getParentOf(MacroExpansionDecl *expansion);
|
|
static MacroDiscriminatorContext getParentOf(
|
|
SourceLoc loc, DeclContext *origDC
|
|
);
|
|
};
|
|
|
|
}
|
|
|
|
#endif // SWIFT_AST_MACRO_DISCRIMINATOR_CONTEXT_H
|