[PATCH] D119409: [C++20] [Modules] Remain variable's definition in module interface

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 12:30:16 PST 2022


urnathan added inline comments.


================
Comment at: clang/test/CodeGenCXX/static-variable-in-module.cpp:2-8
+// RUN: mkdir %t
+// RUN: echo "struct S { S(); };" >> %t/foo.h
+// RUN: echo "static S s = S();" >> %t/foo.h
+// RUN: %clang -std=c++20 -I%t %s -S -emit-llvm -o - | FileCheck %s
+module;
+#include "foo.h"
+export module m;
----------------
rather than generate a foo.h file, why not (ab)use the preprocessor with internal line directives?

```
module;
# 3 __FILE__ 1 // use the next physical line number here (and below)
struct S { S(); };
static S s = S();
# 6 "" 2
export module m;
...
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119409



More information about the cfe-commits mailing list