//===--- MagicIdentifierKinds.def - Swift #ident metaprogramming -*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 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
//
//===----------------------------------------------------------------------===//
//
// This file defines macros used for macro-metaprogramming with magic
// identifier literals.
//
//===----------------------------------------------------------------------===//

// Used for any magic identifier.
#ifndef MAGIC_IDENTIFIER
#define MAGIC_IDENTIFIER(NAME, STRING)
#endif

// Used for magic identifiers which produce string literals.
#ifndef MAGIC_STRING_IDENTIFIER
#define MAGIC_STRING_IDENTIFIER(NAME, STRING) MAGIC_IDENTIFIER(NAME, STRING)
#endif

// Used for magic identifiers which produce integer literals.
#ifndef MAGIC_INT_IDENTIFIER
#define MAGIC_INT_IDENTIFIER(NAME, STRING) MAGIC_IDENTIFIER(NAME, STRING)
#endif

// Used for magic identifiers which produce raw pointers.
#ifndef MAGIC_POINTER_IDENTIFIER
#define MAGIC_POINTER_IDENTIFIER(NAME, STRING) MAGIC_IDENTIFIER(NAME, STRING)
#endif

// Used when a given token always maps to a particular magic identifier kind.
#ifndef MAGIC_IDENTIFIER_TOKEN
#define MAGIC_IDENTIFIER_TOKEN(NAME, TOKEN)
#endif

//
// Magic string literals
//

/// The \c #fileID magic identifier literal.
MAGIC_STRING_IDENTIFIER(FileID, "#fileID")
  MAGIC_IDENTIFIER_TOKEN(FileID, pound_fileID)

/// The \c #file magic identifier literal, written in code where it is
/// a synonym for \c #fileID (i.e. "Swift 6 mode" code).
MAGIC_STRING_IDENTIFIER(FileIDSpelledAsFile, "#file")
  // tok::pound_file is shared with FilePathSpelledAsFile; please write custom
  // code paths for it.

/// The \c #filePath magic identifier literal.
MAGIC_STRING_IDENTIFIER(FilePath, "#filePath")
  MAGIC_IDENTIFIER_TOKEN(FilePath, pound_filePath)

/// The \c #file magic identifier literal, written in code where it is
/// a synonym for \c #filePath (i.e. Swift 5 mode code).
MAGIC_STRING_IDENTIFIER(FilePathSpelledAsFile, "#file")
  // tok::pound_file is shared with FileIDSpelledAsFile; please write custom
  // code paths for it.

/// The \c #function magic identifier literal.
MAGIC_STRING_IDENTIFIER(Function, "#function")
  MAGIC_IDENTIFIER_TOKEN(Function, pound_function)



//
// Magic integer literals
//

/// The \c #line magic identifier literal.
MAGIC_INT_IDENTIFIER(Line, "#line")
  MAGIC_IDENTIFIER_TOKEN(Line, pound_line)

/// The \c #column magic identifier literal.
MAGIC_INT_IDENTIFIER(Column, "#column")
  MAGIC_IDENTIFIER_TOKEN(Column, pound_column)



//
// Magic raw pointer literals
//

/// The \c #dsohandle magic identifier literal.
MAGIC_POINTER_IDENTIFIER(DSOHandle, "#dsohandle")
  MAGIC_IDENTIFIER_TOKEN(DSOHandle, pound_dsohandle)

#undef MAGIC_IDENTIFIER
#undef MAGIC_STRING_IDENTIFIER
#undef MAGIC_INT_IDENTIFIER
#undef MAGIC_POINTER_IDENTIFIER
#undef MAGIC_IDENTIFIER_TOKEN
