]> granicus.if.org Git - clang/commitdiff
Addressing Doug's suggestions:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 22 Jun 2009 17:13:31 +0000 (17:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 22 Jun 2009 17:13:31 +0000 (17:13 +0000)
-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

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index 77b7bf6a9520bedbbc7bf13160d84603d8690f04..cfb8f940ab271aa41705736b3dc705f0bba83f40 100644 (file)
@@ -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
index bf63932011a2f48390657c3ed96e4471de8c9032..1b1b4fe30be4e74f5442daf1c46fe8f258f51e03 100644 (file)
@@ -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();
 }