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

Ehsan Akhgari ehsan.akhgari at gmail.com
Wed Sep 17 11:21:36 PDT 2014


Updated the patch to use the LabelDecl machinery.

Note that there are a couple of issues with the diagnostics that I'm generating (see the TODO comments.)

The first issue is that I currently diagnose jumping to an asm label from a goto statement in ActOnGotoStmt, which means that we currently can't diagnose the case where we first see the goto statement, generate an implicit label from it, and later on see an asm block which defines a label with that name.  The reason why the proper diagnostic is hard is that I don't know where the right place to perform it is.  Note that we need access to the SourceLocation of the GotoStmt and also to the SourceLocation of the place where the label is declared in the asm block.

The second issue with the diagnostics is that as I'm generating the "use of undeclared label" error, I only have access to the LabelDecl and its location, which means that for example the diagnostic in t10 in test/Sema/ms-inline-asm.c is misplaced.

Any help with fixing the above two issues is appreciated.

Also, I have tested most of the combinations of goto's, jumps and asm/non-asm labels that I have thought of, but I may have missed something.  If you see cases for which I have not included a test case, please point them out!

http://reviews.llvm.org/D4589

Files:
  include/clang/AST/Decl.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/Sema.h
  lib/Parse/ParseStmtAsm.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaStmt.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.13793.patch
Type: text/x-patch
Size: 14892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140917/82c109a4/attachment.bin>


More information about the cfe-commits mailing list