// of the public API of this class.
bool TraverseDecl(Decl *DeclNode) {
ScopedIncrement ScopedDepth(&CurrentDepth);
- return (DeclNode == NULL) || traverse(*DeclNode);
+ return (DeclNode == nullptr) || traverse(*DeclNode);
}
bool TraverseStmt(Stmt *StmtNode) {
ScopedIncrement ScopedDepth(&CurrentDepth);
if (Traversal ==
ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses) {
const Expr *ExprNode = dyn_cast_or_null<Expr>(StmtNode);
- if (ExprNode != NULL) {
+ if (ExprNode) {
StmtToTraverse = ExprNode->IgnoreParenImpCasts();
}
}
- return (StmtToTraverse == NULL) || traverse(*StmtToTraverse);
+ return (StmtToTraverse == nullptr) || traverse(*StmtToTraverse);
}
// We assume that the QualType and the contained type are on the same
// hierarchy level. Thus, we try to match either of them.
}
bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS) {
ScopedIncrement ScopedDepth(&CurrentDepth);
- return (NNS == NULL) || traverse(*NNS);
+ return (NNS == nullptr) || traverse(*NNS);
}
bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS) {
if (!NNS)
MatchASTVisitor(
std::vector<std::pair<internal::DynTypedMatcher, MatchCallback *> > *
MatcherCallbackPairs)
- : MatcherCallbackPairs(MatcherCallbackPairs), ActiveASTContext(NULL) {}
+ : MatcherCallbackPairs(MatcherCallbackPairs), ActiveASTContext(nullptr) {}
void onStartOfTranslationUnit() {
for (std::vector<std::pair<internal::DynTypedMatcher,
static CXXRecordDecl *getAsCXXRecordDecl(const Type *TypeNode) {
// Type::getAs<...>() drills through typedefs.
- if (TypeNode->getAs<DependentNameType>() != NULL ||
- TypeNode->getAs<DependentTemplateSpecializationType>() != NULL ||
- TypeNode->getAs<TemplateTypeParmType>() != NULL)
+ if (TypeNode->getAs<DependentNameType>() != nullptr ||
+ TypeNode->getAs<DependentTemplateSpecializationType>() != nullptr ||
+ TypeNode->getAs<TemplateTypeParmType>() != nullptr)
// Dependent names and template TypeNode parameters will be matched when
// the template is instantiated.
- return NULL;
+ return nullptr;
TemplateSpecializationType const *TemplateType =
TypeNode->getAs<TemplateSpecializationType>();
- if (TemplateType == NULL) {
+ if (!TemplateType) {
return TypeNode->getAsCXXRecordDecl();
}
if (TemplateType->getTemplateName().isDependent())
// Dependent template specializations will be matched when the
// template is instantiated.
- return NULL;
+ return nullptr;
// For template specialization types which are specializing a template
// declaration which is an explicit or partial specialization of another
// another template declaration, getAsCXXRecordDecl() returns NULL and
// we get the CXXRecordDecl of the templated declaration.
CXXRecordDecl *SpecializationDecl = TemplateType->getAsCXXRecordDecl();
- if (SpecializationDecl != NULL) {
+ if (SpecializationDecl) {
return SpecializationDecl;
}
NamedDecl *Templated =
return true;
CXXRecordDecl *ClassDecl = getAsCXXRecordDecl(TypeNode);
- if (ClassDecl == NULL)
+ if (!ClassDecl)
continue;
if (ClassDecl == Declaration) {
// This can happen for recursive template definitions; if the
}
bool MatchASTVisitor::TraverseDecl(Decl *DeclNode) {
- if (DeclNode == NULL) {
+ if (!DeclNode) {
return true;
}
match(*DeclNode);
}
bool MatchASTVisitor::TraverseStmt(Stmt *StmtNode) {
- if (StmtNode == NULL) {
+ if (!StmtNode) {
return true;
}
match(*StmtNode);
private:
void HandleTranslationUnit(ASTContext &Context) override {
- if (ParsingDone != NULL) {
+ if (ParsingDone != nullptr) {
ParsingDone->run();
}
Finder->matchAST(Context);
MatchFinder::MatchCallback::~MatchCallback() {}
MatchFinder::ParsingDoneTestCallback::~ParsingDoneTestCallback() {}
-MatchFinder::MatchFinder() : ParsingDone(NULL) {}
+MatchFinder::MatchFinder() : ParsingDone(nullptr) {}
MatchFinder::~MatchFinder() {}
public:
explicit CodeTokenizer(StringRef MatcherCode, Diagnostics *Error)
: Code(MatcherCode), StartOfLine(MatcherCode), Line(1), Error(Error),
- CodeCompletionLocation(0) {
+ CodeCompletionLocation(nullptr) {
NextToken = getNextToken();
}
if (CodeCompletionLocation && CodeCompletionLocation <= Code.data()) {
Result.Kind = TokenInfo::TK_CodeCompletion;
Result.Text = StringRef(CodeCompletionLocation, 0);
- CodeCompletionLocation = 0;
+ CodeCompletionLocation = nullptr;
return Result;
}
// cause the portion of the identifier before the code completion
// location to become a code completion token.
if (CodeCompletionLocation == Code.data() + TokenLength) {
- CodeCompletionLocation = 0;
+ CodeCompletionLocation = nullptr;
Result.Kind = TokenInfo::TK_CodeCompletion;
Result.Text = Code.substr(0, TokenLength);
Code = Code.drop_front(TokenLength);
TokenInfo EndToken;
{
- ScopedContextEntry SCE(this, Ctor ? *Ctor : 0);
+ ScopedContextEntry SCE(this, Ctor ? *Ctor : nullptr);
while (Tokenizer->nextTokenKind() != TokenInfo::TK_Eof) {
if (Tokenizer->nextTokenKind() == TokenInfo::TK_CloseParen) {