[PATCH] D18175: Avoid using LookupResult's implicit copy ctor and assignment operator to avoid warnings

Marina Yatsina via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 16 03:02:05 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL263630: Avoid using LookupResult's implicit copy ctor and assignment operator to… (authored by myatsina).

Changed prior to commit:
  http://reviews.llvm.org/D18175?vs=50780&id=50811#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18175

Files:
  cfe/trunk/lib/Sema/SemaStmtAsm.cpp
  cfe/trunk/test/CodeGen/ms-inline-asm-errors.cpp

Index: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp
@@ -623,16 +623,12 @@
 
   if (!LookupName(BaseResult, getCurScope()))
     return true;
-
-  LookupResult CurrBaseResult(BaseResult);
-
+  
+  if(!BaseResult.isSingleResult())
+    return true;
+  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
   for (StringRef NextMember : Members) {
-
-    if (!CurrBaseResult.isSingleResult())
-      return true;
-
     const RecordType *RT = nullptr;
-    NamedDecl *FoundDecl = CurrBaseResult.getFoundDecl();
     if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
       RT = VD->getType()->getAs<RecordType>();
     else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(FoundDecl)) {
@@ -655,13 +651,15 @@
     if (!LookupQualifiedName(FieldResult, RT->getDecl()))
       return true;
 
+    if (!FieldResult.isSingleResult())
+      return true;
+    FoundDecl = FieldResult.getFoundDecl();
+
     // FIXME: Handle IndirectFieldDecl?
-    FieldDecl *FD = dyn_cast<FieldDecl>(FieldResult.getFoundDecl());
+    FieldDecl *FD = dyn_cast<FieldDecl>(FoundDecl);
     if (!FD)
       return true;
 
-    CurrBaseResult = FieldResult;
-
     const ASTRecordLayout &RL = Context.getASTRecordLayout(RT->getDecl());
     unsigned i = FD->getFieldIndex();
     CharUnits Result = Context.toCharUnitsFromBits(RL.getFieldOffset(i));
Index: cfe/trunk/test/CodeGen/ms-inline-asm-errors.cpp
===================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm-errors.cpp
+++ cfe/trunk/test/CodeGen/ms-inline-asm-errors.cpp
@@ -0,0 +1,15 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -x c++ %s -triple i386-apple-darwin10 -std=c++11 -fasm-blocks -verify
+
+class A {
+public:
+  void foo(int a)   {}
+  void foo(float a) {}
+};
+
+
+void t_fail() {
+	__asm {
+		mov ecx, [eax]A.foo // expected-error {{Unable to lookup field reference!}}
+	}
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18175.50811.patch
Type: text/x-patch
Size: 2016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160316/a1df133d/attachment.bin>


More information about the cfe-commits mailing list