• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Describes whether the identifier locations for a selector are "standard"
11 // or not.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
16 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
17 
18 #include "clang/Basic/LLVM.h"
19 
20 namespace clang {
21   class Selector;
22   class SourceLocation;
23   class Expr;
24   class ParmVarDecl;
25 
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,
31 
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,
37 
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
43 };
44 
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);
50 
51 /// \brief Get the "standard" location of a selector identifier, e.g:
52 /// For nullary selectors, immediately before ']': "[foo release]"
53 ///
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,
58                                       Selector Sel,
59                                       bool WithArgSpace,
60                                       ArrayRef<Expr *> Args,
61                                       SourceLocation EndLoc);
62 
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);
68 
69 /// \brief Get the "standard" location of a selector identifier, e.g:
70 /// For nullary selectors, immediately before ']': "[foo release]"
71 ///
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,
76                                       Selector Sel,
77                                       bool WithArgSpace,
78                                       ArrayRef<ParmVarDecl *> Args,
79                                       SourceLocation EndLoc);
80 
81 } // end namespace clang
82 
83 #endif
84