summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmtAsm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r--clang/lib/Sema/SemaStmtAsm.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp
index 0d32581e8da..1beac366c50 100644
--- a/clang/lib/Sema/SemaStmtAsm.cpp
+++ b/clang/lib/Sema/SemaStmtAsm.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Sema/SemaInternal.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/TargetInfo.h"
@@ -86,6 +87,11 @@ static bool CheckNakedParmReference(Expr *E, Sema &S) {
WorkList.push_back(E);
while (WorkList.size()) {
Expr *E = WorkList.pop_back_val();
+ if (isa<CXXThisExpr>(E)) {
+ S.Diag(E->getLocStart(), diag::err_asm_naked_this_ref);
+ S.Diag(Func->getAttr<NakedAttr>()->getLocation(), diag::note_attribute);
+ return true;
+ }
if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
if (isa<ParmVarDecl>(DRE->getDecl())) {
S.Diag(DRE->getLocStart(), diag::err_asm_naked_parm_ref);
OpenPOWER on IntegriCloud