[PATCH] D35828: Fix incorrect use of current directory to find moved paths in ASTReader.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 03:04:15 PDT 2017


klimek created this revision.

CurrentDir was set as the path of the current module, but that can change as
part of a chain of loaded modules.

When we try to locate a file mentioned in a module that does not exist, we use
a heuristic to look at the relative path between the original location of the
module and the file we look for, and use that relatively to the CurrentDir.

This only works if CurrentDir is the same as the (current) path of the module
file the file was mentioned in; if it is not, we look at the path relatively to
the wrong directory, and can end up reading random unrelated files that happen
to have the same name.

This patch fixes this by using the BaseDirectory of the module file the file
we look for was mentioned in instead of the CurrentDir heuristic.


https://reviews.llvm.org/D35828

Files:
  include/clang/Serialization/ASTReader.h
  lib/Serialization/ASTReader.cpp
  test/Modules/path-resolution.modulemap

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35828.108034.patch
Type: text/x-patch
Size: 4779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170725/a5348281/attachment-0001.bin>


More information about the cfe-commits mailing list