diff options
author | Michael Zuckerman <Michael.zuckerman@intel.com> | 2015-12-15 14:04:18 +0000 |
---|---|---|
committer | Michael Zuckerman <Michael.zuckerman@intel.com> | 2015-12-15 14:04:18 +0000 |
commit | 229158c491ecf257890eac9df5d17fb835c816db (patch) | |
tree | 85aa5d8e9be46967cce2d7df455b461a9a07546e /clang/lib/CodeGen | |
parent | 5acf66ff97843df85a697b38b091cdcc8decbd0a (diff) | |
download | bcm5719-llvm-229158c491ecf257890eac9df5d17fb835c816db.tar.gz bcm5719-llvm-229158c491ecf257890eac9df5d17fb835c816db.zip |
[Microsoft][C++] Clang doesn't support a use of "this" pointer inside inline asm
Clang doesn’t support a use of “this” pointer inside inline asm.
When I tried to compile a class or a struct (see example) with an inline asm that contains "this" pointer.
Clang returns with an error.
This patch fixes that.
error: expected unqualified-id
For example:
'''
struct A {
void f() {
__asm mov eax, this
// error: expected unqualified-id
}
};
'''
Differential Revision: http://reviews.llvm.org/D15115
llvm-svn: 255645
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index e125b805b25..cc4fa2ec597 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -1696,7 +1696,8 @@ llvm::Value* CodeGenFunction::EmitAsmInput( if (Info.allowsRegister() || !Info.allowsMemory()) if (CodeGenFunction::hasScalarEvaluationKind(InputExpr->getType())) return EmitScalarExpr(InputExpr); - + if (InputExpr->getStmtClass() == Expr::CXXThisExprClass) + return EmitScalarExpr(InputExpr); InputExpr = InputExpr->IgnoreParenNoopCasts(getContext()); LValue Dest = EmitLValue(InputExpr); return EmitAsmInputLValue(Info, Dest, InputExpr->getType(), ConstraintStr, |