[all-commits] [llvm/llvm-project] 3a4c1b: [Serialization] Read the initializer for interesti...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed May 15 18:55:57 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a4c1b9b4428b08d4475decf74c11e0d328c5842
      https://github.com/llvm/llvm-project/commit/3a4c1b9b4428b08d4475decf74c11e0d328c5842
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2024-05-16 (Thu, 16 May 2024)

  Changed paths:
    M clang/lib/Serialization/ASTReaderDecl.cpp
    A clang/test/Modules/pr91418.cppm
    M clang/test/OpenMP/nvptx_lambda_capturing.cpp

  Log Message:
  -----------
  [Serialization] Read the initializer for interesting static variables before consuming it (#92218)

Close https://github.com/llvm/llvm-project/issues/91418

Since we load the variable's initializers lazily, it'd be problematic if
the initializers dependent on each other.

For example,

```
SomeType a = ...;
SomeType b = a;
```

Previously, when we load variable `b`, we need to load the initializer,
then we need to load `a`. We can only mark the variable `b` as loaded
after we load `a`. Then `a` is always initialized before `b`. However,
it is not true after we implement lazy loading for initializers.

So here we try to load the initializers of static variables to make sure
they are passed to code generator by order. If we read any thing
interesting, we would consume that before emitting the current
declaration.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list