[PATCH] D133586: [clang] initialize type qualifiers for FunctionNoProtoType

Richard Howell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 13 15:00:06 PDT 2022


rmaz added a comment.

In D133586#3781536 <https://reviews.llvm.org/D133586#3781536>, @rtrieu wrote:

> In D133586#3781468 <https://reviews.llvm.org/D133586#3781468>, @rmaz wrote:
>
>> In D133586#3781381 <https://reviews.llvm.org/D133586#3781381>, @rtrieu wrote:
>>
>>> Do you have a test case for this?
>>
>> Was struggling to think of a good one. How about a test that repeatedly generates a pcm for a func decl with no params and checks if the DECL_FUNCTION record is the same?
>
> Have you looked at clang/test/Modules/odr_hash.cpp?  It's where most of the ODR hash testing takes place by testing that Decls can be merged properly instead of checking the contents of pcm files..  Using `#if define`, it creates multiple modules from the same file.  I would suggest creating two functions in each of the modules, then in the main file, using the function to force it to be loaded from the modules and merged together.  The test should fail with the current Clang, but pass with your patch.  You may need to create your test file if you need different compiler options.

I took a look at writing a test to cover this, but hit the following problem: function qualifiers are only valid on c++ members, and there we cannot create FunctionNoProtoTypes. I couldn't think of a way of testing this by comparing module output that would fail deterministically, as it relies on reusing uninitialized memory that is non-zero.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133586/new/

https://reviews.llvm.org/D133586



More information about the cfe-commits mailing list