[PATCH] D101793: [clang][AST] Improve AST Reader/Writer memory footprint

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 21 14:18:05 PDT 2021


yaxunl added a comment.

In D101793#2774191 <https://reviews.llvm.org/D101793#2774191>, @weiwang wrote:

> In D101793#2772717 <https://reviews.llvm.org/D101793#2772717>, @yaxunl wrote:
>
>> In D101793#2772461 <https://reviews.llvm.org/D101793#2772461>, @weiwang wrote:
>>
>>> Thanks for the approval!
>>>
>>> Just want to understand the list of "decls to check for deferred diagnostics" better, where are these decls coming from? And why do they need to be checked for warnings? I see decls from libc are in the list, but I have no idea why are they selected.
>>
>> For offloading languages e.g. OpenMP/CUDA/HIP, there are apparent errors in functions shared between host and device. However, unless these functions are sure to be emitted on device or host, these errors should not be emitted. These errors are so called deferred error messages. The function decls which need to be checked are recorded. After AST is finalized, the AST of these functions are iterated. If a function is found sure to be emitted, the deferred error message in it are emitted.
>
> Thanks! So the `DeclsToCheckForDeferredDiags` contains the candidate decls to be checked. The decls are selected because they would generate diags in the context of offloading languages, but whether or not an diag will be emitted is deferred till traversal of the AST is performed. I still don't quite understand why would libc functions be in the candidate list? They look simple enough (and I think they've been there forever).  For example `__uint16_identity` (https://code.woboq.org/userspace/glibc/bits/uintn-identity.h.html#32),
>
>   static inline __uint16_t __uint16_identity(__uint16_t __x) {
>       return __x;
>   }
>
> I don't see how this function would generate diag either on host or device.

A function may call another function which contains deferred diagnostics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101793



More information about the cfe-commits mailing list