[PATCH] ms-inline-asm: Scope inline asm labels to functions

Ehsan Akhgari ehsan.akhgari at gmail.com
Fri Jul 18 12:17:34 PDT 2014


Hi rnk,

This fixes PR20023.  In order to implement this scoping rule, we maintain
a map from the label's name as it appears in the source code to an internal
name which is guaranteed to be an invalid mangled name.  Every time that we
encounter a label, we add an entry to this internal map, and when we fail
to parse something as a valid identifier, we get a LookupInlineAsmLabel
callback from MC which allows us to optimistically interpret the identifier
as a label name.  By the time that we pop the function's scope, we go
through this map, and for each entry verify that we have seen a label
somewhere in the function body, and emit a diagnostic otherwise.  This has
the undesired side effect that for some unknown names, we may issue an
extra diagnostic (as can be seen in test/Sema/ms-inline-asm.c.

http://reviews.llvm.org/D4589

Files:
  include/clang/Sema/Sema.h
  lib/Parse/ParseStmtAsm.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaStmtAsm.cpp
  test/CodeGen/mozilla-ms-inline-asm.c
  test/CodeGen/ms-inline-asm.c
  test/Parser/ms-inline-asm.c
  test/Sema/ms-inline-asm.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4589.11659.patch
Type: text/x-patch
Size: 12618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140718/3693c1e5/attachment.bin>


More information about the cfe-commits mailing list