forked from OSchip/llvm-project
Fix PCHs that import more than one module
We were passing < to std::unique, but it expects ==. Since the input is sorted, we were always trimming it to one entry. llvm-svn: 217402
This commit is contained in:
parent
18f0a986c1
commit
5f95c8fc5f
|
@ -4617,10 +4617,13 @@ void ASTWriter::WriteASTCore(Sema &SemaRef,
|
|||
auto Cmp = [](const ModuleInfo &A, const ModuleInfo &B) {
|
||||
return A.ID < B.ID;
|
||||
};
|
||||
auto Eq = [](const ModuleInfo &A, const ModuleInfo &B) {
|
||||
return A.ID == B.ID;
|
||||
};
|
||||
|
||||
// Sort and deduplicate module IDs.
|
||||
std::sort(Imports.begin(), Imports.end(), Cmp);
|
||||
Imports.erase(std::unique(Imports.begin(), Imports.end(), Cmp),
|
||||
Imports.erase(std::unique(Imports.begin(), Imports.end(), Eq),
|
||||
Imports.end());
|
||||
|
||||
RecordData ImportedModules;
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
@import cstd.stdio;
|
||||
@import other_constants.dbl_max;
|
||||
static inline void SPXTrace() { fprintf(__stderrp, ""); }
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
// RUN: %clang_cc1 %s -include-pch %t/pch-used.h.pch -fmodules -fmodules-cache-path=%t/cache -O0 -isystem %S/Inputs/System/usr/include -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void f() { SPXTrace(); }
|
||||
void g() { double x = DBL_MAX; }
|
||||
|
||||
// CHECK: define internal void @SPXTrace
|
||||
|
|
Loading…
Reference in New Issue