diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2014-03-27 15:40:39 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2014-03-27 15:40:39 +0000 |
commit | 9ee0e303d68054a8fdb1b071a7de6ddcc8b9ecd9 (patch) | |
tree | 74283e009b02f845e8f8b0d14cba0ef054a81666 /clang/lib/AST/ASTContext.cpp | |
parent | a39fc6dd2afab9cb14286e00f2f6ef2370002c40 (diff) | |
download | bcm5719-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.cpp | 7 |
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; } |