forked from OSchip/llvm-project
Use isa instead of dyn_cast (NFC)
This commit is contained in:
parent
9c0a4227a9
commit
62e48ed10f
|
@ -68,7 +68,7 @@ bool MapASTVisitor::VisitCXXMethodDecl(const CXXMethodDecl *D) {
|
|||
|
||||
bool MapASTVisitor::VisitFunctionDecl(const FunctionDecl *D) {
|
||||
// Don't visit CXXMethodDecls twice
|
||||
if (dyn_cast<CXXMethodDecl>(D))
|
||||
if (isa<CXXMethodDecl>(D))
|
||||
return true;
|
||||
return mapDecl(D);
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ populateParentNamespaces(llvm::SmallVector<Reference, 4> &Namespaces,
|
|||
// corresponds to a Record and if it doesn't have any namespace (because this
|
||||
// means it's in the global namespace). Also if its outermost namespace is a
|
||||
// record because that record matches the previous condition mentioned.
|
||||
if ((Namespaces.empty() && dyn_cast<RecordDecl>(D)) ||
|
||||
if ((Namespaces.empty() && isa<RecordDecl>(D)) ||
|
||||
(!Namespaces.empty() && Namespaces.back().RefType == InfoType::IT_record))
|
||||
Namespaces.emplace_back(SymbolID(), "GlobalNamespace",
|
||||
InfoType::IT_namespace);
|
||||
|
@ -419,10 +419,10 @@ static void populateFunctionInfo(FunctionInfo &I, const FunctionDecl *D,
|
|||
populateSymbolInfo(I, D, FC, LineNumber, Filename, IsFileInRootDir,
|
||||
IsInAnonymousNamespace);
|
||||
if (const auto *T = getDeclForType(D->getReturnType())) {
|
||||
if (dyn_cast<EnumDecl>(T))
|
||||
if (isa<EnumDecl>(T))
|
||||
I.ReturnType = TypeInfo(getUSRForDecl(T), T->getNameAsString(),
|
||||
InfoType::IT_enum, getInfoRelativePath(T));
|
||||
else if (dyn_cast<RecordDecl>(T))
|
||||
else if (isa<RecordDecl>(T))
|
||||
I.ReturnType = TypeInfo(getUSRForDecl(T), T->getNameAsString(),
|
||||
InfoType::IT_record, getInfoRelativePath(T));
|
||||
} else {
|
||||
|
|
|
@ -829,7 +829,7 @@ bool LoopConvertCheck::isConvertible(ASTContext *Context,
|
|||
} else if (FixerKind == LFK_PseudoArray) {
|
||||
// This call is required to obtain the container.
|
||||
const auto *EndCall = Nodes.getNodeAs<CXXMemberCallExpr>(EndCallName);
|
||||
if (!EndCall || !dyn_cast<MemberExpr>(EndCall->getCallee()))
|
||||
if (!EndCall || !isa<MemberExpr>(EndCall->getCallee()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
return false;
|
||||
|
||||
// Ignore anonymous functions.
|
||||
if (!dyn_cast_or_null<NamedDecl>(AC.getDecl()))
|
||||
if (!isa_and_nonnull<NamedDecl>(AC.getDecl()))
|
||||
return false;
|
||||
|
||||
SortedGraph = AC.getAnalysis<PostOrderCFGView>();
|
||||
|
|
|
@ -1346,7 +1346,7 @@ bool Sema::CheckCXXThisCapture(SourceLocation Loc, const bool Explicit,
|
|||
// implicitly capturing the *enclosing object* by reference (see loop
|
||||
// above)).
|
||||
assert((!ByCopy ||
|
||||
dyn_cast<LambdaScopeInfo>(FunctionScopes[MaxFunctionScopesIndex])) &&
|
||||
isa<LambdaScopeInfo>(FunctionScopes[MaxFunctionScopesIndex])) &&
|
||||
"Only a lambda can capture the enclosing object (referred to by "
|
||||
"*this) by copy");
|
||||
QualType ThisTy = getCurrentThisType();
|
||||
|
|
|
@ -2085,7 +2085,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
|
|||
if (args.hasArg(OPT_include_optional)) {
|
||||
// Handle /includeoptional
|
||||
for (auto *arg : args.filtered(OPT_include_optional))
|
||||
if (dyn_cast_or_null<LazyArchive>(ctx.symtab.find(arg->getValue())))
|
||||
if (isa_and_nonnull<LazyArchive>(ctx.symtab.find(arg->getValue())))
|
||||
addUndefined(arg->getValue());
|
||||
while (run());
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ void Symbol::resolveUndefined(const Undefined &other) {
|
|||
}
|
||||
|
||||
// Undefined symbols in a SharedFile do not change the binding.
|
||||
if (dyn_cast_or_null<SharedFile>(other.file))
|
||||
if (isa_and_nonnull<SharedFile>(other.file))
|
||||
return;
|
||||
|
||||
if (isUndefined() || isShared()) {
|
||||
|
@ -608,7 +608,7 @@ int Symbol::compare(const Symbol *other) const {
|
|||
auto *oldSym = cast<Defined>(this);
|
||||
auto *newSym = cast<Defined>(other);
|
||||
|
||||
if (dyn_cast_or_null<BitcodeFile>(other->file))
|
||||
if (isa_and_nonnull<BitcodeFile>(other->file))
|
||||
return 0;
|
||||
|
||||
if (!oldSym->section && !newSym->section && oldSym->value == newSym->value &&
|
||||
|
|
|
@ -211,7 +211,7 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body,
|
|||
Stmt **last_stmt_ptr = Body->body_end() - 1;
|
||||
Stmt *last_stmt = *last_stmt_ptr;
|
||||
|
||||
while (dyn_cast<NullStmt>(last_stmt)) {
|
||||
while (isa<NullStmt>(last_stmt)) {
|
||||
if (last_stmt_ptr != Body->body_begin()) {
|
||||
last_stmt_ptr--;
|
||||
last_stmt = *last_stmt_ptr;
|
||||
|
|
|
@ -353,7 +353,7 @@ protected:
|
|||
}
|
||||
|
||||
bool InspectInstruction(llvm::Instruction &i) override {
|
||||
if (dyn_cast<llvm::LoadInst>(&i) || dyn_cast<llvm::StoreInst>(&i))
|
||||
if (isa<llvm::LoadInst>(&i) || isa<llvm::StoreInst>(&i))
|
||||
RegisterInstruction(i);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1255,7 +1255,7 @@ bool IRForTarget::MaybeHandleVariable(Value *llvm_value_ptr) {
|
|||
m_decl_map->AddValueToStruct(named_decl, lldb_private::ConstString(name),
|
||||
llvm_value_ptr, *value_size,
|
||||
value_alignment);
|
||||
} else if (dyn_cast<llvm::Function>(llvm_value_ptr)) {
|
||||
} else if (isa<llvm::Function>(llvm_value_ptr)) {
|
||||
LLDB_LOG(log, "Function pointers aren't handled right now");
|
||||
|
||||
return false;
|
||||
|
|
|
@ -1280,15 +1280,15 @@ clang::QualType PdbAstBuilder::CreateFunctionType(
|
|||
}
|
||||
|
||||
static bool isTagDecl(clang::DeclContext &context) {
|
||||
return !!llvm::dyn_cast<clang::TagDecl>(&context);
|
||||
return llvm::isa<clang::TagDecl>(&context);
|
||||
}
|
||||
|
||||
static bool isFunctionDecl(clang::DeclContext &context) {
|
||||
return !!llvm::dyn_cast<clang::FunctionDecl>(&context);
|
||||
return llvm::isa<clang::FunctionDecl>(&context);
|
||||
}
|
||||
|
||||
static bool isBlockDecl(clang::DeclContext &context) {
|
||||
return !!llvm::dyn_cast<clang::BlockDecl>(&context);
|
||||
return llvm::isa<clang::BlockDecl>(&context);
|
||||
}
|
||||
|
||||
void PdbAstBuilder::ParseAllNamespacesPlusChildrenOf(
|
||||
|
|
|
@ -402,7 +402,7 @@ static size_t ParseFunctionBlocksForPDBSymbol(
|
|||
block = parent_block;
|
||||
else
|
||||
break;
|
||||
} else if (llvm::dyn_cast<PDBSymbolBlock>(pdb_symbol)) {
|
||||
} else if (llvm::isa<PDBSymbolBlock>(pdb_symbol)) {
|
||||
auto uid = pdb_symbol->getSymIndexId();
|
||||
if (parent_block->FindBlockByID(uid))
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue