summaryrefslogtreecommitdiff
path: root/clang-tools-extra/modularize
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-18 11:19:40 -0800
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-18 11:23:54 -0800
commit205c0589f918f95d2f2c586a01bea2716d73d603 (patch)
tree38b2227ab6d17d7d189f32a23e5498404d45b634 /clang-tools-extra/modularize
parenta538f7cfb1d71cd1a71b5b6d9fe8672a8b6d973e (diff)
downloadllvm-205c0589f918f95d2f2c586a01bea2716d73d603.tar.gz
Revert "[clang] Convert OptionalFileEntryRefDegradesToFileEntryPtr to std::optional"
This reverts commit 8f0df9f3bbc6d7f3d5cbfd955c5ee4404c53a75d. The Optional*RefDegradesTo*EntryPtr types want to keep the same size as the underlying type, which std::optional doesn't guarantee. For use with llvm::Optional, they define their own storage class, and there is no way to do that in std::optional. On top of that, that commit broke builds with older GCCs, where std::optional was not trivially copyable (static_assert in the clang sources was failing).
Diffstat (limited to 'clang-tools-extra/modularize')
-rw-r--r--clang-tools-extra/modularize/CoverageChecker.cpp8
-rw-r--r--clang-tools-extra/modularize/PreprocessorTracker.cpp5
2 files changed, 5 insertions, 8 deletions
diff --git a/clang-tools-extra/modularize/CoverageChecker.cpp b/clang-tools-extra/modularize/CoverageChecker.cpp
index d1c0cf89087f..610fb596305c 100644
--- a/clang-tools-extra/modularize/CoverageChecker.cpp
+++ b/clang-tools-extra/modularize/CoverageChecker.cpp
@@ -50,9 +50,9 @@
//
//===----------------------------------------------------------------------===//
-#include "CoverageChecker.h"
#include "ModularizeUtilities.h"
#include "clang/AST/ASTConsumer.h"
+#include "CoverageChecker.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/SourceManager.h"
@@ -69,7 +69,6 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
-#include <optional>
using namespace Modularize;
using namespace clang;
@@ -90,9 +89,8 @@ public:
void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
StringRef FileName, bool IsAngled,
CharSourceRange FilenameRange,
- std::optional<FileEntryRef> File,
- StringRef SearchPath, StringRef RelativePath,
- const Module *Imported,
+ Optional<FileEntryRef> File, StringRef SearchPath,
+ StringRef RelativePath, const Module *Imported,
SrcMgr::CharacteristicKind FileType) override {
Checker.collectUmbrellaHeaderHeader(File->getName());
}
diff --git a/clang-tools-extra/modularize/PreprocessorTracker.cpp b/clang-tools-extra/modularize/PreprocessorTracker.cpp
index f6972886631a..171a9380b793 100644
--- a/clang-tools-extra/modularize/PreprocessorTracker.cpp
+++ b/clang-tools-extra/modularize/PreprocessorTracker.cpp
@@ -251,7 +251,6 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/raw_ostream.h"
-#include <optional>
namespace Modularize {
@@ -735,7 +734,7 @@ public:
const clang::Token &IncludeTok,
llvm::StringRef FileName, bool IsAngled,
clang::CharSourceRange FilenameRange,
- std::optional<clang::FileEntryRef> File,
+ llvm::Optional<clang::FileEntryRef> File,
llvm::StringRef SearchPath,
llvm::StringRef RelativePath,
const clang::Module *Imported,
@@ -1279,7 +1278,7 @@ void PreprocessorCallbacks::InclusionDirective(
clang::SourceLocation HashLoc, const clang::Token &IncludeTok,
llvm::StringRef FileName, bool IsAngled,
clang::CharSourceRange FilenameRange,
- std::optional<clang::FileEntryRef> File, llvm::StringRef SearchPath,
+ llvm::Optional<clang::FileEntryRef> File, llvm::StringRef SearchPath,
llvm::StringRef RelativePath, const clang::Module *Imported,
clang::SrcMgr::CharacteristicKind FileType) {
int DirectiveLine, DirectiveColumn;