mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
[clang] Use DenseMapBase::lookup (NFC)
This commit is contained in:
parent
0df7e9f886
commit
c4933940f7
@ -69,12 +69,7 @@ static bool isIncompletePhi(const til::SExpr *E) {
|
||||
|
||||
using CallingContext = SExprBuilder::CallingContext;
|
||||
|
||||
til::SExpr *SExprBuilder::lookupStmt(const Stmt *S) {
|
||||
auto It = SMap.find(S);
|
||||
if (It != SMap.end())
|
||||
return It->second;
|
||||
return nullptr;
|
||||
}
|
||||
til::SExpr *SExprBuilder::lookupStmt(const Stmt *S) { return SMap.lookup(S); }
|
||||
|
||||
til::SCFG *SExprBuilder::buildCFG(CFGWalker &Walker) {
|
||||
Walker.walk(*this);
|
||||
|
@ -249,10 +249,7 @@ APIRecord *APISet::findRecordForUSR(StringRef USR) const {
|
||||
if (USR.empty())
|
||||
return nullptr;
|
||||
|
||||
auto It = USRBasedLookupTable.find(USR);
|
||||
if (It != USRBasedLookupTable.end())
|
||||
return It->second;
|
||||
return nullptr;
|
||||
return USRBasedLookupTable.lookup(USR);
|
||||
}
|
||||
|
||||
StringRef APISet::recordUSR(const Decl *D) {
|
||||
|
@ -381,12 +381,7 @@ PreprocessingRecord::getLoadedPreprocessedEntity(unsigned Index) {
|
||||
|
||||
MacroDefinitionRecord *
|
||||
PreprocessingRecord::findMacroDefinition(const MacroInfo *MI) {
|
||||
llvm::DenseMap<const MacroInfo *, MacroDefinitionRecord *>::iterator Pos =
|
||||
MacroDefinitions.find(MI);
|
||||
if (Pos == MacroDefinitions.end())
|
||||
return nullptr;
|
||||
|
||||
return Pos->second;
|
||||
return MacroDefinitions.lookup(MI);
|
||||
}
|
||||
|
||||
void PreprocessingRecord::addMacroExpansion(const Token &Id,
|
||||
|
@ -59,11 +59,7 @@ ModuleFile *ModuleManager::lookupByModuleName(StringRef Name) const {
|
||||
}
|
||||
|
||||
ModuleFile *ModuleManager::lookup(const FileEntry *File) const {
|
||||
auto Known = Modules.find(File);
|
||||
if (Known == Modules.end())
|
||||
return nullptr;
|
||||
|
||||
return Known->second;
|
||||
return Modules.lookup(File);
|
||||
}
|
||||
|
||||
std::unique_ptr<llvm::MemoryBuffer>
|
||||
|
@ -970,12 +970,7 @@ void CXIndexDataConsumer::addContainerInMap(const DeclContext *DC,
|
||||
}
|
||||
|
||||
CXIdxClientEntity CXIndexDataConsumer::getClientEntity(const Decl *D) const {
|
||||
if (!D)
|
||||
return nullptr;
|
||||
EntityMapTy::const_iterator I = EntityMap.find(D);
|
||||
if (I == EntityMap.end())
|
||||
return nullptr;
|
||||
return I->second;
|
||||
return D ? EntityMap.lookup(D) : nullptr;
|
||||
}
|
||||
|
||||
void CXIndexDataConsumer::setClientEntity(const Decl *D, CXIdxClientEntity client) {
|
||||
@ -1079,25 +1074,11 @@ CXIndexDataConsumer::getEntityContainer(const Decl *D) const {
|
||||
|
||||
CXIdxClientContainer
|
||||
CXIndexDataConsumer::getClientContainerForDC(const DeclContext *DC) const {
|
||||
if (!DC)
|
||||
return nullptr;
|
||||
|
||||
ContainerMapTy::const_iterator I = ContainerMap.find(DC);
|
||||
if (I == ContainerMap.end())
|
||||
return nullptr;
|
||||
|
||||
return I->second;
|
||||
return DC ? ContainerMap.lookup(DC) : nullptr;
|
||||
}
|
||||
|
||||
CXIdxClientFile CXIndexDataConsumer::getIndexFile(const FileEntry *File) {
|
||||
if (!File)
|
||||
return nullptr;
|
||||
|
||||
FileMapTy::iterator FI = FileMap.find(File);
|
||||
if (FI != FileMap.end())
|
||||
return FI->second;
|
||||
|
||||
return nullptr;
|
||||
return File ? FileMap.lookup(File) : nullptr;
|
||||
}
|
||||
|
||||
CXIdxLoc CXIndexDataConsumer::getIndexLoc(SourceLocation Loc) const {
|
||||
|
Loading…
Reference in New Issue
Block a user