clang API Documentation

SelectorLocationsKind.h
Go to the documentation of this file.
00001 //===--- SelectorLocationsKind.h - Kind of selector locations ---*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Describes whether the identifier locations for a selector are "standard"
00011 // or not.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
00016 #define LLVM_CLANG_AST_SELECTORLOCATIONSKIND_H
00017 
00018 #include "clang/Basic/LLVM.h"
00019 
00020 namespace clang {
00021   class Selector;
00022   class SourceLocation;
00023   class Expr;
00024   class ParmVarDecl;
00025 
00026 /// \brief Whether all locations of the selector identifiers are in a
00027 /// "standard" position.
00028 enum SelectorLocationsKind {
00029   /// \brief Non-standard.
00030   SelLoc_NonStandard = 0,
00031 
00032   /// \brief For nullary selectors, immediately before the end:
00033   ///    "[foo release]" / "-(void)release;"
00034   /// Or immediately before the arguments:
00035   ///    "[foo first:1 second:2]" / "-(id)first:(int)x second:(int)y;
00036   SelLoc_StandardNoSpace = 1,
00037 
00038   /// \brief For nullary selectors, immediately before the end:
00039   ///    "[foo release]" / "-(void)release;"
00040   /// Or with a space between the arguments:
00041   ///    "[foo first: 1 second: 2]" / "-(id)first: (int)x second: (int)y;
00042   SelLoc_StandardWithSpace = 2
00043 };
00044 
00045 /// \brief Returns true if all \p SelLocs are in a "standard" location.
00046 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
00047                                               ArrayRef<SourceLocation> SelLocs,
00048                                               ArrayRef<Expr *> Args,
00049                                               SourceLocation EndLoc);
00050 
00051 /// \brief Get the "standard" location of a selector identifier, e.g:
00052 /// For nullary selectors, immediately before ']': "[foo release]"
00053 ///
00054 /// \param WithArgSpace if true the standard location is with a space apart
00055 /// before arguments: "[foo first: 1 second: 2]"
00056 /// If false: "[foo first:1 second:2]"
00057 SourceLocation getStandardSelectorLoc(unsigned Index,
00058                                       Selector Sel,
00059                                       bool WithArgSpace,
00060                                       ArrayRef<Expr *> Args,
00061                                       SourceLocation EndLoc);
00062 
00063 /// \brief Returns true if all \p SelLocs are in a "standard" location.
00064 SelectorLocationsKind hasStandardSelectorLocs(Selector Sel,
00065                                               ArrayRef<SourceLocation> SelLocs,
00066                                               ArrayRef<ParmVarDecl *> Args,
00067                                               SourceLocation EndLoc);
00068 
00069 /// \brief Get the "standard" location of a selector identifier, e.g:
00070 /// For nullary selectors, immediately before ']': "[foo release]"
00071 ///
00072 /// \param WithArgSpace if true the standard location is with a space apart
00073 /// before arguments: "-(id)first: (int)x second: (int)y;"
00074 /// If false: "-(id)first:(int)x second:(int)y;"
00075 SourceLocation getStandardSelectorLoc(unsigned Index,
00076                                       Selector Sel,
00077                                       bool WithArgSpace,
00078                                       ArrayRef<ParmVarDecl *> Args,
00079                                       SourceLocation EndLoc);
00080 
00081 } // end namespace clang
00082 
00083 #endif