[Lldb-commits] [lldb] r219964 - Rework this code so that it does not trigger a compiler warning. NFC

Enrico Granata egranata at apple.com
Thu Oct 16 14:18:58 PDT 2014


Author: enrico
Date: Thu Oct 16 16:18:58 2014
New Revision: 219964

URL: http://llvm.org/viewvc/llvm-project?rev=219964&view=rev
Log:
Rework this code so that it does not trigger a compiler warning. NFC

Modified:
    lldb/trunk/source/DataFormatters/NSDictionary.cpp

Modified: lldb/trunk/source/DataFormatters/NSDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/NSDictionary.cpp?rev=219964&r1=219963&r2=219964&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/NSDictionary.cpp (original)
+++ lldb/trunk/source/DataFormatters/NSDictionary.cpp Thu Oct 16 16:18:58 2014
@@ -47,18 +47,12 @@ GetLLDBNSPairType (TargetSP target_sp)
 
             clang::DeclContext::lookup_const_result result = ast->getTranslationUnitDecl()->lookup(myName);
 
-            for (clang::NamedDecl *named_decl : result)
+            if (!result.empty())
             {
+                clang::NamedDecl *named_decl = result[0];
                 if (const clang::CXXRecordDecl *record_decl = llvm::dyn_cast<clang::CXXRecordDecl>(named_decl))
-                {
                     clang_type.SetClangType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
-                    break;
-                }
-                else
-                {
-                    // somebody else (the user?) has defined a type with the magic name already - fail!!!
-                    return clang_type;
-                }
+                return clang_type;
             }
 
             if (!clang_type)





More information about the lldb-commits mailing list