aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-11-21 19:06:42 -0800
committerKazu Hirata <kazu@google.com>2022-11-21 19:06:42 -0800
commit6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b (patch)
tree8f6741f9b0cdd8b892c83c78614e861d9ec325ad /clang/lib/CodeGen/CodeGenAction.cpp
parent1f914944b6c9a5e4229ceb9f06140fdf178c5ea0 (diff)
downloadllvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.zip
llvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.tar.gz
llvm-6ba4b62af8df00edb7e1cc0c473f6770fb1cfe3b.tar.bz2
Return None instead of Optional<T>() (NFC)
This patch replaces: return Optional<T>(); with: return None; to make the migration from llvm::Optional to std::optional easier. Specifically, I can deprecate None (in my source tree, that is) to identify all the instances of None that should be replaced with std::nullopt. Note that "return None" far outnumbers "return Optional<T>();". There are more than 2000 instances of "return None" in our source tree. All of the instances in this patch come from functions that return Optional<T> except Archive::findSym and ASTNodeImporter::import, where we return Expected<Optional<T>>. Note that we can construct Expected<Optional<T>> from any parameter convertible to Optional<T>, which None certainly is. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 Differential Revision: https://reviews.llvm.org/D138464
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 8c12a67..5297101 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -698,7 +698,7 @@ BackendConsumer::getFunctionSourceLocation(const Function &F) const {
if (Pair.first == Hash)
return Pair.second;
}
- return Optional<FullSourceLoc>();
+ return None;
}
void BackendConsumer::UnsupportedDiagHandler(