[clang] [Clang] [NFC] Remove default argument in ASTUnit.h (PR #78566)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 04:05:16 PST 2024


https://github.com/Sirraide created https://github.com/llvm/llvm-project/pull/78566

This removes a default argument that is currently broken in C++23 mode due to `std::default_delete` now being `constexpr`. This is a known problem (see #74963, #59966, #69996, and a couple more), fixing which will probably take some time, so this at least makes it possible to compile `ASTUnit.h` in C++23 mode.

Note that we can’t simply include the header that provides the definition of the class causing the problem either, as that would create a circular dependency.

>From 414b7c3275b3dd71405e73f5f9ed43cfcf4421d7 Mon Sep 17 00:00:00 2001
From: Sirraide <aeternalmail at gmail.com>
Date: Thu, 18 Jan 2024 12:55:41 +0100
Subject: [PATCH] [NFC] Remove default argument

---
 clang/include/clang/Frontend/ASTUnit.h        | 2 +-
 clang/tools/libclang/CIndexCodeCompletion.cpp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index fe99b3d5adbfa0a..6af712afdcb6d8d 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -902,7 +902,7 @@ class ASTUnit {
                     SourceManager &SourceMgr, FileManager &FileMgr,
                     SmallVectorImpl<StoredDiagnostic> &StoredDiagnostics,
                     SmallVectorImpl<const llvm::MemoryBuffer *> &OwnedBuffers,
-                    std::unique_ptr<SyntaxOnlyAction> Act = nullptr);
+                    std::unique_ptr<SyntaxOnlyAction> Act);
 
   /// Save this translation unit to a file with the given name.
   ///
diff --git a/clang/tools/libclang/CIndexCodeCompletion.cpp b/clang/tools/libclang/CIndexCodeCompletion.cpp
index 196c64e61722746..3c5f390f6d888a9 100644
--- a/clang/tools/libclang/CIndexCodeCompletion.cpp
+++ b/clang/tools/libclang/CIndexCodeCompletion.cpp
@@ -765,7 +765,8 @@ clang_codeCompleteAt_Impl(CXTranslationUnit TU, const char *complete_filename,
                     IncludeBriefComments, Capture,
                     CXXIdx->getPCHContainerOperations(), *Results->Diag,
                     Results->LangOpts, *Results->SourceMgr, *Results->FileMgr,
-                    Results->Diagnostics, Results->TemporaryBuffers);
+                    Results->Diagnostics, Results->TemporaryBuffers,
+                    /*SyntaxOnlyAction=*/nullptr);
 
   Results->DiagnosticsWrappers.resize(Results->Diagnostics.size());
 



More information about the cfe-commits mailing list