本文整理汇总了C++中NestedNameSpecifierLoc::getSourceRange方法的典型用法代码示例。如果您正苦于以下问题:C++ NestedNameSpecifierLoc::getSourceRange方法的具体用法?C++ NestedNameSpecifierLoc::getSourceRange怎么用?C++ NestedNameSpecifierLoc::getSourceRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NestedNameSpecifierLoc
的用法示例。
在下文中一共展示了NestedNameSpecifierLoc::getSourceRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indexNestedNameSpecifierLoc
void IndexingContext::indexNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
const NamedDecl *Parent,
const DeclContext *DC) {
if (!NNS)
return;
if (NestedNameSpecifierLoc Prefix = NNS.getPrefix())
indexNestedNameSpecifierLoc(Prefix, Parent, DC);
if (!DC)
DC = Parent->getLexicalDeclContext();
SourceLocation Loc = NNS.getSourceRange().getBegin();
switch (NNS.getNestedNameSpecifier()->getKind()) {
case NestedNameSpecifier::Identifier:
case NestedNameSpecifier::Global:
case NestedNameSpecifier::Super:
break;
case NestedNameSpecifier::Namespace:
handleReference(NNS.getNestedNameSpecifier()->getAsNamespace(),
Loc, Parent, DC, SymbolRoleSet());
break;
case NestedNameSpecifier::NamespaceAlias:
handleReference(NNS.getNestedNameSpecifier()->getAsNamespaceAlias(),
Loc, Parent, DC, SymbolRoleSet());
break;
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate:
indexTypeLoc(NNS.getTypeLoc(), Parent, DC);
break;
}
}
示例2: Adopt
void CXXScopeSpec::Adopt(NestedNameSpecifierLoc Other) {
if (!Other) {
Range = SourceRange();
Builder.Clear();
return;
}
Range = Other.getSourceRange();
Builder.Adopt(Other);
}
示例3: getQualifierAsString
void RewriteUtils::getQualifierAsString(NestedNameSpecifierLoc Loc,
std::string &Str)
{
SourceLocation StartLoc = Loc.getBeginLoc();
TransAssert(StartLoc.isValid() && "Bad StartLoc for NestedNameSpecifier!");
SourceRange Range = Loc.getSourceRange();
int Len = TheRewriter->getRangeSize(Range);
const char *StartBuf = SrcManager->getCharacterData(StartLoc);
Str.assign(StartBuf, Len);
}
示例4: VisitElaboratedTypeLoc
// Handle cases like:
// struct S {
// typedef int Int;
// };
// S::Int g;
// where S::Int is referred as an ElaboratedType
bool ReplaceSimpleTypedefRewriteVisitor::VisitElaboratedTypeLoc(
ElaboratedTypeLoc Loc)
{
const ElaboratedType *ETy = dyn_cast<ElaboratedType>(Loc.getTypePtr());
const Type *NamedTy = ETy->getNamedType().getTypePtr();
const TypedefType *TdefTy = NamedTy->getAs<TypedefType>();
if (!TdefTy)
return true;
const TypedefDecl *TdefD = dyn_cast<TypedefDecl>(TdefTy->getDecl());
if (!TdefD || (dyn_cast<TypedefDecl>(TdefD->getCanonicalDecl()) !=
ConsumerInstance->TheTypedefDecl)) {
return true;
}
NestedNameSpecifierLoc QualifierLoc = Loc.getQualifierLoc();
if (QualifierLoc && ConsumerInstance->IsScalarType) {
ConsumerInstance->TheRewriter.RemoveText(QualifierLoc.getSourceRange());
}
return true;
}