[all-commits] [llvm/llvm-project] 59dadd: [clang][lex] Fix failures with Microsoft header se...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed Mar 23 06:49:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59dadd178b0b12cb4a975a262ed20e7c3822aedc
      https://github.com/llvm/llvm-project/commit/59dadd178b0b12cb4a975a262ed20e7c3822aedc
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-03-23 (Wed, 23 Mar 2022)

  Changed paths:
    M clang/lib/Lex/HeaderSearch.cpp
    A clang/test/Preprocessor/microsoft-header-search-fail.c

  Log Message:
  -----------
  [clang][lex] Fix failures with Microsoft header search rules

`HeaderSearch` currently assumes `LookupFileCache` is eventually populated in `LookupFile`. However, that's not always the case with `-fms-compatibility` and its early returns.

This patch adds a defensive check that the iterator pulled out of the cache is actually valid before using it.

(This bug was introduced in D119721. Before that, the cache was initialized to `0` - essentially the `search_dir_begin()` iterator.)

Reviewed By: dexonsmith, erichkeane

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




More information about the All-commits mailing list