diff options
-rw-r--r-- | include/clang/AST/Decl.h | 7 | ||||
-rw-r--r-- | lib/AST/Decl.cpp | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 77b7bf6a95..cfb8f940ab 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -647,6 +647,13 @@ private: // Move to DeclGroup when it is implemented. SourceLocation TypeSpecStartLoc; + /// \brief End part of this FunctionDecl's source range. + /// + /// We could compute the full range in getSourceRange(). However, when we're + /// dealing with a function definition deserialized from a PCH/AST file, + /// we can only compute the full range once the function body has been + /// de-serialized, so it's far better to have the (sometimes-redundant) + /// EndRangeLoc. SourceLocation EndRangeLoc; /// \brief The template or declaration that this declaration diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index bf63932011..1b1b4fe30b 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -379,7 +379,7 @@ Stmt *FunctionDecl::getBodyIfAvailable() const { void FunctionDecl::setBody(Stmt *B) { Body = B; - if (B && EndRangeLoc < B->getLocEnd()) + if (B) EndRangeLoc = B->getLocEnd(); } |