[cfe-commits] r73821 - in /cfe/trunk: include/clang/AST/Decl.h include/clang/AST/DeclBase.h lib/AST/Decl.cpp

Douglas Gregor dgregor at apple.com
Mon Jun 22 10:19:53 PDT 2009


On Jun 22, 2009, at 10:18 AM, Argyrios Kyrtzidis wrote:

> On Jun 22, 2009, at 9:37 AM, Douglas Gregor wrote:
>
>>
>
>>> bool FunctionDecl::isMain() const {
>>>  return getDeclContext()->getLookupContext()->isTranslationUnit() &&
>>>    getIdentifier() && getIdentifier()->isStr("main");
>>> @@ -481,6 +493,10 @@
>>>    void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
>>>    ParamInfo = new (Mem) ParmVarDecl*[NumParams];
>>>    memcpy(ParamInfo, NewParamInfo, sizeof(ParmVarDecl*)*NumParams);
>>> +
>>> +    // Update source range.
>>> +    if (EndRangeLoc < NewParamInfo[NumParams-1]->getLocEnd())
>>> +      EndRangeLoc = NewParamInfo[NumParams-1]->getLocEnd();
>>>  }
>>> }
>>
>>
>> I don't think we need to use the < here.
>
> This is to allow the flexibility to set EndRangeLoc before setting  
> the parameters.
> i.e. at PCHDeclReader::VisitFunctionDecl, EndRangeLoc is set before  
> the setParams() call. If the check was missing we would have to be  
> careful about the exact order of the calls to "reconstruct" the  
> FunctionDecl.

Ah, okay. Thanks for the clarification!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090622/7aa8941e/attachment.html>


More information about the cfe-commits mailing list