[PATCH] Diagnose jumping from one MS inline assembly block to another.

Reid Kleckner rnk at google.com
Tue Oct 7 17:09:26 PDT 2014


================
Comment at: lib/Sema/JumpDiagnostics.cpp:496
@@ -487,1 +495,3 @@
 void JumpScopeChecker::VerifyJumps() {
+  std::map<StringRef, MSAsmStmt*> LabelProvider;
+  for (Stmt *J : Jumps) {
----------------
ehsan wrote:
> rnk wrote:
> > At a high level, I feel like we shouldn't need this map. It basically reinvents the label name lookup that sema is already performing for us.
> > 
> > What if we changed LabelDecl to hold an MSAsmStmt*? Conceptually, we could make TheStmt be a Stmt* and getStmt() could be 'return dyn_cast_or_null<LabelStmt>(TheStmt);'.
> How do we get the corresponding MSAsmStmt* though?  LookupInlineAsmLabel doesn't have access to that information.
Right, but it could record them in the ClangAsmParserCallback and forward it on to ActOnMSAsmStmt. At that point if there are any label decls that weren't provided by the current asm statement, we can diagnose them.

http://reviews.llvm.org/D5516






More information about the cfe-commits mailing list