diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-07-06 18:19:34 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-07-06 18:19:34 +0000 |
commit | 811c820257746b1799b790b6adc7804f44154011 (patch) | |
tree | a96d9155255424ea05b15f5428216a507daa63bb /lib/Serialization/ASTReader.cpp | |
parent | 814e219fc6d5faeb48e4fd5375843346f2d4a7a7 (diff) |
Don't store pointers into a std::vector (RawCommentList::Comments). Although
currently we take address of std::vector's contents only after we finished
adding all comments (so no reallocation can happen), this will change in
future.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTReader.cpp')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 3d643f6b43..46bd55e83e 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -6284,7 +6284,7 @@ void ASTReader::ClearSwitchCaseIDs() { } void ASTReader::ReadComments() { - std::vector<RawComment> Comments; + std::vector<RawComment *> Comments; for (SmallVectorImpl<std::pair<llvm::BitstreamCursor, serialization::ModuleFile *> >::iterator I = CommentsCursors.begin(), @@ -6325,8 +6325,9 @@ void ASTReader::ReadComments() { (RawComment::CommentKind) Record[Idx++]; bool IsTrailingComment = Record[Idx++]; bool IsAlmostTrailingComment = Record[Idx++]; - Comments.push_back(RawComment(SR, Kind, IsTrailingComment, - IsAlmostTrailingComment)); + Comments.push_back(new (Context) RawComment(SR, Kind, + IsTrailingComment, + IsAlmostTrailingComment)); break; } } |