]> granicus.if.org Git - clang/commit
Fix evaluation of `__has_include_next` during -frewrite-includes.
authorVolodymyr Sapsai <vsapsai@apple.com>
Fri, 13 Apr 2018 17:43:15 +0000 (17:43 +0000)
committerVolodymyr Sapsai <vsapsai@apple.com>
Fri, 13 Apr 2018 17:43:15 +0000 (17:43 +0000)
commit6b9cd14d397b6dc8541fe9d5fac13e7e538784fc
treea2ff7b8d2031f21a0b9d2011c7ee54a63c84dfc1
parentbb67058712a60c1b5f9c494fec1c4cff0f5f82e4
Fix evaluation of `__has_include_next` during -frewrite-includes.

`__has_include_next` requires correct DirectoryLookup for being
evaluated correctly. We were using Preprocessor::GetCurDirLookup() but
we were calling it after the preprocessor finished its work. And in this
case CurDirLookup is always nullptr which makes `__has_include_next`
behave as `__has_include`.

Fix by storing and using CurDirLookup when preprocessor enters a file,
not when we rewrite the includes.

rdar://problem/36305026

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: jkorous-apple, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330041 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/Rewrite/InclusionRewriter.cpp
test/Frontend/Inputs/NextIncludes/rewrite-includes9.h [new file with mode: 0644]
test/Frontend/Inputs/rewrite-includes9.h [new file with mode: 0644]
test/Frontend/rewrite-includes.c