clang API Documentation
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name. More...
#include <StmtCXX.h>
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. | |
CompoundStmt * | getSubStmt () 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 |
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.
clang::MSDependentExistsStmt::MSDependentExistsStmt | ( | SourceLocation | KeywordLoc, |
bool | IsIfExists, | ||
NestedNameSpecifierLoc | QualifierLoc, | ||
DeclarationNameInfo | NameInfo, | ||
CompoundStmt * | SubStmt | ||
) | [inline] |
child_range clang::MSDependentExistsStmt::children | ( | ) | [inline] |
Reimplemented from clang::Stmt.
static bool clang::MSDependentExistsStmt::classof | ( | const Stmt * | T | ) | [inline, static] |
Definition at line 285 of file StmtCXX.h.
References clang::Stmt::getStmtClass().
SourceLocation clang::MSDependentExistsStmt::getKeywordLoc | ( | ) | const [inline] |
SourceLocation clang::MSDependentExistsStmt::getLocEnd | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 279 of file StmtCXX.h.
References clang::Stmt::getLocEnd().
SourceLocation clang::MSDependentExistsStmt::getLocStart | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
DeclarationNameInfo clang::MSDependentExistsStmt::getNameInfo | ( | ) | const [inline] |
NestedNameSpecifierLoc clang::MSDependentExistsStmt::getQualifierLoc | ( | ) | const [inline] |
CompoundStmt* clang::MSDependentExistsStmt::getSubStmt | ( | ) | const [inline] |
bool clang::MSDependentExistsStmt::isIfExists | ( | ) | const [inline] |
bool clang::MSDependentExistsStmt::isIfNotExists | ( | ) | const [inline] |
friend class ASTStmtReader [friend] |
Reimplemented from clang::Stmt.