1 //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // Describes whether the identifier locations for a selector are "standard"
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
15 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
17 #include "clang/Basic/LLVM.h"
25 /// Whether all locations of the selector identifiers are in a
26 /// "standard" position.
27 enum SelectorLocationsKind {
29 SelLoc_NonStandard = 0,
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,
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
44 /// Returns true if all \p SelLocs are in a "standard" location.
45 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
46 ArrayRef<SourceLocation> SelLocs,
47 ArrayRef<Expr *> Args,
48 SourceLocation EndLoc);
50 /// Get the "standard" location of a selector identifier, e.g:
51 /// For nullary selectors, immediately before ']': "[foo release]"
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]"
56 SourceLocation getStandardSelectorLoc(unsigned Index,
59 ArrayRef<Expr *> Args,
60 SourceLocation EndLoc);
62 /// Returns true if all \p SelLocs are in a "standard" location.
63 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
64 ArrayRef<SourceLocation> SelLocs,
65 ArrayRef<ParmVarDecl *> Args,
66 SourceLocation EndLoc);
68 /// Get the "standard" location of a selector identifier, e.g:
69 /// For nullary selectors, immediately before ']': "[foo release]"
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;"
74 SourceLocation getStandardSelectorLoc(unsigned Index,
77 ArrayRef<ParmVarDecl *> Args,
78 SourceLocation EndLoc);
80 } // end namespace clang