summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-03-27 15:40:39 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-03-27 15:40:39 +0000
commit9ee0e303d68054a8fdb1b071a7de6ddcc8b9ecd9 (patch)
tree74283e009b02f845e8f8b0d14cba0ef054a81666 /clang/lib/AST/ASTContext.cpp
parenta39fc6dd2afab9cb14286e00f2f6ef2370002c40 (diff)
downloadbcm5719-llvm-9ee0e303d68054a8fdb1b071a7de6ddcc8b9ecd9.tar.gz
bcm5719-llvm-9ee0e303d68054a8fdb1b071a7de6ddcc8b9ecd9.zip
Comment parsing: when comment ranges are deserialized from multiple modules,
correctly order comments in SourceManager::isBeforeInTranslationUnit() order Unfortunately, this is not as simple as it was implemented previously, and actually requires doing a merge sort. llvm-svn: 204936
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index c02150a6bc6..1e55521b87c 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -63,6 +63,13 @@ enum FloatingRank {
RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const {
if (!CommentsLoaded && ExternalSource) {
ExternalSource->ReadComments();
+
+#ifndef NDEBUG
+ ArrayRef<RawComment *> RawComments = Comments.getComments();
+ assert(std::is_sorted(RawComments.begin(), RawComments.end(),
+ BeforeThanCompare<RawComment>(SourceMgr)));
+#endif
+
CommentsLoaded = true;
}
OpenPOWER on IntegriCloud