diff options
author | Bruno Ricci <riccibrun@gmail.com> | 2018-10-30 14:40:49 +0000 |
---|---|---|
committer | Bruno Ricci <riccibrun@gmail.com> | 2018-10-30 14:40:49 +0000 |
commit | 023b1d19f3de5ed7cec535295bf0d7a9f99ea561 (patch) | |
tree | d64648f8548f834e3bfb961785dcf5e665e832ed /clang/lib/Serialization/ASTWriterStmt.cpp | |
parent | 92964e74a55592b8a6d9ee6e6b5edf29ed83233e (diff) | |
download | bcm5719-llvm-023b1d19f3de5ed7cec535295bf0d7a9f99ea561.tar.gz bcm5719-llvm-023b1d19f3de5ed7cec535295bf0d7a9f99ea561.zip |
[AST] Only store data for the NRVO candidate in ReturnStmt if needed
Only store the NRVO candidate if needed in ReturnStmt.
A good chuck of all of the ReturnStmt have no NRVO candidate
(more than half when parsing all of Boost). For all of them
this saves one pointer. This has no impact on children().
Differential Revision: https://reviews.llvm.org/D53716
Reviewed By: rsmith
llvm-svn: 345605
Diffstat (limited to 'clang/lib/Serialization/ASTWriterStmt.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index 3d0297153d8..2b0c95229d8 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -249,9 +249,15 @@ void ASTStmtWriter::VisitBreakStmt(BreakStmt *S) { void ASTStmtWriter::VisitReturnStmt(ReturnStmt *S) { VisitStmt(S); + + bool HasNRVOCandidate = S->getNRVOCandidate() != nullptr; + Record.push_back(HasNRVOCandidate); + Record.AddStmt(S->getRetValue()); + if (HasNRVOCandidate) + Record.AddDeclRef(S->getNRVOCandidate()); + Record.AddSourceLocation(S->getReturnLoc()); - Record.AddDeclRef(S->getNRVOCandidate()); Code = serialization::STMT_RETURN; } |