1//===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Describes whether the identifier locations for a selector are "standard"
10// or not.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
15#define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
16
17#include "clang/Basic/LLVM.h"
18
19namespace clang {
20 class Selector;
21 class SourceLocation;
22 class Expr;
23 class ParmVarDecl;
24
25/// Whether all locations of the selector identifiers are in a
26/// "standard" position.
27enum SelectorLocationsKind {
28 /// Non-standard.
29 SelLoc_NonStandard = 0,
30
31 /// For nullary selectors, immediately before the end:
32 /// "[foo release]" / "-(void)release;"
33 /// Or immediately before the arguments:
34 /// "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y;
35 SelLoc_StandardNoSpace = 1,
36
37 /// For nullary selectors, immediately before the end:
38 /// "[foo release]" / "-(void)release;"
39 /// Or with a space between the arguments:
40 /// "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y;
41 SelLoc_StandardWithSpace = 2
42};
43
44/// Returns true if all \p SelLocs are in a "standard" location.
45SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
46 ArrayRef<SourceLocation> SelLocs,
47 ArrayRef<Expr *> Args,
48 SourceLocation EndLoc);
49
50/// Get the "standard" location of a selector identifier, e.g:
51/// For nullary selectors, immediately before ']': "[foo release]"
52///
53/// \param WithArgSpace if true the standard location is with a space apart
54/// before arguments: "[foo first: 1 second: 2]"
55/// If false: "[foo first:1 second:2]"
56SourceLocation getStandardSelectorLoc(unsigned Index,
57 Selector Sel,
58 bool WithArgSpace,
59 ArrayRef<Expr *> Args,
60 SourceLocation EndLoc);
61
62/// Returns true if all \p SelLocs are in a "standard" location.
63SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
64 ArrayRef<SourceLocation> SelLocs,
65 ArrayRef<ParmVarDecl *> Args,
66 SourceLocation EndLoc);
67
68/// Get the "standard" location of a selector identifier, e.g:
69/// For nullary selectors, immediately before ']': "[foo release]"
70///
71/// \param WithArgSpace if true the standard location is with a space apart
72/// before arguments: "-(id)first: (int)x second: (int)y;"
73/// If false: "-(id)first:(int)x second:(int)y;"
74SourceLocation getStandardSelectorLoc(unsigned Index,
75 Selector Sel,
76 bool WithArgSpace,
77 ArrayRef<ParmVarDecl *> Args,
78 SourceLocation EndLoc);
79
80} // end namespace clang
81
82#endif
83

source code of clang/include/clang/AST/SelectorLocationsKind.h