summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-03-25 01:02:12 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-03-25 01:02:12 +0000
commit75fc6a7f61d778477e91a2a2dbdddf435b0c25fd (patch)
tree3dd884bfdceef9657354b401a341845b4e6a54f0
parentc07d1e23fb25688f6282f114deb9fc6f9e6985c9 (diff)
downloadbcm5719-llvm-75fc6a7f61d778477e91a2a2dbdddf435b0c25fd.tar.gz
bcm5719-llvm-75fc6a7f61d778477e91a2a2dbdddf435b0c25fd.zip
[Modules] Make the DeclUpdates map be processed in insertion order.
This fixes my stress tests non-determinism so far. However, I've not started playing with templates, friends, or terrible macros. I've found at least two more seeming instabilities and am just waiting for a test case to actually trigger them. llvm-svn: 233162
-rw-r--r--clang/include/clang/Serialization/ASTWriter.h2
-rw-r--r--clang/test/Modules/Inputs/stress1/common.h38
-rw-r--r--clang/test/Modules/Inputs/stress1/m00.h6
-rw-r--r--clang/test/Modules/Inputs/stress1/m01.h6
-rw-r--r--clang/test/Modules/Inputs/stress1/m02.h6
-rw-r--r--clang/test/Modules/Inputs/stress1/m03.h6
-rw-r--r--clang/test/Modules/Inputs/stress1/merge00.h11
-rw-r--r--clang/test/Modules/Inputs/stress1/module.modulemap6
-rw-r--r--clang/test/Modules/stress1.cpp100
9 files changed, 180 insertions, 1 deletions
diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index 1d872a8c051..d120c98553f 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -321,7 +321,7 @@ private:
};
typedef SmallVector<DeclUpdate, 1> UpdateRecord;
- typedef llvm::DenseMap<const Decl *, UpdateRecord> DeclUpdateMap;
+ typedef llvm::MapVector<const Decl *, UpdateRecord> DeclUpdateMap;
/// \brief Mapping from declarations that came from a chained PCH to the
/// record containing modifications to them.
DeclUpdateMap DeclUpdates;
diff --git a/clang/test/Modules/Inputs/stress1/common.h b/clang/test/Modules/Inputs/stress1/common.h
new file mode 100644
index 00000000000..d2fff1098d9
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/common.h
@@ -0,0 +1,38 @@
+#ifndef STRESS1_COMMON_H
+#define STRESS1_COMMON_H
+
+inline char function00(char x) { return x + x; }
+inline short function00(short x) { return x + x; }
+inline int function00(int x) { return x + x; }
+
+namespace N00 {
+struct S00 {
+ char c;
+ short s;
+ int i;
+
+ S00(char x) : c(x) {}
+ S00(short x) : s(x) {}
+ S00(int x) : i(x) {}
+
+ char method00(char x) { return x + x; }
+ short method00(short x) { return x + x; }
+ int method00(int x) { return x + x; }
+
+ operator char() { return c; }
+ operator short() { return s; }
+ operator int() { return i; }
+};
+struct S01 {};
+struct S03 {};
+}
+
+namespace N01 {
+struct S00 : N00::S00 {
+ using N00::S00::S00;
+};
+struct S01 {};
+struct S02 {};
+}
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/m00.h b/clang/test/Modules/Inputs/stress1/m00.h
new file mode 100644
index 00000000000..ca5af38f58c
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/m00.h
@@ -0,0 +1,6 @@
+#ifndef STRESS1_M00_H
+#define STRESS1_M00_H
+
+#include "common.h"
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/m01.h b/clang/test/Modules/Inputs/stress1/m01.h
new file mode 100644
index 00000000000..d0b150a7382
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/m01.h
@@ -0,0 +1,6 @@
+#ifndef STRESS1_M01_H
+#define STRESS1_M01_H
+
+#include "common.h"
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/m02.h b/clang/test/Modules/Inputs/stress1/m02.h
new file mode 100644
index 00000000000..bb9714ff747
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/m02.h
@@ -0,0 +1,6 @@
+#ifndef STRESS1_M02_H
+#define STRESS1_M02_H
+
+#include "common.h"
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/m03.h b/clang/test/Modules/Inputs/stress1/m03.h
new file mode 100644
index 00000000000..b6dbb68ccd5
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/m03.h
@@ -0,0 +1,6 @@
+#ifndef STRESS1_M03_H
+#define STRESS1_M03_H
+
+#include "common.h"
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/merge00.h b/clang/test/Modules/Inputs/stress1/merge00.h
new file mode 100644
index 00000000000..c6dccdf5305
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/merge00.h
@@ -0,0 +1,11 @@
+#ifndef STRESS1_MERGE00_H
+#define STRESS1_MERGE00_H
+
+#include "m00.h"
+#include "m01.h"
+#include "m02.h"
+#include "m03.h"
+
+inline int g() { return N00::S00('a').method00('b') + (int)N00::S00(42) + function00(42); }
+
+#endif
diff --git a/clang/test/Modules/Inputs/stress1/module.modulemap b/clang/test/Modules/Inputs/stress1/module.modulemap
new file mode 100644
index 00000000000..2b687b01521
--- /dev/null
+++ b/clang/test/Modules/Inputs/stress1/module.modulemap
@@ -0,0 +1,6 @@
+module m00 { header "Inputs/stress1/m00.h" export * }
+module m01 { header "Inputs/stress1/m01.h" export * }
+module m02 { header "Inputs/stress1/m02.h" export * }
+module m03 { header "Inputs/stress1/m03.h" export * }
+
+module merge00 { header "Inputs/stress1/merge00.h" export * }
diff --git a/clang/test/Modules/stress1.cpp b/clang/test/Modules/stress1.cpp
new file mode 100644
index 00000000000..55d9533b7ae
--- /dev/null
+++ b/clang/test/Modules/stress1.cpp
@@ -0,0 +1,100 @@
+// RUN: rm -rf %t
+// RUN: cd %S
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -emit-module -fmodule-name=m00 -o %t/m00.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -emit-module -fmodule-name=m00 -o %t/m00_check.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: diff %t/m00.pcm %t/m00_check.pcm
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -emit-module -fmodule-name=m01 -o %t/m01.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -emit-module -fmodule-name=m02 -o %t/m02.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -emit-module -fmodule-name=m03 -o %t/m03.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -fmodule-file=%t/m00.pcm \
+// RUN: -fmodule-file=%t/m01.pcm \
+// RUN: -fmodule-file=%t/m02.pcm \
+// RUN: -fmodule-file=%t/m03.pcm \
+// RUN: -emit-module -fmodule-name=merge00 -o %t/merge00.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -fmodule-file=%t/m00.pcm \
+// RUN: -fmodule-file=%t/m01.pcm \
+// RUN: -fmodule-file=%t/m02.pcm \
+// RUN: -fmodule-file=%t/m03.pcm \
+// RUN: -emit-module -fmodule-name=merge00 -o %t/merge00_check.pcm \
+// RUN: Inputs/stress1/module.modulemap
+//
+// RUN: diff %t/merge00.pcm %t/merge00_check.pcm
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -fmodule-map-file=Inputs/stress1/module.modulemap \
+// RUN: -fmodule-file=%t/m00.pcm \
+// RUN: -fmodule-file=%t/m01.pcm \
+// RUN: -fmodule-file=%t/m02.pcm \
+// RUN: -fmodule-file=%t/m03.pcm \
+// RUN: -fmodule-file=%t/merge00.pcm \
+// RUN: -verify stress1.cpp -S -emit-llvm -o %t/stress1.ll
+//
+// RUN: %clang_cc1 -fmodules -x c++ -std=c++11 \
+// RUN: -I Inputs/stress1 \
+// RUN: -fno-implicit-modules -fno-modules-implicit-maps \
+// RUN: -fmodule-map-file-home-is-cwd \
+// RUN: -fmodule-map-file=Inputs/stress1/module.modulemap \
+// RUN: -fmodule-file=%t/m00.pcm \
+// RUN: -fmodule-file=%t/m01.pcm \
+// RUN: -fmodule-file=%t/m02.pcm \
+// RUN: -fmodule-file=%t/m03.pcm \
+// RUN: -fmodule-file=%t/merge00.pcm \
+// RUN: -verify stress1.cpp -S -emit-llvm -o %t/stress1_check.ll
+//
+// RUN: diff -u %t/stress1.ll %t/stress1_check.ll
+//
+// expected-no-diagnostics
+
+#include "m00.h"
+#include "m01.h"
+#include "m02.h"
+#include "m03.h"
+
+#include "merge00.h"
+
+int f() { return N01::S00('a').method00('b') + (int)N00::S00(42) + function00(42) + g(); }
OpenPOWER on IntegriCloud