diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-06-22 17:13:31 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-06-22 17:13:31 +0000 |
commit | 1a5364e0fa0482d8d477d6f136d52e503bbe13f4 (patch) | |
tree | 72c00e4a347415f345939bbbe95138dd09cb7781 | |
parent | c1005ac71f48ac8637ff1193a2ad9d6eb67fcf3d (diff) |
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
-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(); } |