This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Merge adjacent single-line __asm blocks
ClosedPublic

Authored by ehsan on Jul 19 2014, 6:20 PM.

Details

Summary

This patch extends the asm parser to make it keep parsing input tokens
as inline assembly if a single-line
asm line is followed by another line
starting with __asm too. It also makes sure that we correctly keep
matching braces in such situations by separating the notions of how many
braces we are matching and whether we are in single-line asm block mode.

Diff Detail

Repository
rL LLVM

Event Timeline

ehsan updated this revision to Diff 11688.Jul 19 2014, 6:20 PM
ehsan retitled this revision from to clang-cl: Merge adjacent single-line __asm blocks.
ehsan updated this object.
ehsan edited the test plan for this revision. (Show Details)
ehsan added reviewers: rnk, majnemer.
ehsan added a subscriber: Unknown Object (MLST).
rnk edited edge metadata.Jul 23 2014, 5:41 PM

Nice!

lib/Parse/ParseStmtAsm.cpp
413–416 ↗(On Diff #11688)

Apple's gcc was always attempting to implement MSVC's asm block behavior. I don't think we need to emulate Apple gcc, especially now that it is dead for good. I would drop the MicrosoftExt check here.

test/CodeGen/ms-inline-asm.c
2 ↗(On Diff #11688)

If you agree with the other comment, remember to revert this flag change.

147 ↗(On Diff #11688)

A lot of these changes make the tests harder to read and understand.

The tests from here on down are mostly testing the name lookup, and I think are best structured along the lines of:

{ __asm mov eax, WeirdCXXIdentifier }
// CHECK: call void asm ...
{ __asm mov eax, WeirdCXX::Identifier }
// CHECK: call void asm ...

That way we can keep the CHECK lines separate.

ehsan closed this revision.Jul 24 2014, 7:36 PM
ehsan updated this revision to Diff 11864.

Closed by commit rL213916 (authored by @ehsan).