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

Richard Howell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 13:06:55 PDT 2022


rmaz added a comment.

In D133586#3809475 <https://reviews.llvm.org/D133586#3809475>, @aaron.ballman wrote:

> This is why I'm wondering how we're hitting this problem in the first place. C++ shouldn't be able to create a function without a prototype so why does the ODR hash matter (do we use that in C and I just wasn't aware of it)?

The ODR hash matters because it is serialized in PCM output, regardless of which function type it is:

https://github.com/llvm/llvm-project/blob/main/clang/lib/AST/ODRHash.cpp#L889-L908

Leaving the `FastTypeQuals` uninitialized can lead to non-deterministic values of the ODR hash, and so the serialized module output. With enough leading 0s this can lead to a size change in the PCM file, which will start to fail builds due to a size mismatch during PCM validation.

Some alternative approaches could be:

- don't call these methods in `VisitFunctionNoProtoType` (and audit other callsites)
- remove these methods from `FunctionNoProtoType`


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