summaryrefslogtreecommitdiff
path: root/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp')
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp47
1 files changed, 24 insertions, 23 deletions
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 4fc340b23c2c7..18f2a1829a419 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -1,19 +1,18 @@
//===-- AppleObjCDeclVendor.cpp ---------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "AppleObjCDeclVendor.h"
#include "Plugins/ExpressionParser/Clang/ASTDumper.h"
+#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/ClangUtil.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Log.h"
@@ -21,6 +20,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
+
using namespace lldb_private;
class lldb_private::AppleObjCExternalASTSource
@@ -63,7 +63,7 @@ public:
non_const_interface_decl->lookup(name);
return (result.size() != 0);
- } while (0);
+ } while (false);
SetNoExternalVisibleDeclsForName(decl_ctx, name);
return false;
@@ -174,9 +174,9 @@ AppleObjCDeclVendor::GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa) {
m_runtime.GetClassDescriptorFromISA(isa);
if (!descriptor)
- return NULL;
+ return nullptr;
- const ConstString &name(descriptor->GetClassName());
+ ConstString name(descriptor->GetClassName());
clang::IdentifierInfo &identifier_info =
ast_ctx->Idents.get(name.GetStringRef());
@@ -204,12 +204,12 @@ public:
ObjCRuntimeMethodType(const char *types) : m_is_valid(false) {
const char *cursor = types;
enum ParserState { Start = 0, InType, InPos } state = Start;
- const char *type = NULL;
+ const char *type = nullptr;
int brace_depth = 0;
uint32_t stepsLeft = 256;
- while (1) {
+ while (true) {
if (--stepsLeft == 0) {
m_is_valid = false;
return;
@@ -262,7 +262,7 @@ public:
m_is_valid = false;
return;
}
- type = NULL;
+ type = nullptr;
} else {
++cursor;
}
@@ -320,7 +320,7 @@ public:
bool instance,
ObjCLanguageRuntime::EncodingToTypeSP type_realizer_sp) {
if (!m_is_valid || m_type_vector.size() < 3)
- return NULL;
+ return nullptr;
clang::ASTContext &ast_ctx(interface_decl->getASTContext());
@@ -355,7 +355,7 @@ public:
clang::IdentifierInfo **identifier_infos = selector_components.data();
if (!identifier_infos) {
- return NULL;
+ return nullptr;
}
clang::Selector sel = ast_ctx.Selectors.getSelector(
@@ -368,12 +368,13 @@ public:
for_expression));
if (ret_type.isNull())
- return NULL;
+ return nullptr;
clang::ObjCMethodDecl *ret = clang::ObjCMethodDecl::Create(
ast_ctx, clang::SourceLocation(), clang::SourceLocation(), sel,
- ret_type, NULL, interface_decl, isInstance, isVariadic, isSynthesized,
- isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType);
+ ret_type, nullptr, interface_decl, isInstance, isVariadic,
+ isSynthesized, isImplicitlyDeclared, isDefined, impControl,
+ HasRelatedResultType);
std::vector<clang::ParmVarDecl *> parm_vars;
@@ -384,12 +385,12 @@ public:
ast_ctx, m_type_vector[ai].c_str(), for_expression));
if (arg_type.isNull())
- return NULL; // well, we just wasted a bunch of time. Wish we could
- // delete the stuff we'd just made!
+ return nullptr; // well, we just wasted a bunch of time. Wish we could
+ // delete the stuff we'd just made!
parm_vars.push_back(clang::ParmVarDecl::Create(
- ast_ctx, ret, clang::SourceLocation(), clang::SourceLocation(), NULL,
- arg_type, NULL, clang::SC_None, NULL));
+ ast_ctx, ret, clang::SourceLocation(), clang::SourceLocation(),
+ nullptr, arg_type, nullptr, clang::SC_None, nullptr));
}
ret->setMethodParams(ast_ctx,
@@ -513,7 +514,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
clang::SourceLocation(), &m_ast_ctx.getASTContext()->Idents.get(name),
ClangUtil::GetQualType(ivar_type),
type_source_info, // TypeSourceInfo *
- clang::ObjCIvarDecl::Public, 0, is_synthesized);
+ clang::ObjCIvarDecl::Public, nullptr, is_synthesized);
if (ivar_decl) {
interface_decl->addDecl(ivar_decl);
@@ -548,7 +549,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
}
uint32_t
-AppleObjCDeclVendor::FindDecls(const ConstString &name, bool append,
+AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
uint32_t max_matches,
std::vector<clang::NamedDecl *> &decls) {
static unsigned int invocation_id = 0;
@@ -647,7 +648,7 @@ AppleObjCDeclVendor::FindDecls(const ConstString &name, bool append,
decls.push_back(iface_decl);
ret++;
break;
- } while (0);
+ } while (false);
return ret;
}