diff options
author | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-18 11:19:40 -0800 |
---|---|---|
committer | Krzysztof Parzyszek <kparzysz@quicinc.com> | 2022-12-18 11:23:54 -0800 |
commit | 205c0589f918f95d2f2c586a01bea2716d73d603 (patch) | |
tree | 38b2227ab6d17d7d189f32a23e5498404d45b634 /clang-tools-extra/pp-trace | |
parent | a538f7cfb1d71cd1a71b5b6d9fe8672a8b6d973e (diff) | |
download | llvm-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/pp-trace')
-rw-r--r-- | clang-tools-extra/pp-trace/PPCallbacksTracker.cpp | 10 | ||||
-rw-r--r-- | clang-tools-extra/pp-trace/PPCallbacksTracker.h | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp index 1f2eeda6ed92..c1434558698d 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.cpp @@ -17,7 +17,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Lex/MacroArgs.h" #include "llvm/Support/raw_ostream.h" -#include <optional> namespace clang { namespace pp_trace { @@ -134,10 +133,9 @@ void PPCallbacksTracker::FileSkipped(const FileEntryRef &SkippedFile, // of whether the inclusion will actually result in an inclusion. void PPCallbacksTracker::InclusionDirective( SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, - bool IsAngled, CharSourceRange FilenameRange, - std::optional<FileEntryRef> File, llvm::StringRef SearchPath, - llvm::StringRef RelativePath, const Module *Imported, - SrcMgr::CharacteristicKind FileType) { + bool IsAngled, CharSourceRange FilenameRange, Optional<FileEntryRef> File, + llvm::StringRef SearchPath, llvm::StringRef RelativePath, + const Module *Imported, SrcMgr::CharacteristicKind FileType) { beginCallback("InclusionDirective"); appendArgument("HashLoc", HashLoc); appendArgument("IncludeTok", IncludeTok); @@ -488,7 +486,7 @@ void PPCallbacksTracker::appendArgument(const char *Name, FileID Value) { // Append a FileEntry argument to the top trace item. void PPCallbacksTracker::appendArgument(const char *Name, - std::optional<FileEntryRef> Value) { + Optional<FileEntryRef> Value) { if (!Value) { appendArgument(Name, "(null)"); return; diff --git a/clang-tools-extra/pp-trace/PPCallbacksTracker.h b/clang-tools-extra/pp-trace/PPCallbacksTracker.h index c494556b4424..864014631f04 100644 --- a/clang-tools-extra/pp-trace/PPCallbacksTracker.h +++ b/clang-tools-extra/pp-trace/PPCallbacksTracker.h @@ -21,15 +21,14 @@ #ifndef PPTRACE_PPCALLBACKSTRACKER_H #define PPTRACE_PPCALLBACKSTRACKER_H -#include "clang/Basic/SourceManager.h" #include "clang/Lex/PPCallbacks.h" #include "clang/Lex/Preprocessor.h" +#include "clang/Basic/SourceManager.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/GlobPattern.h" -#include <optional> #include <string> #include <vector> @@ -95,7 +94,7 @@ public: void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, bool IsAngled, CharSourceRange FilenameRange, - std::optional<FileEntryRef> File, + Optional<FileEntryRef> File, llvm::StringRef SearchPath, llvm::StringRef RelativePath, const Module *Imported, SrcMgr::CharacteristicKind FileType) override; @@ -180,7 +179,7 @@ public: void appendArgument(const char *Name, FileID Value); /// Append a FileEntryRef argument to the top trace item. - void appendArgument(const char *Name, std::optional<FileEntryRef> Value); + void appendArgument(const char *Name, Optional<FileEntryRef> Value); void appendArgument(const char *Name, FileEntryRef Value); /// Append a SourceLocation argument to the top trace item. |