aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/clang16/include/clang/AST/SelectorLocationsKind.h
blob: 4eb4d6f2387090f4a0b6dba80a0f7f3d49aa6c5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Describes whether the identifier locations for a selector are "standard"
// or not.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
#define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H

#include "clang/Basic/LLVM.h"

namespace clang {
  class Selector;
  class SourceLocation;
  class Expr;
  class ParmVarDecl;

/// Whether all locations of the selector identifiers are in a
/// "standard" position.
enum SelectorLocationsKind {
  /// Non-standard.
  SelLoc_NonStandard = 0,

  /// For nullary selectors, immediately before the end:
  ///    "[foo release]" / "-(void)release;"
  /// Or immediately before the arguments:
  ///    "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y;
  SelLoc_StandardNoSpace = 1,

  /// For nullary selectors, immediately before the end:
  ///    "[foo release]" / "-(void)release;"
  /// Or with a space between the arguments:
  ///    "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y;
  SelLoc_StandardWithSpace = 2
};

/// Returns true if all \p SelLocs are in a "standard" location.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
                                              ArrayRef<SourceLocation> SelLocs,
                                              ArrayRef<Expr *> Args,
                                              SourceLocation EndLoc);

/// Get the "standard" location of a selector identifier, e.g:
/// For nullary selectors, immediately before ']': "[foo release]"
///
/// \param WithArgSpace if true the standard location is with a space apart
/// before arguments: "[foo first: 1 second: 2]"
/// If false: "[foo first:1 second:2]"
SourceLocation getStandardSelectorLoc(unsigned Index,
                                      Selector Sel,
                                      bool WithArgSpace,
                                      ArrayRef<Expr *> Args,
                                      SourceLocation EndLoc);

/// Returns true if all \p SelLocs are in a "standard" location.
SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
                                              ArrayRef<SourceLocation> SelLocs,
                                              ArrayRef<ParmVarDecl *> Args,
                                              SourceLocation EndLoc);

/// Get the "standard" location of a selector identifier, e.g:
/// For nullary selectors, immediately before ']': "[foo release]"
///
/// \param WithArgSpace if true the standard location is with a space apart
/// before arguments: "-(id)first: (int)x second: (int)y;"
/// If false: "-(id)first:(int)x second:(int)y;"
SourceLocation getStandardSelectorLoc(unsigned Index,
                                      Selector Sel,
                                      bool WithArgSpace,
                                      ArrayRef<ParmVarDecl *> Args,
                                      SourceLocation EndLoc);

} // end namespace clang

#endif

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif