Use llvm's optional

This commit is contained in:
Jack Andersen 2019-10-18 15:31:35 -10:00
parent ee012692ba
commit 03f9314a2a
1 changed files with 5 additions and 3 deletions

View File

@ -1167,7 +1167,7 @@ class ATDNAAction : public clang::ASTFrontendAction {
} }
#if LLVM_VERSION_MAJOR >= 9 #if LLVM_VERSION_MAJOR >= 9
std::optional<clang::DependencyFileGenerator> TheDependencyFileGenerator; llvm::Optional<clang::DependencyFileGenerator> TheDependencyFileGenerator;
#else #else
std::unique_ptr<clang::DependencyFileGenerator> TheDependencyFileGenerator; std::unique_ptr<clang::DependencyFileGenerator> TheDependencyFileGenerator;
#endif #endif
@ -1180,8 +1180,10 @@ public:
DepOpts.OutputFile = DepFileOut.getValue(); DepOpts.OutputFile = DepFileOut.getValue();
DepOpts.Targets = DepFileTargets; DepOpts.Targets = DepFileTargets;
#if LLVM_VERSION_MAJOR >= 9 #if LLVM_VERSION_MAJOR >= 9
if (!DepOpts.OutputFile.empty()) if (!DepOpts.OutputFile.empty()) {
TheDependencyFileGenerator.emplace(DepOpts).attachToPreprocessor(compiler.getPreprocessor()); TheDependencyFileGenerator.emplace(DepOpts);
TheDependencyFileGenerator->attachToPreprocessor(compiler.getPreprocessor());
}
#else #else
if (!DepOpts.OutputFile.empty()) if (!DepOpts.OutputFile.empty())
TheDependencyFileGenerator.reset( TheDependencyFileGenerator.reset(