clang API Documentation

Public Member Functions | Static Public Member Functions | Friends
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:
Inheritance graph
[legend]
Collaboration diagram for clang::MSDependentExistsStmt:
Collaboration graph
[legend]

List of all members.

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.
bool isIfExists () const
 Determine whether this is an __if_exists statement.
bool isIfNotExists () const
 Determine whether this is an __if_exists statement.
NestedNameSpecifierLoc getQualifierLoc () const
 Retrieve the nested-name-specifier that qualifies this name, if any.
DeclarationNameInfo getNameInfo () const
 Retrieve the name of the entity we're testing for, along with location information.
CompoundStmtgetSubStmt () const
 Retrieve the compound statement that will be included in the program only if the existence of the symbol matches the initial keyword.
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

Reimplemented from clang::Stmt.

Definition at line 281 of file StmtCXX.h.

static bool clang::MSDependentExistsStmt::classof ( const Stmt T) [inline, static]

Definition at line 285 of file StmtCXX.h.

References clang::Stmt::getStmtClass().

Retrieve the location of the __if_exists or __if_not_exists keyword.

Definition at line 256 of file StmtCXX.h.

Reimplemented from clang::Stmt.

Definition at line 279 of file StmtCXX.h.

References clang::Stmt::getLocEnd().

Reimplemented from clang::Stmt.

Definition at line 278 of file StmtCXX.h.

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

Definition at line 270 of file StmtCXX.h.

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

Definition at line 266 of file StmtCXX.h.

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.

Determine whether this is an __if_exists statement.

Definition at line 259 of file StmtCXX.h.

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]

Reimplemented from clang::Stmt.

Definition at line 242 of file StmtCXX.h.


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