Skip to content

Commit

Permalink
Replace llvm::Optional, llvm::None with their std equivalents
Browse files Browse the repository at this point in the history
  • Loading branch information
devajithvs authored and jenkins committed Dec 13, 2023
1 parent cf51c60 commit 879eed2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include/cling/MetaProcessor/MetaSema.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "clang/Basic/FileManager.h" // for DenseMap<FileEntry*>

#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include <optional>

namespace llvm {
class StringRef;
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace cling {
///
///\param[in] mode - either on/off or toggle.
///
void actOndebugCommand(llvm::Optional<int> mode) const;
void actOndebugCommand(std::optional<int> mode) const;

///\brief Prints out the the Debug information of the state changes.
///
Expand Down
5 changes: 3 additions & 2 deletions lib/Interpreter/IncrementalCUDADeviceCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <algorithm>
#include <bitset>
#include <optional>
#include <string>
#include <system_error>

Expand Down Expand Up @@ -292,8 +293,8 @@ namespace cling {
}

// is not important, because PTX does not use any object format
llvm::Optional<llvm::Reloc::Model> RM =
llvm::Optional<llvm::Reloc::Model>(llvm::Reloc::Model::PIC_);
std::optional<llvm::Reloc::Model> RM =
std::optional<llvm::Reloc::Model>(llvm::Reloc::Model::PIC_);

llvm::TargetOptions TO = llvm::TargetOptions();

Expand Down
4 changes: 3 additions & 1 deletion lib/Interpreter/IncrementalJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include <llvm/Support/Host.h>
#include <llvm/Target/TargetMachine.h>

#include <optional>

#ifdef __linux__
#include <sys/stat.h>
#endif
Expand Down Expand Up @@ -683,7 +685,7 @@ void* IncrementalJIT::getSymbolAddress(StringRef Name, bool IncludeHostSymbols){
if (!IncludeHostSymbols)
G.lock();

std::pair<llvm::StringMapIterator<llvm::NoneType>, bool> insertInfo;
std::pair<llvm::StringMapIterator<std::nullopt_t>, bool> insertInfo;
if (!IncludeHostSymbols)
insertInfo = m_ForbidDlSymbols.insert(Name);

Expand Down
4 changes: 3 additions & 1 deletion lib/Interpreter/InterpreterCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "clang/Serialization/ASTDeserializationListener.h"
#include "clang/Serialization/ASTReader.h"

#include <optional>

using namespace clang;

namespace cling {
Expand Down Expand Up @@ -154,7 +156,7 @@ namespace cling {
return m_Source->getModule(ID);
}

virtual llvm::Optional<ASTSourceDescriptor>
virtual std::optional<ASTSourceDescriptor>
getSourceDescriptor(unsigned ID) override {
return m_Source->getSourceDescriptor(ID);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/MetaProcessor/MetaParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
#include "cling/Utils/Output.h"
#include "cling/Utils/Paths.h"

#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Path.h"

#include <optional>

namespace cling {

MetaParser::MetaParser(MetaSema &Actions, llvm::StringRef Line) :
Expand Down Expand Up @@ -433,7 +434,7 @@ namespace cling {
bool MetaParser::isdebugCommand() {
if (getCurTok().is(tok::ident) &&
getCurTok().getIdent().equals("debug")) {
llvm::Optional<int> mode;
std::optional<int> mode;
consumeToken();
skipWhitespace();
if (getCurTok().is(tok::constant))
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaProcessor/MetaSema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ namespace cling {
m_Interpreter.enableRawInput(mode);
}

void MetaSema::actOndebugCommand(llvm::Optional<int> mode) const {
void MetaSema::actOndebugCommand(std::optional<int> mode) const {
constexpr clang::codegenoptions::DebugInfoKind DebugInfo[] = {
clang::codegenoptions::NoDebugInfo,
clang::codegenoptions::LocTrackingOnly,
Expand Down

0 comments on commit 879eed2

Please sign in to comment.