[clang] 1f88fb4 - [clang] Use std::nullopt instead of None in comments (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 8 22:43:19 PST 2022


Author: Kazu Hirata
Date: 2022-12-08T22:43:11-08:00
New Revision: 1f88fb406cc323eb36fc5f18626915b4ba75560e

URL: https://github.com/llvm/llvm-project/commit/1f88fb406cc323eb36fc5f18626915b4ba75560e
DIFF: https://github.com/llvm/llvm-project/commit/1f88fb406cc323eb36fc5f18626915b4ba75560e.diff

LOG: [clang] Use std::nullopt instead of None in comments (NFC)

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

Added: 
    

Modified: 
    clang/include/clang/Analysis/CFG.h
    clang/include/clang/Analysis/ProgramPoint.h
    clang/include/clang/Basic/SourceManager.h
    clang/include/clang/Basic/TargetInfo.h
    clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
    clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/CFG.h b/clang/include/clang/Analysis/CFG.h
index ecf5906fa1dca..c46d6f3ff05a4 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -103,7 +103,7 @@ class CFGElement {
     return t;
   }
 
-  /// Convert to the specified CFGElement type, returning None if this
+  /// Convert to the specified CFGElement type, returning std::nullopt if this
   /// CFGElement is not of the desired type.
   template<typename T>
   Optional<T> getAs() const {

diff  --git a/clang/include/clang/Analysis/ProgramPoint.h b/clang/include/clang/Analysis/ProgramPoint.h
index 81a1288f61c7b..1df5b74b20a36 100644
--- a/clang/include/clang/Analysis/ProgramPoint.h
+++ b/clang/include/clang/Analysis/ProgramPoint.h
@@ -144,7 +144,7 @@ class ProgramPoint {
     return t;
   }
 
-  /// Convert to the specified ProgramPoint type, returning None if this
+  /// Convert to the specified ProgramPoint type, returning std::nullopt if this
   /// ProgramPoint is not of the desired type.
   template<typename T>
   Optional<T> getAs() const {

diff  --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h
index bed429d17422e..20f2415ddce38 100644
--- a/clang/include/clang/Basic/SourceManager.h
+++ b/clang/include/clang/Basic/SourceManager.h
@@ -1075,13 +1075,13 @@ class SourceManager : public RefCountedBase<SourceManager> {
   StringRef getBufferData(FileID FID, bool *Invalid = nullptr) const;
 
   /// Return a StringRef to the source buffer data for the
-  /// specified FileID, returning None if invalid.
+  /// specified FileID, returning std::nullopt if invalid.
   ///
   /// \param FID The file ID whose contents will be returned.
   llvm::Optional<StringRef> getBufferDataOrNone(FileID FID) const;
 
   /// Return a StringRef to the source buffer data for the
-  /// specified FileID, returning None if it's not yet loaded.
+  /// specified FileID, returning std::nullopt if it's not yet loaded.
   ///
   /// \param FID The file ID whose contents will be returned.
   llvm::Optional<StringRef> getBufferDataIfLoaded(FileID FID) const;

diff  --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index 6775d18cdefed..746e0f4ea918b 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1436,7 +1436,7 @@ class TargetInfo : public virtual TransferrableTargetInfo,
   }
 
   // Get the cache line size of a given cpu. This method switches over
-  // the given cpu and returns "None" if the CPU is not found.
+  // the given cpu and returns "std::nullopt" if the CPU is not found.
   virtual Optional<unsigned> getCPUCacheLineSize() const {
     return std::nullopt;
   }

diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
index 2ae811ee33653..6a84e82ddf293 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -99,7 +99,7 @@ class SVal {
   /// the desired type.
   template <typename T> T castAs() const { return llvm::cast<T>(*this); }
 
-  /// Convert to the specified SVal type, returning None if this SVal is
+  /// Convert to the specified SVal type, returning std::nullopt if this SVal is
   /// not of the desired type.
   template <typename T> Optional<T> getAs() const {
     return llvm::dyn_cast<T>(*this);

diff  --git a/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp b/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
index 77cab35cde350..d1de04ba39e0f 100644
--- a/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
+++ b/clang/lib/Tooling/Transformer/SourceCodeBuilders.cpp
@@ -214,7 +214,8 @@ llvm::Optional<std::string> tooling::buildAccess(const Expr &RawExpression,
                                                  ASTContext &Context,
                                                  PLTClass Classification) {
   if (RawExpression.isImplicitCXXThis())
-    // Return the empty string, because `None` signifies some sort of failure.
+    // Return the empty string, because `std::nullopt` signifies some sort of
+    // failure.
     return std::string();
 
   const Expr *E = RawExpression.IgnoreImplicitAsWritten();


        


More information about the cfe-commits mailing list