[Lldb-commits] [lldb] 3f944a8 - [lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 14 05:26:50 PST 2020


Author: Raphael Isemann
Date: 2020-01-14T14:26:29+01:00
New Revision: 3f944a8b8ca895667f04748f62d350f07ee1416b

URL: https://github.com/llvm/llvm-project/commit/3f944a8b8ca895667f04748f62d350f07ee1416b
DIFF: https://github.com/llvm/llvm-project/commit/3f944a8b8ca895667f04748f62d350f07ee1416b.diff

LOG: [lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRef

Added: 
    

Modified: 
    lldb/include/lldb/Symbol/ClangASTContext.h
    lldb/source/Symbol/ClangASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h
index b59ada2a3df4..338417b20b8a 100644
--- a/lldb/include/lldb/Symbol/ClangASTContext.h
+++ b/lldb/include/lldb/Symbol/ClangASTContext.h
@@ -768,13 +768,11 @@ class ClangASTContext : public TypeSystem {
                                                  const CompilerType &var_type,
                                                  lldb::AccessType access);
 
-  clang::CXXMethodDecl *
-  AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name,
-                           const char *mangled_name,
-                           const CompilerType &method_type,
-                           lldb::AccessType access, bool is_virtual,
-                           bool is_static, bool is_inline, bool is_explicit,
-                           bool is_attr_used, bool is_artificial);
+  clang::CXXMethodDecl *AddMethodToCXXRecordType(
+      lldb::opaque_compiler_type_t type, llvm::StringRef name,
+      const char *mangled_name, const CompilerType &method_type,
+      lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline,
+      bool is_explicit, bool is_attr_used, bool is_artificial);
 
   void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type);
 

diff  --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 78310adbdab4..ac3bce179d9e 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -7116,12 +7116,11 @@ clang::VarDecl *ClangASTContext::AddVariableToRecordType(
 }
 
 clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType(
-    lldb::opaque_compiler_type_t type, const char *name, const char *mangled_name,
-    const CompilerType &method_clang_type, lldb::AccessType access,
-    bool is_virtual, bool is_static, bool is_inline, bool is_explicit,
-    bool is_attr_used, bool is_artificial) {
-  if (!type || !method_clang_type.IsValid() || name == nullptr ||
-      name[0] == '\0')
+    lldb::opaque_compiler_type_t type, llvm::StringRef name,
+    const char *mangled_name, const CompilerType &method_clang_type,
+    lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline,
+    bool is_explicit, bool is_attr_used, bool is_artificial) {
+  if (!type || !method_clang_type.IsValid() || name.empty())
     return nullptr;
 
   clang::QualType record_qual_type(GetCanonicalQualType(type));
@@ -7162,7 +7161,7 @@ clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType(
       nullptr /*expr*/, is_explicit
                             ? clang::ExplicitSpecKind::ResolvedTrue
                             : clang::ExplicitSpecKind::ResolvedFalse);
-  if (name[0] == '~') {
+  if (name.startswith("~")) {
     cxx_dtor_decl = clang::CXXDestructorDecl::Create(
         getASTContext(), cxx_record_decl, clang::SourceLocation(),
         clang::DeclarationNameInfo(


        


More information about the lldb-commits mailing list