[cfe-commits] r126943 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp lib/Serialization/ASTReaderDecl.cpp lib/Serialization/ASTWriterDecl.cpp test/Index/recursive-cxx-member-calls.cpp

Douglas Gregor dgregor at apple.com
Thu Mar 3 07:42:59 PST 2011


On Mar 3, 2011, at 7:16 AM, Abramo Bagnara wrote:

> Il 03/03/2011 16:02, Douglas Gregor ha scritto:
>> 
>> On Mar 3, 2011, at 6:52 AM, Abramo Bagnara wrote:
>> 
>>> Author: abramo
>>> Date: Thu Mar  3 08:52:38 2011
>>> New Revision: 126943
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=126943&view=rev
>>> Log:
>>> Fixed end source location for LinkageSpecDecl.
>>> 
>>> Modified:
>>>   cfe/trunk/include/clang/AST/DeclCXX.h
>>>   cfe/trunk/lib/AST/DeclCXX.cpp
>>>   cfe/trunk/lib/Sema/SemaDeclCXX.cpp
>>>   cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
>>>   cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
>>>   cfe/trunk/test/Index/recursive-cxx-member-calls.cpp
>>> 
>>> Modified: cfe/trunk/include/clang/AST/DeclCXX.h
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=126943&r1=126942&r2=126943&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
>>> +++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Mar  3 08:52:38 2011
>>> @@ -1711,18 +1711,21 @@
>>>  /// Language - The language for this linkage specification.
>>>  LanguageIDs Language;
>>> 
>>> -  /// HadBraces - Whether this linkage specification had curly braces or not.
>>> -  bool HadBraces : 1;
>>> +  /// LBraceLoc - The source location for the left brace (if valid).
>>> +  SourceLocation LBraceLoc;
>>> +  /// RBraceLoc - The source location for the right brace (if valid).
>>> +  SourceLocation RBraceLoc;
>> 
>> Do we really need the left-brace location? It doesn't seem like we have to have it, and I'd rather not grow the size of the AST any more than we absolutely have to to make source ranges correct.
> 
> ... we have done our best to support the comment we've found:
> 
>  void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
>   VisitDecl(D);
> -  // FIXME: It might be nice to serialize the brace locations for this
> -  // declaration, which don't seem to be readily available in the AST.
>   Record.push_back(D->getLanguage());
> -  Record.push_back(D->hasBraces());
> +  Writer.AddSourceLocation(D->getLBraceLoc(), Record);
> +  Writer.AddSourceLocation(D->getRBraceLoc(), Record);
>   Code = serialization::DECL_LINKAGE_SPEC;
> }

> Still do you prefer I remove the left-brace location?


Yes. Just having the right brace reduces the memory footprint and provides everything we need to get source ranges right.

  - Doug



More information about the cfe-commits mailing list