OSDN Git Service

[flang][driver] Add support for `-I` in the new driver
authorFaris Rehman <faris.rehman@arm.com>
Tue, 19 Jan 2021 10:01:38 +0000 (10:01 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Tue, 19 Jan 2021 11:20:56 +0000 (11:20 +0000)
commit87dfd5e012e147f4bfa3a9a4564e9cbc167278ff
tree36335f9bf8280096a9038653357ac5eda3c87a60
parent11f4c58c153cedf6fe04cab49d4a4f02d00e3383
[flang][driver] Add support for `-I` in the new driver

Add support for option -I in the new Flang driver. This will allow for
included headers and module files in other directories, as the default
search path is currently the working folder. The behaviour of this is
consistent with the current f18 driver, where the current folder (i.e.
".") has the highest priority followed by the order of '-I's taking
priority from first to last.

Summary of changes:
- Add SearchDirectoriesFromDashI to PreprocessorOptions, to be forwarded
  into the parser's searchDirectories
- Add header files and non-functional module files to be used in
  regression tests. The module files are just text files and are used to
  demonstrated that paths specified with `-I` are taken into account when
  searching for .mod files.

Differential Revision: https://reviews.llvm.org/D93453
14 files changed:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Flang.cpp
flang/include/flang/Frontend/PreprocessorOptions.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/test/Flang-Driver/Inputs/basic-header-one.h [new file with mode: 0644]
flang/test/Flang-Driver/Inputs/basic-header-two.h [new file with mode: 0644]
flang/test/Flang-Driver/Inputs/basictestmoduleone.mod [new file with mode: 0644]
flang/test/Flang-Driver/Inputs/header-dir/basic-header-one.h [new file with mode: 0644]
flang/test/Flang-Driver/Inputs/header-dir/basic-header-two.h [new file with mode: 0644]
flang/test/Flang-Driver/Inputs/module-dir/basictestmoduletwo.mod [new file with mode: 0644]
flang/test/Flang-Driver/driver-help-hidden.f90
flang/test/Flang-Driver/driver-help.f90
flang/test/Flang-Driver/include-header.f90 [new file with mode: 0644]
flang/test/Flang-Driver/include-module.f90 [new file with mode: 0644]