r208053 - Support field references to struct names and c++11 aliases from inline asm.
Nico Weber
nicolasweber at gmx.de
Mon May 5 20:13:27 PDT 2014
Author: nico
Date: Mon May 5 22:13:27 2014
New Revision: 208053
URL: http://llvm.org/viewvc/llvm-project?rev=208053&view=rev
Log:
Support field references to struct names and c++11 aliases from inline asm.
This is in addition to the existing support for typedefs.
Modified:
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/test/CodeGen/ms-inline-asm.cpp
Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=208053&r1=208052&r2=208053&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Mon May 5 22:13:27 2014
@@ -441,8 +441,10 @@ bool Sema::LookupInlineAsmField(StringRe
NamedDecl *FoundDecl = BaseResult.getFoundDecl();
if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
RT = VD->getType()->getAs<RecordType>();
- else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(FoundDecl))
+ else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(FoundDecl))
RT = TD->getUnderlyingType()->getAs<RecordType>();
+ else if (TypeDecl *TD = dyn_cast<TypeDecl>(FoundDecl))
+ RT = TD->getTypeForDecl()->getAs<RecordType>();
if (!RT)
return true;
Modified: cfe/trunk/test/CodeGen/ms-inline-asm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.cpp?rev=208053&r1=208052&r2=208053&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.cpp (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.cpp Mon May 5 22:13:27 2014
@@ -1,5 +1,5 @@
// REQUIRES: x86-registered-target
-// RUN: %clang_cc1 -x c++ %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -x c++ %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - -std=c++11 | FileCheck %s
// rdar://13645930
@@ -111,3 +111,33 @@ void test6() {
jmp a
}
}
+
+void t7_struct() {
+ struct A {
+ int a;
+ int b;
+ };
+ __asm mov eax, [eax].A.b
+ // CHECK-LABEL: define void @_Z9t7_structv
+ // CHECK: call void asm sideeffect inteldialect "mov eax, [eax].4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+}
+
+void t7_typedef() {
+ typedef struct {
+ int a;
+ int b;
+ } A;
+ __asm mov eax, [eax].A.b
+ // CHECK-LABEL: define void @_Z10t7_typedefv
+ // CHECK: call void asm sideeffect inteldialect "mov eax, [eax].4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+}
+
+void t7_using() {
+ using A = struct {
+ int a;
+ int b;
+ };
+ __asm mov eax, [eax].A.b
+ // CHECK-LABEL: define void @_Z8t7_usingv
+ // CHECK: call void asm sideeffect inteldialect "mov eax, [eax].4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
+}
More information about the cfe-commits
mailing list