alexfh wrote:

After manually cleaning up the ~10KB that CVise could squeeze out of the 
initial 400+MB, I got this:
```
//--- a.cppmap
module "a" {
header "a.h"
}
//--- b.cppmap
module "b" {
header "b.h"
}
//--- d.cppmap
module "d" {
header "d.h"
}
//--- stl.cppmap
module "stl" {
header "stl.h"
}
//--- a.h
#include "b.h"
namespace {
void a(absl::set<char> c) {
  absl::map<int> a;
  absl::set<int> b;
  c.end();
  c.contains();
}
}  // namespace
//--- b.h
#include "c.h"
void b() { absl::set<char> x; }
//--- c.h
#include "stl.h"
inline namespace internal {
template <typename>
class set_base {
 public:
  struct iterator {
    void u() const;
  };
  iterator end() const { return {}; }
  void contains() const { end().u(); }
  pair<iterator> e();
  template <typename H>
  friend H h();
};
template <typename>
class map_base {
  template <typename H>
  friend H h();
};
}  // namespace internal
namespace absl {
template <typename T>
class set : public set_base<T> {};
template <typename T>
class map : public map_base<T> {};
}  // namespace absl
//--- d.h
#include "c.h"
void d() { absl::set<char> x; }
//--- stl.h
#ifndef _STL_H_
#define _STL_H_
template <class>
struct pair;
#endif
//--- main.cc
#include "c.h"
void f(absl::set<char> o) { o.contains(); }
```

```
$ $CLANG -fmodule-name=stl -fmodule-map-file=stl.cppmap 
-Xclang=-fno-cxx-modules -xc++ -Xclang=-emit-module -fmodules -std=c++20 -c 
stl.cppmap -o stl.pcm

$ $CLANG -fmodule-name=d -fmodule-map-file=d.cppmap -Xclang=-fno-cxx-modules 
-xc++ -Xclang=-emit-module -fmodules -fmodule-file=stl.pcm -std=c++20 -c 
d.cppmap -o d.pcm

$ $CLANG -fmodule-name=b -fmodule-map-file=b.cppmap -Xclang=-fno-cxx-modules 
-xc++ -Xclang=-emit-module -fmodules -fmodule-file=stl.pcm -std=c++20 -c 
b.cppmap -o b.pcm

$ $CLANG -fmodule-name=a -fmodule-map-file=a.cppmap -Xclang=-fno-cxx-modules 
-xc++ -Xclang=-emit-module -fmodules -fmodule-file=stl.pcm -fmodule-file=b.pcm 
-fmodule-file=d.pcm -std=c++20 -c a.cppmap -o a.pcm

$ $CLANG -Xclang=-fno-cxx-modules -fmodules -fmodule-file=a.pcm -std=c++20 -c 
main.cc -o main.o
assert.h assertion failed at clang/lib/AST/RecordLayoutBuilder.cpp:3377 in 
const ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const RecordDecl 
*) const: D && "Cannot get layout of forward declarations!"
*** Check failure stack trace: ***
    @     0x55e64e1aed24  __assert_fail
    @     0x55e64a2c7646  clang::ASTContext::getASTRecordLayout()
    @     0x55e649c95e48  clang::ASTContext::getTypeInfoImpl()
    @     0x55e649c97297  clang::ASTContext::getTypeInfo()
    @     0x55e649c979bc  clang::ASTContext::getTypeAlignInChars()
    @     0x55e6481188d3  clang::CodeGen::CodeGenFunction::CreateIRTemp()
    @     0x55e6483843bc  clang::CodeGen::CodeGenFunction::StartFunction()
    @     0x55e648386716  clang::CodeGen::CodeGenFunction::GenerateCode()
    @     0x55e6483b20ec  
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition()
    @     0x55e6483a9662  clang::CodeGen::CodeGenModule::EmitGlobalDefinition()
    @     0x55e64839a226  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e64839a242  clang::CodeGen::CodeGenModule::EmitDeferred()
    @     0x55e648396c6e  clang::CodeGen::CodeGenModule::Release()
    @     0x55e6484dc8ae  (anonymous 
namespace)::CodeGeneratorImpl::HandleTranslationUnit()
...
```



https://github.com/llvm/llvm-project/pull/133057
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to