[PATCH] Improve #pragma comment(lib) support

Aaron Ballman aaron at aaronballman.com
Thu May 23 18:36:28 PDT 2013


On Thu, May 23, 2013 at 6:59 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Thu, May 23, 2013 at 3:59 PM, Richard Smith <richard at metafoo.co.uk>
> wrote:
>>
>> On Thu, May 23, 2013 at 2:02 PM, Rui Ueyama <ruiu at google.com> wrote:
>>>
>>> -    Consumer.HandleDependentLibrary(Arg);
>>> +    // If the argument does not end in .lib, automatically add the
>>> suffix. This
>>> +    // matches the behavior of MSVC.
>>> +    std::string ArgStr = Arg;
>>> +    StringRef End = Arg.substr( Arg.size() - 4 );
>>>
>>> Looks like it's not safe if Arg.size() < 4.
>>
>>
>> Please use StringRef::endswith for this.
>
>
> Oh, wait, you want a case-insensitive comparison. :-(

Correct; that way I don't have problems with things like KERNEL32.LIB
(which is not uncommon on Win32).

~Aaron



More information about the cfe-commits mailing list