This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
jansvoboda11 marked an inline comment as done.
Closed by commit rGe19f352beee7: [clang][lex] NFCI: Use DirectoryEntryRef in
Preprocessor::MainFileDir (authored by jansvoboda11).
Changed prior to commit:
https://reviews.llvm.org/D127660?vs=436422=526781#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127660/new/
https://reviews.llvm.org/D127660
Files:
clang/include/clang/Lex/Preprocessor.h
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Lex/PPDirectives.cpp
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -956,7 +956,7 @@
// map file.
if (!FileEnt) {
if (FID == SourceMgr.getMainFileID() && MainFileDir) {
-Includers.push_back(std::make_pair(nullptr, MainFileDir));
+Includers.push_back(std::make_pair(nullptr, *MainFileDir));
BuildSystemModule = getCurrentModule()->IsSystem;
} else if ((FileEnt =
SourceMgr.getFileEntryForID(SourceMgr.getMainFileID(
Index: clang/lib/Frontend/FrontendAction.cpp
===
--- clang/lib/Frontend/FrontendAction.cpp
+++ clang/lib/Frontend/FrontendAction.cpp
@@ -511,7 +511,7 @@
// Inform the preprocessor that includes from within the input buffer should
// be resolved relative to the build directory of the module map file.
- CI.getPreprocessor().setMainFileDir(M->Directory);
+ CI.getPreprocessor().setMainFileDir(*M->Directory);
// If the module was inferred from a different module map (via an expanded
// umbrella module definition), track that fact.
Index: clang/include/clang/Lex/Preprocessor.h
===
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -625,7 +625,7 @@
/// The directory that the main file should be considered to occupy,
/// if it does not correspond to a real file (as happens when building a
/// module).
- const DirectoryEntry *MainFileDir = nullptr;
+ OptionalDirectoryEntryRef MainFileDir;
/// The number of bytes that we will initially skip when entering the
/// main file, along with a flag that indicates whether skipping this number
@@ -2012,9 +2012,7 @@
/// Set the directory in which the main file should be considered
/// to have been found, if it is not a real file.
- void setMainFileDir(const DirectoryEntry *Dir) {
-MainFileDir = Dir;
- }
+ void setMainFileDir(DirectoryEntryRef Dir) { MainFileDir = Dir; }
/// Instruct the preprocessor to skip part of the main source file.
///
Index: clang/lib/Lex/PPDirectives.cpp
===
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -956,7 +956,7 @@
// map file.
if (!FileEnt) {
if (FID == SourceMgr.getMainFileID() && MainFileDir) {
-Includers.push_back(std::make_pair(nullptr, MainFileDir));
+Includers.push_back(std::make_pair(nullptr, *MainFileDir));
BuildSystemModule = getCurrentModule()->IsSystem;
} else if ((FileEnt =
SourceMgr.getFileEntryForID(SourceMgr.getMainFileID(
Index: clang/lib/Frontend/FrontendAction.cpp
===
--- clang/lib/Frontend/FrontendAction.cpp
+++ clang/lib/Frontend/FrontendAction.cpp
@@ -511,7 +511,7 @@
// Inform the preprocessor that includes from within the input buffer should
// be resolved relative to the build directory of the module map file.
- CI.getPreprocessor().setMainFileDir(M->Directory);
+ CI.getPreprocessor().setMainFileDir(*M->Directory);
// If the module was inferred from a different module map (via an expanded
// umbrella module definition), track that fact.
Index: clang/include/clang/Lex/Preprocessor.h
===
--- clang/include/clang/Lex/Preprocessor.h
+++ clang/include/clang/Lex/Preprocessor.h
@@ -625,7 +625,7 @@
/// The directory that the main file should be considered to occupy,
/// if it does not correspond to a real file (as happens when building a
/// module).
- const DirectoryEntry *MainFileDir = nullptr;
+ OptionalDirectoryEntryRef MainFileDir;
/// The number of bytes that we will initially skip when entering the
/// main file, along with a flag that indicates whether skipping this number
@@ -2012,9 +2012,7 @@
/// Set the directory in which the main file should be considered
/// to have been found, if it is not a real file.
- void setMainFileDir(const DirectoryEntry *Dir) {
-MainFileDir = Dir;
- }
+ void setMainFileDir(DirectoryEntryRef Dir) {