clang  6.0.0svn
Public Member Functions | List of all members
clang::CXXScopeSpec Class Reference

Represents a C++ nested-name-specifier or a global scope specifier. More...

#include "clang/Sema/DeclSpec.h"

Public Member Functions

SourceRange getRange () const
 
void setRange (SourceRange R)
 
void setBeginLoc (SourceLocation Loc)
 
void setEndLoc (SourceLocation Loc)
 
SourceLocation getBeginLoc () const
 
SourceLocation getEndLoc () const
 
NestedNameSpecifiergetScopeRep () const
 Retrieve the representation of the nested-name-specifier. More...
 
void Extend (ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
 Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type::'. More...
 
void Extend (ASTContext &Context, IdentifierInfo *Identifier, SourceLocation IdentifierLoc, SourceLocation ColonColonLoc)
 Extend the current nested-name-specifier by another nested-name-specifier component of the form 'identifier::'. More...
 
void Extend (ASTContext &Context, NamespaceDecl *Namespace, SourceLocation NamespaceLoc, SourceLocation ColonColonLoc)
 Extend the current nested-name-specifier by another nested-name-specifier component of the form 'namespace::'. More...
 
void Extend (ASTContext &Context, NamespaceAliasDecl *Alias, SourceLocation AliasLoc, SourceLocation ColonColonLoc)
 Extend the current nested-name-specifier by another nested-name-specifier component of the form 'namespace-alias::'. More...
 
void MakeGlobal (ASTContext &Context, SourceLocation ColonColonLoc)
 Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'. More...
 
void MakeSuper (ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
 Turns this (empty) nested-name-specifier into '__super' nested-name-specifier. More...
 
void MakeTrivial (ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
 Make a new nested-name-specifier from incomplete source-location information. More...
 
void Adopt (NestedNameSpecifierLoc Other)
 Adopt an existing nested-name-specifier (with source-range information). More...
 
NestedNameSpecifierLoc getWithLocInContext (ASTContext &Context) const
 Retrieve a nested-name-specifier with location information, copied into the given AST context. More...
 
SourceLocation getLastQualifierNameLoc () const
 Retrieve the location of the name in the last qualifier in this nested name specifier. More...
 
bool isEmpty () const
 No scope specifier. More...
 
bool isNotEmpty () const
 A scope specifier is present, but may be valid or invalid. More...
 
bool isInvalid () const
 An error occurred during parsing of the scope specifier. More...
 
bool isValid () const
 A scope specifier is present, and it refers to a real scope. More...
 
void SetInvalid (SourceRange R)
 Indicate that this nested-name-specifier is invalid. More...
 
bool isSet () const
 Deprecated. More...
 
void clear ()
 
char * location_data () const
 Retrieve the data associated with the source-location information. More...
 
unsigned location_size () const
 Retrieve the size of the data associated with source-location information. More...
 

Detailed Description

Represents a C++ nested-name-specifier or a global scope specifier.

These can be in 3 states: 1) Not present, identified by isEmpty() 2) Present, identified by isNotEmpty() 2.a) Valid, identified by isValid() 2.b) Invalid, identified by isInvalid().

isSet() is deprecated because it mostly corresponded to "valid" but was often used as if it meant "present".

The actual scope is described by getScopeRep().

Definition at line 63 of file DeclSpec.h.

Member Function Documentation

◆ Adopt()

void CXXScopeSpec::Adopt ( NestedNameSpecifierLoc  Other)

◆ clear()

void clang::CXXScopeSpec::clear ( )
inline

◆ Extend() [1/4]

void CXXScopeSpec::Extend ( ASTContext Context,
SourceLocation  TemplateKWLoc,
TypeLoc  TL,
SourceLocation  ColonColonLoc 
)

Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type::'.

Parameters
ContextThe AST context in which this nested-name-specifier resides.
TemplateKWLocThe location of the 'template' keyword, if present.
TLThe TypeLoc that describes the type preceding the '::'.
ColonColonLocThe location of the trailing '::'.

Definition at line 47 of file DeclSpec.cpp.

Referenced by clang::Sema::ActOnCXXNestedNameSpecifierDecltype(), getScopeRep(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().

◆ Extend() [2/4]

void CXXScopeSpec::Extend ( ASTContext Context,
IdentifierInfo Identifier,
SourceLocation  IdentifierLoc,
SourceLocation  ColonColonLoc 
)

Extend the current nested-name-specifier by another nested-name-specifier component of the form 'identifier::'.

Parameters
ContextThe AST context in which this nested-name-specifier resides.
IdentifierThe identifier.
IdentifierLocThe location of the identifier.
ColonColonLocThe location of the trailing '::'.

Definition at line 58 of file DeclSpec.cpp.

◆ Extend() [3/4]

void CXXScopeSpec::Extend ( ASTContext Context,
NamespaceDecl Namespace,
SourceLocation  NamespaceLoc,
SourceLocation  ColonColonLoc 
)

Extend the current nested-name-specifier by another nested-name-specifier component of the form 'namespace::'.

Parameters
ContextThe AST context in which this nested-name-specifier resides.
NamespaceThe namespace.
NamespaceLocThe location of the namespace name.
ColonColonLocThe location of the trailing '::'.

Definition at line 71 of file DeclSpec.cpp.

◆ Extend() [4/4]

void CXXScopeSpec::Extend ( ASTContext Context,
NamespaceAliasDecl Alias,
SourceLocation  AliasLoc,
SourceLocation  ColonColonLoc 
)

Extend the current nested-name-specifier by another nested-name-specifier component of the form 'namespace-alias::'.

Parameters
ContextThe AST context in which this nested-name-specifier resides.
AliasThe namespace alias.
AliasLocThe location of the namespace alias name.
ColonColonLocThe location of the trailing '::'.

Definition at line 84 of file DeclSpec.cpp.

◆ getBeginLoc()

SourceLocation clang::CXXScopeSpec::getBeginLoc ( ) const
inline

◆ getEndLoc()

SourceLocation clang::CXXScopeSpec::getEndLoc ( ) const
inline

Definition at line 73 of file DeclSpec.h.

References clang::SourceRange::getEnd().

Referenced by getMissingDeclaratorIdLoc().

◆ getLastQualifierNameLoc()

SourceLocation CXXScopeSpec::getLastQualifierNameLoc ( ) const

Retrieve the location of the name in the last qualifier in this nested name specifier.

For example, the location of bar in

///   \::foo::bar<0>::
///           ^~~
/// 

Definition at line 136 of file DeclSpec.cpp.

Referenced by clang::Sema::computeDeclContext(), and clang::Sema::RequireCompleteDeclContext().

◆ getRange()

SourceRange clang::CXXScopeSpec::getRange ( ) const
inline

◆ getScopeRep()

NestedNameSpecifier* clang::CXXScopeSpec::getScopeRep ( ) const
inline

◆ getWithLocInContext()

NestedNameSpecifierLoc CXXScopeSpec::getWithLocInContext ( ASTContext Context) const

◆ isEmpty()

bool clang::CXXScopeSpec::isEmpty ( ) const
inline

◆ isInvalid()

bool clang::CXXScopeSpec::isInvalid ( ) const
inline

◆ isNotEmpty()

bool clang::CXXScopeSpec::isNotEmpty ( ) const
inline

A scope specifier is present, but may be valid or invalid.

Definition at line 191 of file DeclSpec.h.

References isEmpty().

Referenced by getMissingDeclaratorIdLoc(), isInvalid(), isPipeDeclerator(), isValid(), clang::Parser::ParseUnqualifiedId(), and clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec().

◆ isSet()

bool clang::CXXScopeSpec::isSet ( ) const
inline

◆ isValid()

bool clang::CXXScopeSpec::isValid ( ) const
inline

◆ location_data()

char* clang::CXXScopeSpec::location_data ( ) const
inline

Retrieve the data associated with the source-location information.

Definition at line 217 of file DeclSpec.h.

References clang::NestedNameSpecifierLocBuilder::getBuffer().

Referenced by clang::Sema::SaveNestedNameSpecifierAnnotation(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().

◆ location_size()

unsigned clang::CXXScopeSpec::location_size ( ) const
inline

Retrieve the size of the data associated with source-location information.

Definition at line 221 of file DeclSpec.h.

References clang::NestedNameSpecifierLocBuilder::getBuffer().

Referenced by clang::Sema::SaveNestedNameSpecifierAnnotation(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().

◆ MakeGlobal()

void CXXScopeSpec::MakeGlobal ( ASTContext Context,
SourceLocation  ColonColonLoc 
)

Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.

Definition at line 97 of file DeclSpec.cpp.

Referenced by clang::Sema::ActOnCXXGlobalScopeSpecifier(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().

◆ MakeSuper()

void CXXScopeSpec::MakeSuper ( ASTContext Context,
CXXRecordDecl RD,
SourceLocation  SuperLoc,
SourceLocation  ColonColonLoc 
)

Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.

Parameters
ContextThe AST context in which this nested-name-specifier resides.
RDThe declaration of the class in which nested-name-specifier appeared.
SuperLocThe location of the '__super' keyword. name.
ColonColonLocThe location of the trailing '::'.

Definition at line 107 of file DeclSpec.cpp.

Referenced by clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().

◆ MakeTrivial()

void CXXScopeSpec::MakeTrivial ( ASTContext Context,
NestedNameSpecifier Qualifier,
SourceRange  R 
)

Make a new nested-name-specifier from incomplete source-location information.

FIXME: This routine should be used very, very rarely, in cases where we need to synthesize a nested-name-specifier. Most code should instead use Adopt() with a proper NestedNameSpecifierLoc.

Definition at line 119 of file DeclSpec.cpp.

Referenced by attemptRecovery().

◆ setBeginLoc()

void clang::CXXScopeSpec::setBeginLoc ( SourceLocation  Loc)
inline

Definition at line 70 of file DeclSpec.h.

References clang::SourceRange::setBegin().

◆ setEndLoc()

void clang::CXXScopeSpec::setEndLoc ( SourceLocation  Loc)
inline

Definition at line 71 of file DeclSpec.h.

References clang::SourceRange::setEnd().

◆ SetInvalid()

void clang::CXXScopeSpec::SetInvalid ( SourceRange  R)
inline

◆ setRange()

void clang::CXXScopeSpec::setRange ( SourceRange  R)
inline

Definition at line 69 of file DeclSpec.h.


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