Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ Miscellaneous Clang Crashes Fixed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Fixed crash when ``-print-stats`` is enabled in compiling IR files. (#GH131608)
- Fix code completion crash involving PCH serialzied templates. (#GH139019)

OpenACC Specific Changes
------------------------
Expand Down
4 changes: 3 additions & 1 deletion clang/lib/Serialization/TemplateArgumentHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ void TemplateArgumentHasher::AddTemplateArgument(TemplateArgument TA) {

switch (Kind) {
case TemplateArgument::Null:
llvm_unreachable("Expected valid TemplateArgument");
// These can occur in incomplete substitutions performed with code
// completion (see PartialOverloading).
Copy link
Collaborator

Choose a reason for hiding this comment

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

see PartialOverloading where? Is there a specific method or API doc we should look at?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the term of art within clang, and the name of the flag as used in source code.
A search on doxygen for this term should lead to:

  /// AddOverloadCandidate - Adds the given function to the set of
  /// candidate functions, using the given function call arguments.  If
  /// @p SuppressUserConversions, then don't allow user-defined
  /// conversions via constructors or conversion operators.
  ///
  /// \param PartialOverloading true if we are performing "partial" overloading
  /// based on an incomplete set of function arguments. This feature is used by
  /// code completion.

This term can also easily be greped for, and there are no irrelevant results.
But this is mostly undocumented.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So I am using Visual Studio code and did a naive search for PartialOverloading and it was definitely not obvious where I specifically should look for this term. I did spend some time trying to dig around.

I think my point is that the comment is not super helpful unless you already have some understanding. So it requires a bit more elaboration so that random folks who come upon can get it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this name is the best stable reference to this functionality.
And I don't think mentioning file names is a good idea, and there is no documentation to point to.

Is there any specific thing this comment should say so you think this would be easier to find?

break;
case TemplateArgument::Type:
AddQualType(TA.getAsType());
break;
Expand Down
26 changes: 26 additions & 0 deletions clang/test/CodeCompletion/GH139019.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/test.hpp -emit-pch -o %t/1.pch
// RUN: %clang_cc1 -std=c++20 %t/test.cpp -include-pch %t/1.pch -code-completion-at=%t/test.cpp:7:17

//--- test.hpp
#pragma once
class provider_t
{
public:
template<class T>
void emit(T *data)
{}
};

//--- test.cpp
#include "test.hpp"

void test()
{
provider_t *focus;
void *data;
focus->emit(&data);
}
Loading