clang  3.7.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::MSDependentExistsStmt Class Reference

Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name. More...

#include <StmtCXX.h>

Inheritance diagram for clang::MSDependentExistsStmt:
[legend]
Collaboration diagram for clang::MSDependentExistsStmt:
[legend]

Public Member Functions

 MSDependentExistsStmt (SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, CompoundStmt *SubStmt)
 
SourceLocation getKeywordLoc () const
 Retrieve the location of the __if_exists or __if_not_exists keyword. More...
 
bool isIfExists () const
 Determine whether this is an __if_exists statement. More...
 
bool isIfNotExists () const
 Determine whether this is an __if_exists statement. More...
 
NestedNameSpecifierLoc getQualifierLoc () const
 Retrieve the nested-name-specifier that qualifies this name, if any. More...
 
DeclarationNameInfo getNameInfo () const
 Retrieve the name of the entity we're testing for, along with location information. More...
 
CompoundStmtgetSubStmt () const
 Retrieve the compound statement that will be included in the program only if the existence of the symbol matches the initial keyword. More...
 
SourceLocation getLocStart () const LLVM_READONLY
 
SourceLocation getLocEnd () const LLVM_READONLY
 
child_range children ()
 

Static Public Member Functions

static bool classof (const Stmt *T)
 

Friends

class ASTReader
 
class ASTStmtReader
 

Detailed Description

Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.

The __if_exists statement can be used to include a sequence of statements in the program only when a particular dependent name does not exist. For example:

template<typename T>
void call_foo(T &t) {
__if_exists (T::foo) {
t.foo(); // okay: only called when T::foo exists.
}
}

Similarly, the __if_not_exists statement can be used to include the statements when a particular name does not exist.

Note that this statement only captures __if_exists and __if_not_exists statements whose name is dependent. All non-dependent cases are handled directly in the parser, so that they don't introduce a new scope. Clang introduces scopes in the dependent case to keep names inside the compound statement from leaking out into the surround statements, which would compromise the template instantiation model. This behavior differs from Visual C++ (which never introduces a scope), but is a fairly reasonable approximation of the VC++ behavior.

Definition at line 234 of file StmtCXX.h.

Constructor & Destructor Documentation

clang::MSDependentExistsStmt::MSDependentExistsStmt ( SourceLocation  KeywordLoc,
bool  IsIfExists,
NestedNameSpecifierLoc  QualifierLoc,
DeclarationNameInfo  NameInfo,
CompoundStmt SubStmt 
)
inline

Definition at line 245 of file StmtCXX.h.

Member Function Documentation

child_range clang::MSDependentExistsStmt::children ( )
inline

Definition at line 281 of file StmtCXX.h.

static bool clang::MSDependentExistsStmt::classof ( const Stmt T)
inlinestatic

Definition at line 285 of file StmtCXX.h.

SourceLocation clang::MSDependentExistsStmt::getKeywordLoc ( ) const
inline

Retrieve the location of the __if_exists or __if_not_exists keyword.

Definition at line 256 of file StmtCXX.h.

SourceLocation clang::MSDependentExistsStmt::getLocEnd ( ) const
inline

Definition at line 279 of file StmtCXX.h.

SourceLocation clang::MSDependentExistsStmt::getLocStart ( ) const
inline

Definition at line 278 of file StmtCXX.h.

DeclarationNameInfo clang::MSDependentExistsStmt::getNameInfo ( ) const
inline

Retrieve the name of the entity we're testing for, along with location information.

Definition at line 270 of file StmtCXX.h.

NestedNameSpecifierLoc clang::MSDependentExistsStmt::getQualifierLoc ( ) const
inline

Retrieve the nested-name-specifier that qualifies this name, if any.

Definition at line 266 of file StmtCXX.h.

CompoundStmt* clang::MSDependentExistsStmt::getSubStmt ( ) const
inline

Retrieve the compound statement that will be included in the program only if the existence of the symbol matches the initial keyword.

Definition at line 274 of file StmtCXX.h.

bool clang::MSDependentExistsStmt::isIfExists ( ) const
inline

Determine whether this is an __if_exists statement.

Definition at line 259 of file StmtCXX.h.

bool clang::MSDependentExistsStmt::isIfNotExists ( ) const
inline

Determine whether this is an __if_exists statement.

Definition at line 262 of file StmtCXX.h.

Friends And Related Function Documentation

friend class ASTReader
friend

Definition at line 241 of file StmtCXX.h.

friend class ASTStmtReader
friend

Definition at line 242 of file StmtCXX.h.


The documentation for this class was generated from the following file: