[all-commits] [llvm/llvm-project] b1a7b7: [lldb][NFCI] Refactor TypeSystemClang::GetBasicTyp...

Alex via All-commits all-commits at lists.llvm.org
Thu Jun 8 15:16:54 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b1a7b7f6d55ed33166008a4d23d598582237b69d
      https://github.com/llvm/llvm-project/commit/b1a7b7f6d55ed33166008a4d23d598582237b69d
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-06-08 (Thu, 08 Jun 2023)

  Changed paths:
    M lldb/include/lldb/Symbol/CompilerType.h
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

  Log Message:
  -----------
  [lldb][NFCI] Refactor TypeSystemClang::GetBasicTypeEnumeration

`TypeSystemClang::GetBasicTypeEnumeration(ConstString)` builds up a
giant `UniqueCStringMap<lldb::BasicType>` which is effectively a vector whose elements
are (ConstString, lldb::BasicType). Once sorted, we get to have fairly
quick lookups (O(log n) on average). This is fine, but we can do better
on average with an llvm::StringMap.

This also allows us to simplify the initialization code for the lookup,
no more `once_flag`!

Additionally, I removed unused declarations of related functions from
CompilerType and TypeSystemClang

Differential Revision: https://reviews.llvm.org/D152315




More information about the All-commits mailing list