summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-03-26 09:08:15 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-03-26 09:08:15 +0000
commit52cee4dad2de9bed6f552b74391f20c84aee3622 (patch)
treee7e9bb35da701f6180968505cda2fe1a6383fb69 /clang/include
parent70a1369b342e2c3cd39cef7ec70d9115ca63483c (diff)
downloadbcm5719-llvm-52cee4dad2de9bed6f552b74391f20c84aee3622.tar.gz
bcm5719-llvm-52cee4dad2de9bed6f552b74391f20c84aee3622.zip
[Modules] Preserve source order for the map of late parsed templates.
Clang was inserting these into a dense map. While it never iterated the dense map during normal compilation, it did when emitting a module. Fix this by using a standard MapVector to preserve the order in which we encounter the late parsed templates. I suspect this still isn't ideal, as we don't seem to remove things from this map even when we mark the templates as no longer late parsed. But I don't know enough about this particular extension to craft a nice, subtle test case covering this. I've managed to get the stress test to at least do some late parsing and demonstrate the core problem here. This patch fixes the test and provides deterministic behavior which is a strict improvement over the prior state. I've cleaned up some of the code here as well to be explicit about inserting when that is what is actually going on. llvm-svn: 233264
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Sema/ExternalSemaSource.h2
-rw-r--r--clang/include/clang/Sema/MultiplexExternalSemaSource.h4
-rw-r--r--clang/include/clang/Sema/Sema.h4
-rw-r--r--clang/include/clang/Serialization/ASTReader.h4
4 files changed, 7 insertions, 7 deletions
diff --git a/clang/include/clang/Sema/ExternalSemaSource.h b/clang/include/clang/Sema/ExternalSemaSource.h
index 1083784fb7f..430cef7846b 100644
--- a/clang/include/clang/Sema/ExternalSemaSource.h
+++ b/clang/include/clang/Sema/ExternalSemaSource.h
@@ -182,7 +182,7 @@ public:
/// external source should take care not to introduce the same map entries
/// repeatedly.
virtual void ReadLateParsedTemplates(
- llvm::DenseMap<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {}
+ llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap) {}
/// \copydoc Sema::CorrectTypo
/// \note LookupKind must correspond to a valid Sema::LookupNameKind
diff --git a/clang/include/clang/Sema/MultiplexExternalSemaSource.h b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
index 7a57abc0106..5f717891032 100644
--- a/clang/include/clang/Sema/MultiplexExternalSemaSource.h
+++ b/clang/include/clang/Sema/MultiplexExternalSemaSource.h
@@ -331,8 +331,8 @@ public:
/// external source should take care not to introduce the same map entries
/// repeatedly.
void ReadLateParsedTemplates(
- llvm::DenseMap<const FunctionDecl *,
- LateParsedTemplate *> &LPTMap) override;
+ llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap)
+ override;
/// \copydoc ExternalSemaSource::CorrectTypo
/// \note Returns the first nonempty correction.
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index dde928ff914..21fe2e493c2 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -455,8 +455,8 @@ public:
SmallVector<std::pair<CXXMethodDecl*, const FunctionProtoType*>, 2>
DelayedDefaultedMemberExceptionSpecs;
- typedef llvm::DenseMap<const FunctionDecl *, LateParsedTemplate *>
- LateParsedTemplateMapT;
+ typedef llvm::MapVector<const FunctionDecl *, LateParsedTemplate *>
+ LateParsedTemplateMapT;
LateParsedTemplateMapT LateParsedTemplateMap;
/// \brief Callback to the parser to parse templated functions when needed.
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index 1471910db47..f8366f7621a 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -1832,8 +1832,8 @@ public:
SourceLocation> > &Pending) override;
void ReadLateParsedTemplates(
- llvm::DenseMap<const FunctionDecl *,
- LateParsedTemplate *> &LPTMap) override;
+ llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap)
+ override;
/// \brief Load a selector from disk, registering its ID if it exists.
void LoadSelector(Selector Sel);
OpenPOWER on IntegriCloud