[cfe-commits] r164892 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/CommentSema.h include/clang/AST/RawCommentList.h include/clang/Lex/Preprocessor.h lib/AST/ASTContext.cpp lib/AST/CommentSema.cpp lib/AST/RawCommentList.cpp li
Dmitri Gribenko
gribozavr at gmail.com
Mon Oct 1 04:44:57 PDT 2012
On Mon, Oct 1, 2012 at 2:34 PM, Alexander Kornienko <alexfh at google.com> wrote:
> On Sat, Sep 29, 2012 at 1:40 PM, Dmitri Gribenko <gribozavr at gmail.com>
> wrote:
>>
>> Author: gribozavr
>> Date: Sat Sep 29 06:40:46 2012
>> New Revision: 164892
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=164892&view=rev
>> Log:
>> Move the 'find macro by spelling' infrastructure to the Preprocessor class
>> and
>> use it to suggest appropriate macro for __attribute__((deprecated)) in
>> -Wdocumentation-deprecated-sync.
>> ...
>> Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
>> ...
>>
>> + /// \brief Return the name of the macro defined before \p Loc that has
>> + /// spelling \p Tokens. If there are multiple macros with same
>> spelling,
>> + /// return the last one defined.
>> + StringRef getLastMacroWithSpelling(SourceLocation Loc,
>> + ArrayRef<TokenValue> Tokens) const;
>
>
> Isn't it more convenient to have a default spelling as a parameter of this
> method so that callers don't have to check if the result is empty?
It seemed to me to violate the principle of single responsibility.
>>
>> + SmallString<64> TextToInsert(AnnotationSpelling);
>> + TextToInsert += "; ";
>
> Over-optimization? ;)
Just the usual thing to use SmallString to avoid dynamic allocations.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list