[clang-tools-extra] Add #include <optional> (NFC)

This patch adds #include <optional> to those files containing
llvm::Optional<...> or Optional<...>.

I'll post a separate patch to actually replace llvm::Optional with
std::optional.

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
This commit is contained in:
Kazu Hirata 2023-01-07 20:02:20 -08:00
parent 270e96f435
commit 71f557355d
206 changed files with 206 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
using namespace llvm;
using namespace clang;

View File

@ -16,6 +16,7 @@
#include "llvm/Support/JSON.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
#include <string>
using namespace llvm;

View File

@ -16,6 +16,7 @@
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/Token.h"
#include "llvm/Support/Path.h"
#include <optional>
namespace clang {
namespace find_all_symbols {

View File

@ -13,6 +13,7 @@
#include "SymbolInfo.h"
#include "SymbolReporter.h"
#include "clang/Lex/PPCallbacks.h"
#include <optional>
namespace clang {
class MacroInfo;

View File

@ -18,6 +18,7 @@
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/FileSystem.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -14,6 +14,7 @@
#include "clang/Frontend/TextDiagnostic.h"
#include "clang/Tooling/NodeIntrospection.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
using namespace clang::ast_matchers;
using namespace clang::ast_matchers::dynamic;

View File

@ -14,6 +14,7 @@
#include "clang/Tooling/NodeIntrospection.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include <optional>
#include <set>
using namespace llvm;

View File

@ -37,6 +37,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/WithColor.h"
#include <optional>
#include <string>
using namespace clang;

View File

@ -11,6 +11,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/YAMLParser.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -14,6 +14,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/Optional.h"
#include <optional>
#include <type_traits>
#include <utility>
#include <vector>

View File

@ -36,6 +36,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include <optional>
#include <tuple>
#include <utility>
#include <vector>

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Regex.h"
#include <optional>
namespace clang {

View File

@ -12,6 +12,7 @@
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Serialization/ASTReader.h"
#include <optional>
#define DEBUG_TYPE "clang-tidy"

View File

@ -28,6 +28,7 @@
#include <cassert>
#include <cstddef>
#include <iterator>
#include <optional>
#include <string>
#include <tuple>
#include <type_traits>

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include <cmath>
#include <optional>
#include "DurationRewriter.h"
#include "clang/Tooling/FixIt.h"

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include <cinttypes>
#include <optional>
namespace clang {
namespace tidy {

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -10,6 +10,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -12,6 +12,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/FixIt.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -10,6 +10,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -10,6 +10,7 @@
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_BADSIGNALTOKILLTHREADCHECK_H
#include "../ClangTidyCheck.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -16,6 +16,7 @@
#define DEBUG_TYPE "EasilySwappableParametersCheck"
#include "llvm/Support/Debug.h"
#include <optional>
namespace optutils = clang::tidy::utils::options;

View File

@ -9,6 +9,7 @@
#include "ImplicitWideningOfMultiplicationResultCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "../ClangTidyCheck.h"
#include "../utils/IncludeInserter.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -13,6 +13,7 @@
#include "clang/Lex/Lexer.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -14,6 +14,7 @@
#include "clang/Lex/Token.h"
#include <algorithm>
#include <cctype>
#include <optional>
// FixItHint

View File

@ -11,6 +11,7 @@
#include "../utils/RenamerClangTidyCheck.h"
#include "llvm/ADT/Optional.h"
#include <optional>
#include <string>
#include <vector>

View File

@ -9,6 +9,7 @@
#include "SuspiciousIncludeCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -9,6 +9,7 @@
#include "SuspiciousMemoryComparisonCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -22,6 +22,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Error.h"
#include <memory>
#include <optional>
#include <vector>
namespace clang {

View File

@ -12,6 +12,7 @@
#include "../ClangTidyCheck.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/STLExtras.h"
#include "../utils/ExprSequence.h"
#include <optional>
using namespace clang::ast_matchers;
using namespace clang::tidy::utils;

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include <optional>
#include <string>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -25,6 +25,7 @@
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

View File

@ -15,6 +15,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include <optional>
#include <string>
using namespace clang::ast_matchers;

View File

@ -9,6 +9,7 @@
#include "DeprecatedIosBaseAliasesCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -21,6 +21,7 @@
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstring>
#include <optional>
#include <utility>
using namespace clang::ast_matchers;

View File

@ -21,6 +21,7 @@
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <optional>
#include <string>
#include <utility>

View File

@ -12,6 +12,7 @@
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/Support/FormatVariadic.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -15,6 +15,7 @@
#include "llvm/ADT/StringExtras.h"
#include <cctype>
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "../ClangTidyCheck.h"
#include "clang/Lex/Token.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -11,6 +11,7 @@
#include "../ClangTidyCheck.h"
#include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "../ClangTidyCheck.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -25,6 +25,7 @@
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -14,6 +14,7 @@
#include "../utils/TypeTraits.h"
#include "clang/Analysis/Analyses/ExprMutationAnalyzer.h"
#include "clang/Basic/Diagnostic.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -14,6 +14,7 @@
#include "../utils/OptionsUtils.h"
#include "clang/AST/Decl.h"
#include "clang/Basic/Diagnostic.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -16,6 +16,7 @@
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -13,6 +13,7 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/Optional.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -26,6 +26,7 @@
#include "llvm/Support/ErrorHandling.h"
#include <array>
#include <cassert>
#include <optional>
#include <stack>
#include <tuple>
#include <type_traits>

View File

@ -20,6 +20,7 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/YAMLParser.h"
#include <optional>
#define DEBUG_TYPE "clang-tidy"

View File

@ -11,6 +11,7 @@
#include "../utils/RenamerClangTidyCheck.h"
#include "llvm/ADT/Optional.h"
#include <optional>
namespace clang {
namespace tidy {
namespace readability {

View File

@ -9,6 +9,7 @@
#include "IsolateDeclarationCheck.h"
#include "../utils/LexerUtils.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
using namespace clang::ast_matchers;
using namespace clang::tidy::utils::lexer;

View File

@ -14,6 +14,7 @@
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/StringExtras.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "clang/ASTMatchers/ASTMatchers.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include <optional>
using namespace clang::ast_matchers;

View File

@ -10,6 +10,7 @@
#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include <optional>
using namespace clang::ast_matchers;
using namespace clang::tidy::matchers;

View File

@ -11,6 +11,7 @@
#include "clang/Lex/Lexer.h"
#include "llvm/Support/SaveAndRestore.h"
#include <optional>
#include <string>
#include <utility>

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
#include <sstream>
using namespace clang::ast_matchers;

View File

@ -11,6 +11,7 @@
#include "../ClangTidyCheck.h"
#include "llvm/ADT/StringSet.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -14,6 +14,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
#include <cctype>
#include <optional>
using namespace clang::ast_matchers;

View File

@ -8,6 +8,7 @@
#include "ExprSequence.h"
#include "clang/AST/ParentMapContext.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -9,6 +9,7 @@
#include "FileExtensionsUtils.h"
#include "clang/Basic/CharInfo.h"
#include "llvm/Support/Path.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -14,6 +14,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -10,6 +10,7 @@
#include "LexerUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/Sema/DeclSpec.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -10,6 +10,7 @@
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -13,6 +13,7 @@
#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/StringSet.h"
#include <memory>
#include <optional>
namespace clang {
class Preprocessor;

View File

@ -10,6 +10,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include <algorithm>
#include <optional>
namespace clang {
namespace tidy {

View File

@ -10,6 +10,7 @@
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_INCLUDESORTER_H
#include "../ClangTidyCheck.h"
#include <optional>
#include <string>
namespace clang {

View File

@ -9,6 +9,7 @@
#include "LexerUtils.h"
#include "clang/AST/AST.h"
#include "clang/Basic/SourceManager.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Lexer.h"
#include <optional>
namespace clang {

View File

@ -11,6 +11,7 @@
#include "TypeTraits.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/Lexer.h"
#include <optional>
namespace clang {
namespace tidy {
namespace utils {

View File

@ -16,6 +16,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include <map>
#include <optional>
namespace clang {
namespace tidy {

View File

@ -16,6 +16,7 @@
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/PointerIntPair.h"
#include <optional>
#define DEBUG_TYPE "clang-tidy"

View File

@ -14,6 +14,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/Optional.h"
#include <optional>
#include <string>
#include <utility>

View File

@ -10,6 +10,7 @@
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/STLExtras.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -14,6 +14,7 @@
#include "IncludeSorter.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Tooling/Transformer/Transformer.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -10,6 +10,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -11,6 +11,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -12,6 +12,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Lex/Lexer.h"
#include <optional>
namespace clang {
namespace tidy {

View File

@ -13,6 +13,7 @@
#include "clang/AST/Stmt.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceManager.h"
#include <optional>
#include <set>
namespace clang {

View File

@ -37,6 +37,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include <iterator>
#include <optional>
#include <string>
#include <vector>

View File

@ -21,6 +21,7 @@
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/MacroInfo.h"
#include "llvm/ADT/StringRef.h"
#include <optional>
#include <string>
#include <vector>

View File

@ -44,6 +44,7 @@
#include <functional>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <vector>

View File

@ -23,6 +23,7 @@
#include <chrono>
#include <cstddef>
#include <memory>
#include <optional>
#include <vector>
namespace clang {

View File

@ -50,6 +50,7 @@
#include <future>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <type_traits>

View File

@ -35,6 +35,7 @@
#include "llvm/ADT/StringRef.h"
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>

View File

@ -70,6 +70,7 @@
#include <algorithm>
#include <iterator>
#include <limits>
#include <optional>
#include <utility>
// We log detailed candidate here if you run with -debug-only=codecomplete.

View File

@ -31,6 +31,7 @@
#include "llvm/ADT/StringRef.h"
#include <functional>
#include <future>
#include <optional>
#include <utility>
namespace clang {

Some files were not shown because too many files have changed in this diff Show More