[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
Tue Mar 15 03:24:41 PDT 2016


myatsina created this revision.
myatsina added reviewers: rnk, hintonda, rjmccall, dblaikie.
myatsina added a subscriber: cfe-commits.
myatsina set the repository for this revision to rL LLVM.

The purpose of this patch is to keep the same functionality without using LookupResult's implicit copy ctor and assignment operator, because they cause warnings when -Wdeprecated is passed.
This patch is meant to help the following review: http://reviews.llvm.org/D18123.




Repository:
  rL LLVM

http://reviews.llvm.org/D18175

Files:
  lib/Sema/SemaStmtAsm.cpp

Index: lib/Sema/SemaStmtAsm.cpp
===================================================================
--- lib/Sema/SemaStmtAsm.cpp
+++ lib/Sema/SemaStmtAsm.cpp
@@ -623,16 +623,15 @@
 
   if (!LookupName(BaseResult, getCurScope()))
     return true;
-
-  LookupResult CurrBaseResult(BaseResult);
-
+  
+  bool IsSingleRes = BaseResult.isSingleResult();
+  NamedDecl *FoundDecl = BaseResult.getFoundDecl();
   for (StringRef NextMember : Members) {
 
-    if (!CurrBaseResult.isSingleResult())
+    if (!IsSingleRes)
       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)) {
@@ -660,7 +659,8 @@
     if (!FD)
       return true;
 
-    CurrBaseResult = FieldResult;
+    IsSingleRes = FieldResult.isSingleResult();
+    FoundDecl = FieldResult.getFoundDecl();
 
     const ASTRecordLayout &RL = Context.getASTRecordLayout(RT->getDecl());
     unsigned i = FD->getFieldIndex();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18175.50707.patch
Type: text/x-patch
Size: 1110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160315/393bb580/attachment.bin>


More information about the cfe-commits mailing list