On Mon, Oct 1, 2012 at 2:34 PM, Alexander Kornienko <[email protected]> wrote:
> On Sat, Sep 29, 2012 at 1:40 PM, Dmitri Gribenko <[email protected]>
> 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 <[email protected]>*/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to