Skip to content

[Clang] [NFC] Remove default argument in ASTUnit.h #78566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

Sirraide
Copy link
Member

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.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jan 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Jan 18, 2024

@llvm/pr-subscribers-clang

Author: None (Sirraide)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/78566.diff

2 Files Affected:

  • (modified) clang/include/clang/Frontend/ASTUnit.h (+1-1)
  • (modified) clang/tools/libclang/CIndexCodeCompletion.cpp (+2-1)
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index fe99b3d5adbfa0..6af712afdcb6d8 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 196c64e6172274..3c5f390f6d888a 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());
 

@Sirraide
Copy link
Member Author

CC @AaronBallman

@Sirraide
Copy link
Member Author

Sirraide commented Jan 18, 2024

Not sure why that one CI job got cancelled candidly, but I don’t think I can re-run it.

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@AaronBallman
Copy link
Collaborator

I'll commit on your behalf once CI comes back green.

@AaronBallman AaronBallman merged commit 061eb62 into llvm:main Jan 19, 2024
@Sirraide Sirraide deleted the ast_unit branch January 19, 2024 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants