Files
swift-mirror/include/swift/AST/MacroDiscriminatorContext.h
Doug Gregor 72ddbebc08 [Macros] Assign macro expansion discriminators more lazily.
This is a punt. They'll be unique, and they'll be per-context, but
they'll be lazy and therefore not stable.
2023-01-25 22:03:38 -08:00

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