1 //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Describes whether the identifier locations for a selector are "standard"
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
16 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
18 #include "clang/Basic/LLVM.h"
26 /// \brief Whether all locations of the selector identifiers are in a
27 /// "standard" position.
28 enum SelectorLocationsKind {
29 /// \brief Non-standard.
30 SelLoc_NonStandard = 0,
32 /// \brief For nullary selectors, immediately before the end:
33 /// "[foo release]" / "-(void)release;"
34 /// Or immediately before the arguments:
35 /// "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y;
36 SelLoc_StandardNoSpace = 1,
38 /// \brief For nullary selectors, immediately before the end:
39 /// "[foo release]" / "-(void)release;"
40 /// Or with a space between the arguments:
41 /// "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y;
42 SelLoc_StandardWithSpace = 2
45 /// \brief Returns true if all \p SelLocs are in a "standard" location.
46 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
47 ArrayRef<SourceLocation> SelLocs,
48 ArrayRef<Expr *> Args,
49 SourceLocation EndLoc);
51 /// \brief Get the "standard" location of a selector identifier, e.g:
52 /// For nullary selectors, immediately before ']': "[foo release]"
54 /// \param WithArgSpace if true the standard location is with a space apart
55 /// before arguments: "[foo first: 1 second: 2]"
56 /// If false: "[foo first:1 second:2]"
57 SourceLocation getStandardSelectorLoc(unsigned Index,
60 ArrayRef<Expr *> Args,
61 SourceLocation EndLoc);
63 /// \brief Returns true if all \p SelLocs are in a "standard" location.
64 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
65 ArrayRef<SourceLocation> SelLocs,
66 ArrayRef<ParmVarDecl *> Args,
67 SourceLocation EndLoc);
69 /// \brief Get the "standard" location of a selector identifier, e.g:
70 /// For nullary selectors, immediately before ']': "[foo release]"
72 /// \param WithArgSpace if true the standard location is with a space apart
73 /// before arguments: "-(id)first: (int)x second: (int)y;"
74 /// If false: "-(id)first:(int)x second:(int)y;"
75 SourceLocation getStandardSelectorLoc(unsigned Index,
78 ArrayRef<ParmVarDecl *> Args,
79 SourceLocation EndLoc);
81 } // end namespace clang