From 12dcc64eebf7aaffb71392fba74fcb69f35d3b2e Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 4 May 2012 18:17:30 +0000 Subject: [PATCH] [PCH] Use DenseMap instead of std::map to keep track of SwitchCases. Part of rdar://11353109. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156185 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Serialization/ASTReader.h | 5 +++-- include/clang/Serialization/ASTWriter.h | 2 +- lib/Serialization/ASTReaderDecl.cpp | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 11e237e5b5..d9af6d74af 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -591,13 +591,14 @@ private: /// indicates how many separate module file load operations have occurred. unsigned CurrentGeneration; + typedef llvm::DenseMap SwitchCaseMapTy; /// \brief Mapping from switch-case IDs in the chain to switch-case statements /// /// Statements usually don't have IDs, but switch cases need them, so that the /// switch statement can refer to them. - std::map SwitchCaseStmts; + SwitchCaseMapTy SwitchCaseStmts; - std::map *CurrSwitchCaseStmts; + SwitchCaseMapTy *CurrSwitchCaseStmts; /// \brief The number of stat() calls that hit/missed the stat /// cache. diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index e693f17593..16c3766f8f 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -337,7 +337,7 @@ private: SmallVector *CollectedStmts; /// \brief Mapping from SwitchCase statements to IDs. - std::map SwitchCaseIDs; + llvm::DenseMap SwitchCaseIDs; /// \brief The number of statements written to the AST file. unsigned NumStatements; diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index dc315f095c..1c5b658469 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -631,8 +631,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { // In practice, this won't be executed (since method definitions // don't occur in header files). // Switch case IDs for this method body. - std::map SwitchCaseStmtsForObjCMethod; - SaveAndRestore *> + ASTReader::SwitchCaseMapTy SwitchCaseStmtsForObjCMethod; + SaveAndRestore SCFOM(Reader.CurrSwitchCaseStmts, &SwitchCaseStmtsForObjCMethod); MD->setBody(Reader.ReadStmt(F)); MD->setSelfDecl(ReadDeclAs(Record, Idx)); -- 2.40.0