Etch out the code path for MS-style inline assembly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158325 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp
index cea8a76..7eba772 100644
--- a/lib/Sema/AnalysisBasedWarnings.cpp
+++ b/lib/Sema/AnalysisBasedWarnings.cpp
@@ -189,6 +189,12 @@
continue;
}
}
+ if (isa<MSAsmStmt>(S)) {
+ // TODO: Verify this is correct.
+ HasFakeEdge = true;
+ HasLiveReturn = true;
+ continue;
+ }
if (isa<CXXTryStmt>(S)) {
HasAbnormalEdge = true;
continue;
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 0e39314..fb82890 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -2670,6 +2670,15 @@
return Owned(NS);
}
+StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
+ std::string &AsmString,
+ SourceLocation EndLoc) {
+ MSAsmStmt *NS =
+ new (Context) MSAsmStmt(Context, AsmLoc, AsmString, EndLoc);
+
+ return Owned(NS);
+}
+
StmtResult
Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
SourceLocation RParen, Decl *Parm,
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 01b82aa..08c7d7d 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -1179,6 +1179,16 @@
RParenLoc, MSAsm);
}
+ /// \brief Build a new MS style inline asm statement.
+ ///
+ /// By default, performs semantic analysis to build the new statement.
+ /// Subclasses may override this routine to provide different behavior.
+ StmtResult RebuildMSAsmStmt(SourceLocation AsmLoc,
+ std::string &AsmString,
+ SourceLocation EndLoc) {
+ return getSema().ActOnMSAsmStmt(AsmLoc, AsmString, EndLoc);
+ }
+
/// \brief Build a new Objective-C @try statement.
///
/// By default, performs semantic analysis to build the new statement.
@@ -5602,6 +5612,14 @@
S->isMSAsm());
}
+template<typename Derived>
+StmtResult
+TreeTransform<Derived>::TransformMSAsmStmt(MSAsmStmt *S) {
+ // No need to transform the asm string literal.
+ return getDerived().RebuildMSAsmStmt(S->getAsmLoc(),
+ *S->getAsmString(),
+ S->getEndLoc());
+}
template<typename Derived>
StmtResult