Handle MS-style inline assembly in clang-modernize

Reid Kleckner rnk at google.com
Mon Nov 24 14:41:33 PST 2014


On Mon, Nov 24, 2014 at 2:30 PM, Nikola Smiljanic <popizdeh at gmail.com>
wrote:

>
> On Tue, Nov 25, 2014 at 8:59 AM, Reid Kleckner <rnk at google.com> wrote:
>
>> If Clang is configured without x86 backend support, there will be linker
>> errors here. I believe we have a wrapper called
>> InitializeAllRegisteredTargets() and some cmake way to link in all target
>> libraries. We could just do that.
>>
>
> Yeah, I saw those functions but they seemed like an overkill. This is only
> needed for x86 as Microsoft doesn't allow inline assembly on x64. Plus I
> didn't want to spend two hours figuring out what libraries to link against.
> I'm OK with initializing all targets if that makes sense? Any ideas where I
> can find that cmake magic?
>
> It might also be better to make it so that tools can easily recover with a
>> partial AST in this situation. They won't be able to see if the inline asm
>> blob uses any parameters so any refactorings could possibly be broken, but
>> that was already the case for clang-modernize.
>>
>
> I don't follow :)
>

Your proposed fix only works for clang-modernize, but not clang-tidy or
libclang clients. I'm saying it'd be nice if we could make it easy for
tools to recover from this error instead of trying to fix it by pulling in
the whole LLVM x86 backend. None of these tools should attempt to refactor
system headers, for example, so ignoring functions with __asm blocks is
probably good enough.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141124/e41c6b39/attachment.html>


More information about the cfe-commits mailing list