[PATCH] D92160: [clang] Fix wrong FDs are used for files with same name in Tooling

Ella Ma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 02:12:05 PST 2020


OikawaKirie created this revision.
OikawaKirie added reviewers: dexonsmith, harlanhaskins, rsmith, arphaman, MaskRay, bkramer, ilya-biryukov.
OikawaKirie added a project: clang.
Herald added a subscriber: cfe-commits.
OikawaKirie requested review of this revision.

ClangTool will make FileManager mix up two header files with the same relative path in different absolute paths.

As the cache of previously opened FileEntry in FileManager is indexed by the file name, when relative paths are used as the index, wrong FileEntry may be used for the file with the same relative path. With ClangTool, as the current working directory will change when parsing multiple files, files with the same relative paths but different absolute paths will be mixed up by the FileManager.

Submit on behalf of Hao Zhang <zhh at ios.ac.cn>, I will forward the reviews and his replies.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92160

Files:
  clang/include/clang/Basic/FileManager.h
  clang/lib/Basic/FileManager.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/test/Tooling/multiple-source-include-different-header-with-same-relative-path.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92160.307788.patch
Type: text/x-patch
Size: 22653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201126/a2264571/attachment-0001.bin>


More information about the cfe-commits mailing list