[all-commits] [llvm/llvm-project] 8503c6: [clang][lex] Keep references to `DirectoryLookup` ...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Jan 11 06:24:58 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8503c688d555014b88849e933bf096035a351586
      https://github.com/llvm/llvm-project/commit/8503c688d555014b88849e933bf096035a351586
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-01-11 (Tue, 11 Jan 2022)

  Changed paths:
    M clang/include/clang/Lex/HeaderSearch.h
    M clang/lib/Lex/HeaderSearch.cpp
    M clang/unittests/Lex/CMakeLists.txt
    M clang/unittests/Lex/HeaderSearchTest.cpp

  Log Message:
  -----------
  [clang][lex] Keep references to `DirectoryLookup` objects up-to-date

The elements of `SearchPath::SearchDirs` are being referenced to by their indices. This proved to be error-prone: `HeaderSearch::SearchDirToHSEntry` was accidentally not being updated in `HeaderSearch::AddSearchPath()`. This patch fixes that by referencing `SearchPath::SearchDirs` elements by their address instead, which is stable thanks to the bump-ptr-allocation strategy.

Reviewed By: ahoppen

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




More information about the All-commits mailing list