diff options
author | Peter Klausler <pklausler@nvidia.com> | 2022-01-26 09:54:58 -0800 |
---|---|---|
committer | Peter Klausler <pklausler@nvidia.com> | 2022-01-31 13:31:27 -0800 |
commit | 52a1346b78b0971b6a89c53a6881cb9655e81245 (patch) | |
tree | f56f474c7e331fa1e7fe851fbc5863687b074bac /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | 8cb9c7360944b1e4dd2e8125a48ede3628b459f1 (diff) | |
download | llvm-52a1346b78b0971b6a89c53a6881cb9655e81245.zip llvm-52a1346b78b0971b6a89c53a6881cb9655e81245.tar.gz llvm-52a1346b78b0971b6a89c53a6881cb9655e81245.tar.bz2 |
[flang] Distinguish intrinsic from non-intrinsic modules
For "USE, INTRINSIC", search only for intrinsic modules;
for "USE, NON_INTRINSIC", do not recognize intrinsic modules.
Allow modules of both kinds with the same name to be used in
the same source file (but not in the same scoping unit, a
constraint of the standard that is now enforced).
The symbol table's scope tree now has a single instance of
a scope with a new kind, IntrinsicModules, whose children are
the USE'd intrinsic modules (explicit or not). This separate
"top-level" scope is a child of the single global scope and
it allows both intrinsic and non-intrinsic modules of the same
name to exist in the symbol table. Intrinsic modules' scopes'
symbols now have the INTRINSIC attribute set.
The search path directories need to make a distinction between
regular directories and the one(s) that point(s) to intrinsic
modules. I allow for multiple intrinsic module directories in
the second search path, although only one is needed today.
Differential Revision: https://reviews.llvm.org/D118631
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | flang/lib/Frontend/CompilerInvocation.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 2d8c9e3..dcfa741 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -658,8 +658,8 @@ void CompilerInvocation::SetFortranOpts() { preprocessorOptions.searchDirectoriesFromIntrModPath.begin(), preprocessorOptions.searchDirectoriesFromIntrModPath.end()); - // Add the default intrinsic module directory at the end - fortranOptions.searchDirectories.emplace_back(getIntrinsicDir()); + // Add the default intrinsic module directory + fortranOptions.intrinsicModuleDirectories.emplace_back(getIntrinsicDir()); // Add the directory supplied through -J/-module-dir to the list of search // directories @@ -686,6 +686,7 @@ void CompilerInvocation::SetSemanticsOpts( semanticsContext_->set_moduleDirectory(moduleDir()) .set_searchDirectories(fortranOptions.searchDirectories) + .set_intrinsicModuleDirectories(fortranOptions.intrinsicModuleDirectories) .set_warnOnNonstandardUsage(enableConformanceChecks()) .set_warningsAreErrors(warnAsErr()) .set_moduleFileSuffix(moduleFileSuffix()); |