[PATCH] Improve #pragma comment(lib) support

Rui Ueyama ruiu at google.com
Thu May 23 19:04:22 PDT 2013


LGTM


On Thu, May 23, 2013 at 6:51 PM, Aaron Ballman <aaron at aaronballman.com>wrote:

> Modified portion of the patch is:
>
>     // If the argument does not end in .lib, automatically add the suffix.
> This
>     // matches the behavior of MSVC.
>     std::string ArgStr = Arg;
>     if (Arg.size() <= 4 ||
>         Arg.substr(Arg.size() - 4).compare_lower(".lib") != 0) {
>       ArgStr += ".lib";
>     }
>     Consumer.HandleDependentLibrary(ArgStr);
>     return;
>
> ~Aaron
>
> On Thu, May 23, 2013 at 5:07 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
> > On Thu, May 23, 2013 at 5:05 PM, Aaron Ballman <aaron at aaronballman.com>
> wrote:
> >> On Thu, May 23, 2013 at 5: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.
> >>
> >> Hmm, that's a good point due to the unsigned subtraction.  Easy enough
> >> to resolve.
> >
> > Also, just caught the formatting issue with the extra spaces; also
> > easy enough to resolve.
> >
> > ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130523/8cfae4f9/attachment.html>


More information about the cfe-commits mailing list