From: Argyrios Kyrtzidis Date: Mon, 22 Jun 2009 17:13:31 +0000 (+0000) Subject: Addressing Doug's suggestions: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a5364e0fa0482d8d477d6f136d52e503bbe13f4;p=clang Addressing Doug's suggestions: -Added comment for FunctionDecl::EndRangeLoc -Removed a redundant check from FunctionDecl::setBody git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73886 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(); }