Skip to content

Commit 566e407

Browse files
committed
[PCH] Use DenseMap instead of std::map to keep track of SwitchCases.
Part of rdar://11353109. llvm-svn: 156185
1 parent de61326 commit 566e407

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

clang/include/clang/Serialization/ASTReader.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,14 @@ class ASTReader
591591
/// indicates how many separate module file load operations have occurred.
592592
unsigned CurrentGeneration;
593593

594+
typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy;
594595
/// \brief Mapping from switch-case IDs in the chain to switch-case statements
595596
///
596597
/// Statements usually don't have IDs, but switch cases need them, so that the
597598
/// switch statement can refer to them.
598-
std::map<unsigned, SwitchCase *> SwitchCaseStmts;
599+
SwitchCaseMapTy SwitchCaseStmts;
599600

600-
std::map<unsigned, SwitchCase *> *CurrSwitchCaseStmts;
601+
SwitchCaseMapTy *CurrSwitchCaseStmts;
601602

602603
/// \brief The number of stat() calls that hit/missed the stat
603604
/// cache.

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class ASTWriter : public ASTDeserializationListener,
337337
SmallVector<Stmt *, 16> *CollectedStmts;
338338

339339
/// \brief Mapping from SwitchCase statements to IDs.
340-
std::map<SwitchCase *, unsigned> SwitchCaseIDs;
340+
llvm::DenseMap<SwitchCase *, unsigned> SwitchCaseIDs;
341341

342342
/// \brief The number of statements written to the AST file.
343343
unsigned NumStatements;

clang/lib/Serialization/ASTReaderDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) {
631631
// In practice, this won't be executed (since method definitions
632632
// don't occur in header files).
633633
// Switch case IDs for this method body.
634-
std::map<unsigned, SwitchCase *> SwitchCaseStmtsForObjCMethod;
635-
SaveAndRestore<std::map<unsigned, SwitchCase *> *>
634+
ASTReader::SwitchCaseMapTy SwitchCaseStmtsForObjCMethod;
635+
SaveAndRestore<ASTReader::SwitchCaseMapTy *>
636636
SCFOM(Reader.CurrSwitchCaseStmts, &SwitchCaseStmtsForObjCMethod);
637637
MD->setBody(Reader.ReadStmt(F));
638638
MD->setSelfDecl(ReadDeclAs<ImplicitParamDecl>(Record, Idx));

0 commit comments

Comments
 (0)